From 5dca838ba388d75d5b4928ea928e7cea7de8ebd3 Mon Sep 17 00:00:00 2001 From: geeksville Date: Sun, 2 Feb 2020 08:17:45 -0800 Subject: [PATCH] wip --- TODO.md | 7 ++++++- src/MeshRadio.cpp | 4 ++-- src/configuration.h | 2 +- src/main.ino | 23 +++++++++++++++++------ 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/TODO.md b/TODO.md index c7508525..5c4b8be4 100644 --- a/TODO.md +++ b/TODO.md @@ -2,7 +2,7 @@ # High priority -* solder debug headers to board - debug sendTo hang bug +* solder debug headers to board * make message send from android go to service, then to mesh radio * make message receive from radio go through to android * have MeshService keep a node DB by sniffing user messages @@ -23,12 +23,17 @@ # Pre-beta priority +* don't even power on bluetooth until we have some data to send to the android phone. Most of the time we should be sleeping in a lowpower "listening for lora" only mode. Once we have some packets for the phone, then power on bluetooth +until the phone pulls those packets. Ever so often power on bluetooth just so we can see if the phone wants to send some packets. Possibly might need ULP processor to help with this wake process. * do hibernation mode to get power draw down to 2.5uA https://lastminuteengineers.com/esp32-sleep-modes-power-consumption/ * make sure main cpu is not woken for packets with bad crc or not addressed to this node - do that in the radio hw * enable fast init inside the gps chip * dynamically select node nums * triple check fcc compliance * allow setting full radio params from android +* pick channel center frequency based on name? "dolphin" would hash to 900Mhz, "cat" to 905MHz etc? Or is that too opaque? +* scan to find channels with low background noise? +* share channel settings over Signal (or qr code) by embedding an an URL which is handled by the MeshUtil app. # Low priority diff --git a/src/MeshRadio.cpp b/src/MeshRadio.cpp index a68fe31d..637ca389 100644 --- a/src/MeshRadio.cpp +++ b/src/MeshRadio.cpp @@ -61,8 +61,8 @@ bool MeshRadio::init() { // The default transmitter power is 13dBm, using PA_BOOST. // If you are using RFM95/96/97/98 modules which uses the PA_BOOST transmitter pin, then // you can set transmitter powers from 5 to 23 dBm: - // FIXME - can we do this? - // rf95.setTxPower(23, false); + // FIXME - can we do this? It seems to be in the Heltec board. + rf95.setTxPower(23, false); return true; } diff --git a/src/configuration.h b/src/configuration.h index 7f791e61..e1f0d988 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -124,7 +124,7 @@ along with this program. If not, see . #define RESET_OLED 16 -#define VEXT_ENABLE 21 // active low, powers the oled display +#define VEXT_ENABLE 21 // active low, powers the oled display and the lora antenna boost #define LED_PIN 25 #define BUTTON_PIN 0 diff --git a/src/main.ino b/src/main.ino index ac0fba37..daecf8da 100644 --- a/src/main.ino +++ b/src/main.ino @@ -61,8 +61,6 @@ void doDeepSleep(uint64_t msecToWake) screen_off(); // datasheet says this will draw only 10ua - // FIXME, shutdown radiohead interrupts before powering off device - // Put radio in sleep mode (will still draw power but only 0.2uA) radio.sleep(); @@ -82,7 +80,16 @@ void doDeepSleep(uint64_t msecToWake) if (axp192_found) { // turn on after initial testing with real hardware - axp.setPowerOutPut(AXP192_LDO2, AXP202_OFF); // LORA radio + + // 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 + + // 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 + // all the time. + + // axp.setPowerOutPut(AXP192_LDO2, AXP202_OFF); // LORA radio + axp.setPowerOutPut(AXP192_LDO3, AXP202_OFF); // GPS main power } #endif @@ -98,7 +105,7 @@ void doDeepSleep(uint64_t msecToWake) some current will flow through these external and internal resistors, increasing deep sleep current above the minimal possible value. - Note: we don't isolate pins that are used for the 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, /* 4, */ 12,13, /* 14, */ /* 15, */ @@ -108,6 +115,9 @@ void doDeepSleep(uint64_t msecToWake) for(int i = 0; i < sizeof(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 + // 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 // until then we need the following lines esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON); @@ -116,8 +126,9 @@ void doDeepSleep(uint64_t msecToWake) // Only GPIOs which are have RTC functionality can be used in this bit map: 0,2,4,12-15,25-27,32-39. uint64_t gpioMask = (1ULL << BUTTON_PIN); - // FIXME change polarity so we can wake on ANY_HIGH instead - that would allow us to use all three buttons (instead of just the first) - gpio_pullup_en((gpio_num_t)BUTTON_PIN); + // Not needed because both of the current boards have external pullups + // FIXME change polarity in hw so we can wake on ANY_HIGH instead - that would allow us to use all three buttons (instead of just the first) + // gpio_pullup_en((gpio_num_t)BUTTON_PIN); esp_sleep_enable_ext1_wakeup(gpioMask, ESP_EXT1_WAKEUP_ALL_LOW); #endif