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 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 diff --git a/src/ButtonThread.h b/src/ButtonThread.h index 50ac14316..fe014246c 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/FSCommon.cpp b/src/FSCommon.cpp index b0ba44f28..76dc97757 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/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/graphics/Screen.cpp b/src/graphics/Screen.cpp index da18fce28..1fa27339d 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -948,9 +948,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 diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 63d67871e..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"); @@ -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 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; } diff --git a/src/shutdown.h b/src/shutdown.h index a0b10f4ff..4c82b16c4 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 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