From dcc6a4b5e7fd7074dd7daf17fa8936eafa4828a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Thu, 28 Jul 2022 09:37:16 +0200 Subject: [PATCH 01/10] Tryfix LED T-Echo --- src/ButtonThread.h | 7 +++++++ src/shutdown.h | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/src/ButtonThread.h b/src/ButtonThread.h index 49243a93d..1549c748b 100644 --- a/src/ButtonThread.h +++ b/src/ButtonThread.h @@ -144,8 +144,15 @@ class ButtonThread : public concurrency::OSThread screen->startShutdownScreen(); DEBUG_MSG("Shutdown from long press"); playBeep(); +#ifdef PIN_LED1 ledOff(PIN_LED1); +#endif +#ifdef PIN_LED2 ledOff(PIN_LED2); +#endif +#ifdef PIN_LED3 + ledOff(PIN_LED3); +#endif shutdown_on_long_stop = true; } #endif diff --git a/src/shutdown.h b/src/shutdown.h index 57cd1b691..718ed0e0b 100644 --- a/src/shutdown.h +++ b/src/shutdown.h @@ -21,8 +21,15 @@ void powerCommandsCheck() if (shutdownAtMsec) { screen->startShutdownScreen(); playBeep(); +#ifdef PIN_LED1 ledOff(PIN_LED1); +#endif +#ifdef PIN_LED2 ledOff(PIN_LED2); +#endif +#ifdef PIN_LED3 + ledOff(PIN_LED3); +#endif } #endif From 874d308b505c56943788964cbfd473c26851edbd Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 3 Aug 2022 07:16:41 -0500 Subject: [PATCH 02/10] Only save devicestate on GPS reset (#1587) --- src/gps/GPS.cpp | 2 +- src/mesh/NodeDB.cpp | 10 ++++++++++ src/mesh/NodeDB.h | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index b0a8164d0..f8bff1dfd 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -330,7 +330,7 @@ int32_t GPS::runOnce() if(devicestate.did_gps_reset && (millis() > 60000) && !hasFlow()) { DEBUG_MSG("GPS is not communicating, trying factory reset on next bootup.\n"); devicestate.did_gps_reset = false; - nodeDB.saveToDisk(); + nodeDB.saveDeviceStateToDisk(); } #endif } diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 63d67871e..cb4c625db 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -435,6 +435,16 @@ void NodeDB::saveChannelsToDisk() } } +void NodeDB::saveDeviceStateToDisk() +{ + if (!devicestate.no_save) { +#ifdef FSCom + FSCom.mkdir("/prefs"); +#endif + saveProto(prefFileName, DeviceState_size, sizeof(devicestate), DeviceState_fields, &devicestate); + } +} + void NodeDB::saveToDisk() { if (!devicestate.no_save) { diff --git a/src/mesh/NodeDB.h b/src/mesh/NodeDB.h index 0a2a5bdb7..a96fe22c2 100644 --- a/src/mesh/NodeDB.h +++ b/src/mesh/NodeDB.h @@ -44,7 +44,7 @@ class NodeDB void init(); /// write to flash - void saveToDisk(), saveChannelsToDisk(); + void saveToDisk(), saveChannelsToDisk(), saveDeviceStateToDisk(); /** Reinit radio config if needed, because either: * a) sometimes a buggy android app might send us bogus settings or From 01ac8d10b5ebdaaf7fe716e23adb6ee8488a6b47 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 3 Aug 2022 07:28:43 -0500 Subject: [PATCH 03/10] Add station-g1 to release (#1589) --- bin/build-all.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/build-all.sh b/bin/build-all.sh index 79486cda8..55c151da1 100755 --- a/bin/build-all.sh +++ b/bin/build-all.sh @@ -5,7 +5,7 @@ set -e VERSION=`bin/buildinfo.py long` SHORT_VERSION=`bin/buildinfo.py short` -BOARDS_ESP32="rak11200 tlora-v2 tlora-v1 tlora_v1_3 tlora-v2-1-1.6 tbeam heltec-v1 heltec-v2.0 heltec-v2.1 tbeam0.7 meshtastic-diy-v1 nano-g1 m5stack-core m5stack-coreink" +BOARDS_ESP32="rak11200 tlora-v2 tlora-v1 tlora_v1_3 tlora-v2-1-1.6 tbeam heltec-v1 heltec-v2.0 heltec-v2.1 tbeam0.7 meshtastic-diy-v1 nano-g1 station-g1 m5stack-core m5stack-coreink" #BOARDS_ESP32=tbeam # FIXME note nrf52840dk build is for some reason only generating a BIN file but not a HEX file nrf52840dk-geeksville is fine From 86095323e51479070725806ba522a51af22e2f20 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 3 Aug 2022 07:36:29 -0500 Subject: [PATCH 04/10] Add station-g1 to PR build (#1588) --- .github/workflows/main_matrix.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index c0caaa86b..bad04e9ec 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -38,6 +38,7 @@ jobs: - board: rak4631_eink - board: t-echo - board: nano-g1 + - board: station-g1 - board: m5stack-core - board: m5stack-coreink @@ -95,6 +96,7 @@ jobs: - board: tbeam0.7 - board: meshtastic-diy-v1 - board: nano-g1 + - board: station-g1 - board: m5stack-core - board: m5stack-coreink From 7afc14991e773300dac689446effddfa182caba2 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 3 Aug 2022 07:38:20 -0500 Subject: [PATCH 05/10] Bump for release --- version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.properties b/version.properties index e6f5a11df..fdb24c552 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 1 minor = 3 -build = 28 +build = 29 From 2ad9e238e25cda6d182829e531af286d3b927282 Mon Sep 17 00:00:00 2001 From: GUVWAF Date: Wed, 3 Aug 2022 19:08:23 +0200 Subject: [PATCH 06/10] RoutingModule can handle encrypted packets --- src/modules/RoutingModule.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modules/RoutingModule.cpp b/src/modules/RoutingModule.cpp index 6acf5fe59..40919eef9 100644 --- a/src/modules/RoutingModule.cpp +++ b/src/modules/RoutingModule.cpp @@ -44,4 +44,5 @@ void RoutingModule::sendAckNak(Routing_Error err, NodeNum to, PacketId idFrom, C RoutingModule::RoutingModule() : ProtobufModule("routing", PortNum_ROUTING_APP, Routing_fields) { isPromiscuous = true; + encryptedOk = true; } From 295dca84154d64bbf0f1340004d482433990b933 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Thu, 4 Aug 2022 09:08:02 +0200 Subject: [PATCH 07/10] Work around bug in littlefs rename() for now. After upstream change to version 2.5 this can be reverted. --- src/FSCommon.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ src/FSCommon.h | 1 + src/mesh/NodeDB.cpp | 2 +- 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/src/FSCommon.cpp b/src/FSCommon.cpp index b0ba44f28..56dece8cd 100644 --- a/src/FSCommon.cpp +++ b/src/FSCommon.cpp @@ -1,6 +1,46 @@ #include "configuration.h" #include "FSCommon.h" + +bool copyFile(const char* from, const char* to) +{ +#ifdef FSCom + unsigned char cbuffer[16]; + + File f1 = FSCom.open(from, FILE_O_READ); + if (!f1){ + DEBUG_MSG("Failed to open file"); + return false; + } + + File f2 = FSCom.open(to, FILE_O_WRITE); + if (!f2) { + DEBUG_MSG("Failed to open file"); + return false; + } + + while (f1.available() > 0) { + byte i = f1.read(cbuffer, 16); + f2.write(cbuffer, i); + } + + f2.close(); + f1.close(); + return true; +#endif +} + +bool renameFile(const char* pathFrom, const char* pathTo) +{ +#ifdef FSCom + if (copyFile(pathFrom, pathTo) & FSCom.remove(pathFrom) ) { + return true; + } else{ + return false; + } +#endif +} + void listDir(const char * dirname, uint8_t levels) { #ifdef FSCom diff --git a/src/FSCommon.h b/src/FSCommon.h index 3493a8464..89b2ed10d 100644 --- a/src/FSCommon.h +++ b/src/FSCommon.h @@ -31,5 +31,6 @@ using namespace Adafruit_LittleFS_Namespace; #endif void fsInit(); +bool renameFile(const char* pathFrom, const char* pathTo); void listDir(const char * dirname, uint8_t levels); void rmDir(const char * dirname); diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index cb4c625db..48a525fcd 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -414,7 +414,7 @@ bool saveProto(const char *filename, size_t protoSize, size_t objSize, const pb_ // brief window of risk here ;-) if (FSCom.exists(filename) && !FSCom.remove(filename)) DEBUG_MSG("Warning: Can't remove old pref file\n"); - if (!FSCom.rename(filenameTmp.c_str(), filename)) + if (!renameFile(filenameTmp.c_str(), filename)) DEBUG_MSG("Error: can't rename new pref file\n"); } else { DEBUG_MSG("Can't write prefs\n"); From 18d5712ecd5d98f13c0edf343268413492b2b3a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Thu, 4 Aug 2022 09:10:50 +0200 Subject: [PATCH 08/10] This code was committed by mistake --- src/ButtonThread.h | 7 ------- src/shutdown.h | 7 ------- 2 files changed, 14 deletions(-) diff --git a/src/ButtonThread.h b/src/ButtonThread.h index fe014246c..50ac14316 100644 --- a/src/ButtonThread.h +++ b/src/ButtonThread.h @@ -144,15 +144,8 @@ class ButtonThread : public concurrency::OSThread screen->startShutdownScreen(); DEBUG_MSG("Shutdown from long press"); playBeep(); -#ifdef PIN_LED1 ledOff(PIN_LED1); -#endif -#ifdef PIN_LED2 ledOff(PIN_LED2); -#endif -#ifdef PIN_LED3 - ledOff(PIN_LED3); -#endif shutdown_on_long_stop = true; } #endif diff --git a/src/shutdown.h b/src/shutdown.h index 4c82b16c4..a0b10f4ff 100644 --- a/src/shutdown.h +++ b/src/shutdown.h @@ -21,15 +21,8 @@ void powerCommandsCheck() if (shutdownAtMsec) { screen->startShutdownScreen(); playBeep(); -#ifdef PIN_LED1 ledOff(PIN_LED1); -#endif -#ifdef PIN_LED2 ledOff(PIN_LED2); -#endif -#ifdef PIN_LED3 - ledOff(PIN_LED3); -#endif } #endif From 71a9f4645101709fb110a5a896dc7747024b6108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Thu, 4 Aug 2022 09:12:56 +0200 Subject: [PATCH 09/10] change to logical and operator --- src/FSCommon.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FSCommon.cpp b/src/FSCommon.cpp index 56dece8cd..76dc97757 100644 --- a/src/FSCommon.cpp +++ b/src/FSCommon.cpp @@ -33,7 +33,7 @@ bool copyFile(const char* from, const char* to) bool renameFile(const char* pathFrom, const char* pathTo) { #ifdef FSCom - if (copyFile(pathFrom, pathTo) & FSCom.remove(pathFrom) ) { + if (copyFile(pathFrom, pathTo) && FSCom.remove(pathFrom) ) { return true; } else{ return false; From 9bc2b4d8d789adaf4e37dbd30dea1353e9d56446 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Thu, 4 Aug 2022 10:35:40 +0200 Subject: [PATCH 10/10] Skip unneccessary EINK update --- src/graphics/Screen.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index fc447dc71..2359c4dc2 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -935,9 +935,11 @@ void Screen::setup() handleSetOn(true); // On some ssd1306 clones, the first draw command is discarded, so draw it - // twice initially. + // twice initially. Skip this for EINK Displays to save a few seconds during boot ui.update(); +#ifndef USE_EINK ui.update(); +#endif serialSinceMsec = millis(); // Subscribe to status updates