make bat voltage sensing work on eink

1.2-legacy
geeksville 2020-09-26 18:13:16 -07:00
rodzic 956d9e96f2
commit 28ec0e310d
3 zmienionych plików z 9 dodań i 12 usunięć

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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