From 09855b76ef06e751805a83064aeb6b72af89286e Mon Sep 17 00:00:00 2001 From: geeksville Date: Wed, 17 Jun 2020 15:45:49 -0700 Subject: [PATCH 1/4] TODO updates --- docs/software/TODO.md | 20 ++++++++------------ docs/software/esp32-arduino-build-notes.md | 16 ++++++++++++++++ docs/software/ramusage-nrf52.txt | 2 ++ 3 files changed, 26 insertions(+), 12 deletions(-) create mode 100644 docs/software/esp32-arduino-build-notes.md diff --git a/docs/software/TODO.md b/docs/software/TODO.md index a47d73e64..0b52c70bb 100644 --- a/docs/software/TODO.md +++ b/docs/software/TODO.md @@ -1,22 +1,18 @@ -# High priority +# Geeksville's current work queue -- nrf52 free memory https://learn.adafruit.com/bluefruit-nrf52-feather-learning-guide/hathach-memory-map +You probably don't care about this section - skip to the next one. + +- fix hasGPS bug +- make new android release +- check in our modified arduino binaries +- post bug on esp32-arduino - encryption review findings writeup - NRF52 BLE -- cubecell - DSR - turn on modem-sleep mode - https://github.com/espressif/arduino-esp32/issues/1142#issuecomment-512428852 -``` - last EDF release in arduino is: https://github.com/espressif/arduino-esp32/commit/1977370e6fc069e93ffd8818798fbfda27ae7d99 - IDF release/v3.3 46b12a560 - IDF release/v3.3 367c3c09c - https://docs.espressif.com/projects/esp-idf/en/release-v3.3/get-started/linux-setup.html - kevinh@kevin-server:~/development/meshtastic/esp32-arduino-lib-builder\$ python /home/kevinh/development/meshtastic/esp32-arduino-lib-builder/esp-idf/components/esptool*py/esptool/esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dout --flash_freq 40m --flash_size detect 0x1000 /home/kevinh/development/meshtastic/esp32-arduino-lib-builder/build/bootloader/bootloader.bin - cp -a out/tools/sdk/* components/arduino/tools/sdk - cp -ar components/arduino/ ~/.platformio/packages/framework-arduinoespressif32@src-fba9d33740f719f712e9f8b07da6ea13/ -``` + # Medium priority diff --git a/docs/software/esp32-arduino-build-notes.md b/docs/software/esp32-arduino-build-notes.md new file mode 100644 index 000000000..45fb7a54f --- /dev/null +++ b/docs/software/esp32-arduino-build-notes.md @@ -0,0 +1,16 @@ +# esp32-arduino build instructions + +We build our own custom version of esp32-arduino, in order to get some fixes we've made but haven't yet been merged in master. + +These are a set of currently unformatted notes on how to build and install them. Most developers should not care about this, because +you'll automatically get our fixed libraries. + +``` + last EDF release in arduino is: https://github.com/espressif/arduino-esp32/commit/1977370e6fc069e93ffd8818798fbfda27ae7d99 + IDF release/v3.3 46b12a560 + IDF release/v3.3 367c3c09c + https://docs.espressif.com/projects/esp-idf/en/release-v3.3/get-started/linux-setup.html + kevinh@kevin-server:~/development/meshtastic/esp32-arduino-lib-builder\$ python /home/kevinh/development/meshtastic/esp32-arduino-lib-builder/esp-idf/components/esptool*py/esptool/esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dout --flash_freq 40m --flash_size detect 0x1000 /home/kevinh/development/meshtastic/esp32-arduino-lib-builder/build/bootloader/bootloader.bin + cp -a out/tools/sdk/* components/arduino/tools/sdk + cp -ar components/arduino/ ~/.platformio/packages/framework-arduinoespressif32@src-fba9d33740f719f712e9f8b07da6ea13/ +``` diff --git a/docs/software/ramusage-nrf52.txt b/docs/software/ramusage-nrf52.txt index 9969806e4..380b1bbbb 100644 --- a/docs/software/ramusage-nrf52.txt +++ b/docs/software/ramusage-nrf52.txt @@ -18,6 +18,8 @@ b) shrink packet pool size because none of that storage will be used for ToPhone c) don't allocate any storage in RAM for the tophone messages we save inside device state, instead just use nanopb callbacks to save/load those d) a smarter MeshPacket in memory representation would save about 7KB of RAM. call pb_release before freeing each freshly malloced MeshPacket +- nrf52 free memory https://learn.adafruit.com/bluefruit-nrf52-feather-learning-guide/hathach-memory-map + 2000790c 00003558 B devicestate // 16KB 2000b53c 00001000 b _cache_buffer // 4KB flash filesystem support 20003b1c 000006b0 B console From 463666aec57cd41735c6b499fae9e94bfb08dfea Mon Sep 17 00:00:00 2001 From: geeksville Date: Wed, 17 Jun 2020 16:04:37 -0700 Subject: [PATCH 2/4] oops - can't call DEBUG_MSG this early on ESP32 --- src/mesh/Router.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mesh/Router.cpp b/src/mesh/Router.cpp index fa425ddbe..9c9bedd69 100644 --- a/src/mesh/Router.cpp +++ b/src/mesh/Router.cpp @@ -36,9 +36,11 @@ Allocator &packetPool = staticPool; */ Router::Router() : fromRadioQueue(MAX_RX_FROMRADIO) { - DEBUG_MSG("Size of NodeInfo %d\n", sizeof(NodeInfo)); +// This is called pre main(), don't touch anything here, the following code is not safe + + /* DEBUG_MSG("Size of NodeInfo %d\n", sizeof(NodeInfo)); DEBUG_MSG("Size of SubPacket %d\n", sizeof(SubPacket)); - DEBUG_MSG("Size of MeshPacket %d\n", sizeof(MeshPacket)); + DEBUG_MSG("Size of MeshPacket %d\n", sizeof(MeshPacket)); */ } /** From 7678540a931927b9c93ad0a095996bd0a0e02b17 Mon Sep 17 00:00:00 2001 From: geeksville Date: Wed, 17 Jun 2020 17:25:55 -0700 Subject: [PATCH 3/4] For #187 was not reporting GPS status on new API --- src/mesh/PhoneAPI.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mesh/PhoneAPI.cpp b/src/mesh/PhoneAPI.cpp index 59750d468..8d705327b 100644 --- a/src/mesh/PhoneAPI.cpp +++ b/src/mesh/PhoneAPI.cpp @@ -3,6 +3,7 @@ #include "NodeDB.h" #include "PowerFSM.h" #include "RadioInterface.h" +#include "GPS.h" #include PhoneAPI::PhoneAPI() @@ -78,6 +79,7 @@ void PhoneAPI::handleToRadio(const uint8_t *buf, size_t bufLength) } } + /** * Get the next packet we want to send to the phone, or NULL if no such packet is available. * @@ -108,6 +110,7 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf) break; case STATE_SEND_MY_INFO: + myNodeInfo.has_gps = gps && gps->isConnected; // Update with latest GPS connect info fromRadioScratch.which_variant = FromRadio_my_info_tag; fromRadioScratch.variant.my_info = myNodeInfo; state = STATE_SEND_RADIO; From 3005373760ada7bcf0d390c1c3befb46dccb2443 Mon Sep 17 00:00:00 2001 From: geeksville Date: Wed, 17 Jun 2020 17:26:37 -0700 Subject: [PATCH 4/4] fix wording of GPS screen messages to be less confusing. Now: No GPS No Sats GPS OK --- src/main.cpp | 2 +- src/screen.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 16aa20998..cfbd7e484 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -335,7 +335,7 @@ void loop() screen.debug()->setChannelNameStatus(channelSettings.name); screen.debug()->setPowerStatus(powerStatus); // TODO(#4): use something based on hdop to show GPS "signal" strength. - screen.debug()->setGPSStatus(gps->hasLock() ? "good" : "bad"); + screen.debug()->setGPSStatus(gps->isConnected ? (gps->hasLock() ? "GPS ok" : "No Sats") : "No GPS"); // No GPS lock yet, let the OS put the main CPU in low power mode for 100ms (or until another interrupt comes in) // i.e. don't just keep spinning in loop as fast as we can. diff --git a/src/screen.cpp b/src/screen.cpp index 9198bc202..1837ef797 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -667,7 +667,7 @@ void DebugInfo::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16 } if (!gpsStatus.empty()) { - snprintf(gpsStr, sizeof(gpsStr), "GPS %s", gpsStatus.c_str()); + snprintf(gpsStr, sizeof(gpsStr), "%s", gpsStatus.c_str()); } else { gpsStr[0] = '\0'; // Just show empty string. }