diff --git a/src/Power.cpp b/src/Power.cpp index 7d032b666..f6ae1c691 100644 --- a/src/Power.cpp +++ b/src/Power.cpp @@ -66,7 +66,10 @@ bool Power::analogInit() { #ifdef BATTERY_PIN DEBUG_MSG("Using analog input for battery level\n"); +#ifndef NO_ESP32 + // ESP32 needs special analog stuff adcAttachPin(BATTERY_PIN); +#endif // adcStart(BATTERY_PIN); analogReadResolution(10); // Default of 12 is not very linear. Recommended to use 10 or 11 depending on needed resolution. batteryLevel = &analogLevel; diff --git a/src/PowerFSM.cpp b/src/PowerFSM.cpp index f72e5842a..14f7b996b 100644 --- a/src/PowerFSM.cpp +++ b/src/PowerFSM.cpp @@ -11,16 +11,7 @@ static void sdsEnter() { - /* - - // Don't deepsleep if we have USB power or if the user as pressed a button recently - // !isUSBPowered <- doesn't work yet because the axp192 isn't letting the battery fully charge when we are awake - FIXME - if (millis() - lastPressMs > radioConfig.preferences.mesh_sds_timeout_secs) - { - doDeepSleep(radioConfig.preferences.sds_secs); - } -*/ - + // FIXME - make sure GPS and LORA radio are off first - because we want close to zero current draw doDeepSleep(radioConfig.preferences.sds_secs * 1000LL); } diff --git a/variants/eink/variant.h b/variants/eink/variant.h index bc54f7a51..e0cdda0d2 100644 --- a/variants/eink/variant.h +++ b/variants/eink/variant.h @@ -27,6 +27,9 @@ /* @geeksville eink TODO: +confirm that watchdog reset (i.e. all pins now become inputs) won't cause the board to power down when we are not connected to USB +(I bet it will). If this happens recommended fix is to add an external pullup on PWR_ON GPIO. + fix bootloader to use two buttons - remove bootloader hacks fix battery voltage sensing fix floating point SEGGER printf on nrf52 - see "new NMEA GPS pos" @@ -86,7 +89,7 @@ extern "C" { */ #define PIN_A0 (4) // Battery ADC -// #define BATTERY_PIN PIN_A0 +#define BATTERY_PIN PIN_A0 static const uint8_t A0 = PIN_A0; @@ -202,7 +205,7 @@ FIXME define/FIX flash access #define PIN_SPI_SCK (0 + 19) // To debug via the segger JLINK console rather than the CDC-ACM serial device -// #define USE_SEGGER +#define USE_SEGGER #ifdef __cplusplus }