allow heltec boards to boot without i2c when jtag debugging

This commit is contained in:
geeksville 2020-02-04 07:31:32 -08:00
parent f2a731c22d
commit 4a40b9499b
6 changed files with 39 additions and 27 deletions

View File

@ -1,8 +1,7 @@
# High priority # High priority
* implement new ble characteristics * implement regen user and radio prefs
* have MeshService keep a node DB by sniffing user messages * figure out why protobuf reads of Owner fail - debug with jtag
* figure out why protobuf reads of Owner fail - possibly related to having the wrong number of chracterstics exported over bluetooth
* have meshservice send location data on mesh (if device has a GPS) * have meshservice send location data on mesh (if device has a GPS)
* implement getCurrentTime() - set based off gps but then updated locally * implement getCurrentTime() - set based off gps but then updated locally
* confirm second device receives that gps message and updates device db * confirm second device receives that gps message and updates device db
@ -65,3 +64,5 @@ until the phone pulls those packets. Ever so often power on bluetooth just so w
* test loopback tx/rx path code without using radio * test loopback tx/rx path code without using radio
* notify phone when rx packets arrive, currently the phone polls at startup only * notify phone when rx packets arrive, currently the phone polls at startup only
* figure out if we can use PA_BOOST - yes, it seems to be on both boards * figure out if we can use PA_BOOST - yes, it seems to be on both boards
* implement new ble characteristics
* have MeshService keep a node DB by sniffing user messages

View File

@ -24,12 +24,12 @@ build_flags = -Wall -Wextra -Wno-missing-field-initializers -ggdb -O3 -Wl,-Map,.
; -DLOG_LOCAL_LEVEL=ESP_LOG_DEBUG -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG ; -DLOG_LOCAL_LEVEL=ESP_LOG_DEBUG -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
upload_speed = 921600 upload_speed = 921600
upload_port = /dev/ttyUSB0 ;upload_port = /dev/ttyUSB1
; the default is esptool ; the default is esptool
; upload_protocol = esp-prog ; upload_protocol = esp-prog
; monitor_port = /dev/ttyUSB0 ;monitor_port = /dev/ttyUSB1
monitor_speed = 115200 monitor_speed = 115200
# debug_tool = esp-prog # debug_tool = esp-prog
@ -47,3 +47,4 @@ lib_deps =
ESP8266_SSD1306 ESP8266_SSD1306
AXP202X_Library AXP202X_Library
SPI SPI
Wire ; explicitly needed here because the AXP202 library forgets to add it

View File

@ -122,7 +122,6 @@ static ProtobufCharacteristic
meshMyNodeCharacteristic("ea9f3f82-8dc4-4733-9452-1f6da28892a2", BLECharacteristic::PROPERTY_READ, MyNodeInfo_fields, &myNodeInfo); meshMyNodeCharacteristic("ea9f3f82-8dc4-4733-9452-1f6da28892a2", BLECharacteristic::PROPERTY_READ, MyNodeInfo_fields, &myNodeInfo);
static OwnerCharacteristic meshOwnerCharacteristic; static OwnerCharacteristic meshOwnerCharacteristic;
static RadioCharacteristic meshRadioCharacteristic; static RadioCharacteristic meshRadioCharacteristic;
/** /**
@ -170,7 +169,7 @@ class BluetoothMeshCallbacks : public BLECharacteristicCallbacks
} }
else else
{ {
assert(0); // fixme not yet implemented // we are uninterested in the other reads
} }
} }
@ -185,7 +184,7 @@ class BluetoothMeshCallbacks : public BLECharacteristicCallbacks
} }
else else
{ {
assert(0); // Not yet implemented // we are uninterested in the other writes
} }
} }
}; };
@ -250,8 +249,8 @@ A variable keepAllPackets, if set to true will suppress this behavior and instea
*/ */
BLEService *createMeshBluetoothService(BLEServer *server) BLEService *createMeshBluetoothService(BLEServer *server)
{ {
// Create the BLE Service // Create the BLE Service, we need more than the default of 15 handles
BLEService *service = server->createService("6ba1b218-15a8-461f-9fa8-5dcae273eafd"); BLEService *service = server->createService(BLEUUID("6ba1b218-15a8-461f-9fa8-5dcae273eafd"), 25, 0);
addWithDesc(service, &meshFromRadioCharacteristic, "fromRadio"); addWithDesc(service, &meshFromRadioCharacteristic, "fromRadio");
addWithDesc(service, &meshToRadioCharacteristic, "toRadio"); addWithDesc(service, &meshToRadioCharacteristic, "toRadio");
@ -271,5 +270,8 @@ BLEService *createMeshBluetoothService(BLEServer *server)
service->start(); service->start();
server->getAdvertising()->addServiceUUID(service->getUUID()); server->getAdvertising()->addServiceUUID(service->getUUID());
Serial.println("*** Mesh service:");
service->dump();
return service; return service;
} }

View File

@ -115,8 +115,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#elif defined(HELTEC_LORA32) #elif defined(HELTEC_LORA32)
#define HW_VENDOR "Heltec" #define HW_VENDOR "Heltec"
#ifndef USE_JTAG // gpio15 is TDO for JTAG, so no I2C on this board while doing jtag
#define I2C_SDA 4 #define I2C_SDA 4
#define I2C_SCL 15 #define I2C_SCL 15
#endif
#define RESET_OLED 16 #define RESET_OLED 16

View File

@ -108,7 +108,10 @@ void doDeepSleep(uint64_t msecToWake)
Note: we don't isolate pins that are used for the LORA, LED, i2c, spi or the wake button Note: we don't isolate pins that are used for the LORA, LED, i2c, spi or the wake button
*/ */
static const uint8_t rtcGpios[] = {/* 0, */ 2, static const uint8_t rtcGpios[] = {/* 0, */ 2,
/* 4, */ 12,13, /* 14, */ /* 15, */ /* 4, */
#ifndef USE_JTAG
12, 13, /* 14, */ /* 15, */
#endif
/* 25, */ 26, /* 27, */ /* 25, */ 26, /* 27, */
32, 33, 34, 35, 36, 37, /* 38, */ 39}; 32, 33, 34, 35, 36, 37, /* 38, */ 39};
@ -291,7 +294,6 @@ void initDeepSleep()
Serial.printf("booted, wake cause %d (boot count %d)\n", wakeCause, bootCount); Serial.printf("booted, wake cause %d (boot count %d)\n", wakeCause, bootCount);
} }
const char *getDeviceName() const char *getDeviceName()
{ {
uint8_t dmac[6]; uint8_t dmac[6];
@ -303,7 +305,6 @@ const char *getDeviceName()
return name; return name;
} }
void setup() void setup()
{ {
// Debug // Debug
@ -324,8 +325,10 @@ void setup()
digitalWrite(RESET_OLED, 1); digitalWrite(RESET_OLED, 1);
#endif #endif
#ifdef I2C_SDA
Wire.begin(I2C_SDA, I2C_SCL); Wire.begin(I2C_SDA, I2C_SCL);
scanI2Cdevice(); scanI2Cdevice();
#endif
axp192Init(); axp192Init();
@ -381,7 +384,8 @@ void loop()
#endif #endif
#ifdef T_BEAM_V10 #ifdef T_BEAM_V10
if(axp192_found) { if (axp192_found)
{
// blink the axp led // blink the axp led
axp.setChgLEDMode(ledon ? AXP20X_LED_LOW_LEVEL : AXP20X_LED_OFF); axp.setChgLEDMode(ledon ? AXP20X_LED_LOW_LEVEL : AXP20X_LED_OFF);
} }

View File

@ -109,6 +109,7 @@ void screen_update() {
} }
void screen_setup() { void screen_setup() {
#ifdef I2C_SDA
// Display instance // Display instance
display = new SSD1306Wire(SSD1306_ADDRESS, I2C_SDA, I2C_SCL); display = new SSD1306Wire(SSD1306_ADDRESS, I2C_SDA, I2C_SCL);
display->init(); display->init();
@ -117,6 +118,7 @@ void screen_setup() {
// Scroll buffer // Scroll buffer
display->setLogBuffer(5, 30); display->setLogBuffer(5, 30);
#endif
} }
void screen_loop() { void screen_loop() {