allow heltec boards to boot without i2c when jtag debugging

1.2-legacy
geeksville 2020-02-04 07:31:32 -08:00
rodzic f2a731c22d
commit 4a40b9499b
6 zmienionych plików z 39 dodań i 27 usunięć

Wyświetl plik

@ -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
@ -64,4 +63,6 @@ until the phone pulls those packets. Ever so often power on bluetooth just so w
* make message receive from radio go through to android * make message receive from radio go through to android
* 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

Wyświetl plik

@ -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
@ -46,4 +46,5 @@ lib_deps =
TinyGPSPlus TinyGPSPlus
ESP8266_SSD1306 ESP8266_SSD1306
AXP202X_Library AXP202X_Library
SPI SPI
Wire ; explicitly needed here because the AXP202 library forgets to add it

Wyświetl plik

@ -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;
} }

Wyświetl plik

@ -37,7 +37,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Select which T-Beam board is being used. Only uncomment one. // Select which T-Beam board is being used. Only uncomment one.
// #define T_BEAM_V10 // AKA Rev1 (second board released) //#define T_BEAM_V10 // AKA Rev1 (second board released)
#define HELTEC_LORA32 #define HELTEC_LORA32
// If we are using the JTAG port for debugging, some pins must be left free for that (and things like GPS have to be disabled) // If we are using the JTAG port for debugging, some pins must be left free for that (and things like GPS have to be disabled)
@ -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

Wyświetl plik

@ -83,7 +83,7 @@ void doDeepSleep(uint64_t msecToWake)
// No need to turn this off if the power draw in sleep mode really is just 0.2uA and turning it off would // No need to turn this off if the power draw in sleep mode really is just 0.2uA and turning it off would
// leave floating input for the IRQ line // leave floating input for the IRQ line
// If we want to leave the radio receving in would be 11.5mA current draw, but most of the time it is just waiting // If we want to leave the radio receving in would be 11.5mA current draw, but most of the time it is just waiting
// in its sequencer (true?) so the average power draw should be much lower even if we were listinging for packets // in its sequencer (true?) so the average power draw should be much lower even if we were listinging for packets
// all the time. // all the time.
@ -107,16 +107,19 @@ 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, */
/* 25, */ 26, /* 27, */ #ifndef USE_JTAG
32,33,34,35,36,37,/* 38, */ 39 }; 12, 13, /* 14, */ /* 15, */
#endif
/* 25, */ 26, /* 27, */
32, 33, 34, 35, 36, 37, /* 38, */ 39};
for(int i = 0; i < sizeof(rtcGpios); i++) for (int i = 0; i < sizeof(rtcGpios); i++)
rtc_gpio_isolate((gpio_num_t) rtcGpios[i]); rtc_gpio_isolate((gpio_num_t)rtcGpios[i]);
// FIXME, disable internal rtc pullups/pulldowns on the non isolated pins. for inputs that we aren't using // FIXME, disable internal rtc pullups/pulldowns on the non isolated pins. for inputs that we aren't using
// to detect wake and in normal operation the external part drives them hard. // to detect wake and in normal operation the external part drives them hard.
// FIXME - use an external 10k pulldown so we can leave the RTC peripherals powered off // FIXME - use an external 10k pulldown so we can leave the RTC peripherals powered off
// until then we need the following lines // until then we need the following lines
@ -252,7 +255,7 @@ void axp192Init()
Serial.printf("Exten: %s\n", axp.isExtenEnable() ? "ENABLE" : "DISABLE"); Serial.printf("Exten: %s\n", axp.isExtenEnable() ? "ENABLE" : "DISABLE");
axp.debugCharging(); axp.debugCharging();
pinMode(PMU_IRQ, INPUT_PULLUP); pinMode(PMU_IRQ, INPUT_PULLUP);
attachInterrupt(PMU_IRQ, [] { attachInterrupt(PMU_IRQ, [] {
pmu_irq = true; pmu_irq = true;
@ -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];
@ -299,11 +301,10 @@ const char *getDeviceName()
// Meshtastic_ab3c // Meshtastic_ab3c
static char name[20]; static char name[20];
sprintf(name, "Meshtastic_%02x%02x", dmac[4], dmac[5]); sprintf(name, "Meshtastic_%02x%02x", dmac[4], dmac[5]);
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);
} }

Wyświetl plik

@ -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() {