From c165a49da7c99220892e254b4d84caa3efd11b75 Mon Sep 17 00:00:00 2001 From: Jim Whitelaw Date: Mon, 11 Mar 2024 00:31:29 -0600 Subject: [PATCH 01/11] Adds configuration option to not build/include the webserver. --- src/main.cpp | 4 +++- src/mesh/http/ContentHandler.cpp | 2 ++ src/mesh/http/WebServer.cpp | 6 +++--- src/mesh/wifi/WiFiAPClient.cpp | 13 ++++++++++--- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index ef1cd53c36..b10cddef4a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -33,7 +33,9 @@ // #include #ifdef ARCH_ESP32 +#if !MESHTASTIC_EXCLUDE_WEBSERVER #include "mesh/http/WebServer.h" +#endif #include "nimble/NimbleBluetooth.h" NimbleBluetooth *nimbleBluetooth; #endif @@ -859,7 +861,7 @@ void setup() #endif #endif -#ifdef ARCH_ESP32 +#if defined(ARCH_ESP32) && !MESHTASTIC_EXCLUDE_WEBSERVER // Start web server thread. webServerThread = new WebServerThread(); #endif diff --git a/src/mesh/http/ContentHandler.cpp b/src/mesh/http/ContentHandler.cpp index 7640e879c9..1557948d8b 100644 --- a/src/mesh/http/ContentHandler.cpp +++ b/src/mesh/http/ContentHandler.cpp @@ -1,3 +1,4 @@ +#if !MESHTASTIC_EXCLUDE_WEBSERVER #include "NodeDB.h" #include "PowerFSM.h" #include "RadioLibInterface.h" @@ -855,3 +856,4 @@ void handleScanNetworks(HTTPRequest *req, HTTPResponse *res) res->print(value->Stringify().c_str()); delete value; } +#endif \ No newline at end of file diff --git a/src/mesh/http/WebServer.cpp b/src/mesh/http/WebServer.cpp index 7814f2c296..83fe20dd85 100644 --- a/src/mesh/http/WebServer.cpp +++ b/src/mesh/http/WebServer.cpp @@ -1,3 +1,4 @@ +#if !MESHTASTIC_EXCLUDE_WEBSERVER #include "mesh/http/WebServer.h" #include "NodeDB.h" #include "graphics/Screen.h" @@ -92,7 +93,6 @@ static void taskCreateCert(void *parameter) LOG_DEBUG("Retrieved Private Key: %d Bytes\n", cert->getPKLength()); LOG_DEBUG("Retrieved Certificate: %d Bytes\n", cert->getCertLength()); - } else { LOG_INFO("Creating the certificate. This may take a while. Please wait...\n"); @@ -105,7 +105,6 @@ static void taskCreateCert(void *parameter) if (createCertResult != 0) { LOG_ERROR("Creating the certificate failed\n"); - } else { LOG_INFO("Creating the certificate was successful\n"); @@ -210,4 +209,5 @@ void initWebServer() } else { LOG_ERROR("Web Servers Failed! ;-( \n"); } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/src/mesh/wifi/WiFiAPClient.cpp b/src/mesh/wifi/WiFiAPClient.cpp index b0b033ba0b..0bfa9f08f8 100644 --- a/src/mesh/wifi/WiFiAPClient.cpp +++ b/src/mesh/wifi/WiFiAPClient.cpp @@ -4,13 +4,17 @@ #include "concurrency/Periodic.h" #include "configuration.h" #include "main.h" +#if !MESHTASTIC_EXCLUDE_WEBSERVER #include "mesh/api/WiFiServerAPI.h" +#endif #include "mqtt/MQTT.h" #include "target_specific.h" #include #include #ifdef ARCH_ESP32 +#if !MESHTASTIC_EXCLUDE_WEBSERVER #include "mesh/http/WebServer.h" +#endif #include #include static void WiFiEvent(WiFiEvent_t event); @@ -92,11 +96,13 @@ static void onNetworkConnected() syslog.enable(); } +#if !MESHTASTIC_EXCLUDE_WEBSERVER + #ifdef ARCH_ESP32 initWebServer(); #endif initApiServer(); - +#endif APStartupComplete = true; } @@ -146,7 +152,6 @@ static int32_t reconnectWiFi() perhapsSetRTC(RTCQualityNTP, &tv); lastrun_ntp = millis(); - } else { LOG_DEBUG("NTP Update failed\n"); } @@ -204,7 +209,9 @@ bool initWifi() const char *wifiPsw = config.network.wifi_psk; #ifndef ARCH_RP2040 - createSSLCert(); // For WebServer +#if !MESHTASTIC_EXCLUDE_WEBSERVER + createSSLCert(); // For WebServer +#endif esp_wifi_set_storage(WIFI_STORAGE_RAM); // Disable flash storage for WiFi credentials #endif if (!*wifiPsw) // Treat empty password as no password From fa6dce369aac99ddfa4131c9446cfa0d408f5d85 Mon Sep 17 00:00:00 2001 From: Jim Whitelaw Date: Mon, 11 Mar 2024 00:31:29 -0600 Subject: [PATCH 02/11] Adds configuration option to not build/include the webserver. --- src/main.cpp | 4 +++- src/mesh/http/ContentHandler.cpp | 2 ++ src/mesh/http/WebServer.cpp | 6 +++--- src/mesh/wifi/WiFiAPClient.cpp | 13 ++++++++++--- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index ef1cd53c36..b10cddef4a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -33,7 +33,9 @@ // #include #ifdef ARCH_ESP32 +#if !MESHTASTIC_EXCLUDE_WEBSERVER #include "mesh/http/WebServer.h" +#endif #include "nimble/NimbleBluetooth.h" NimbleBluetooth *nimbleBluetooth; #endif @@ -859,7 +861,7 @@ void setup() #endif #endif -#ifdef ARCH_ESP32 +#if defined(ARCH_ESP32) && !MESHTASTIC_EXCLUDE_WEBSERVER // Start web server thread. webServerThread = new WebServerThread(); #endif diff --git a/src/mesh/http/ContentHandler.cpp b/src/mesh/http/ContentHandler.cpp index 7640e879c9..1557948d8b 100644 --- a/src/mesh/http/ContentHandler.cpp +++ b/src/mesh/http/ContentHandler.cpp @@ -1,3 +1,4 @@ +#if !MESHTASTIC_EXCLUDE_WEBSERVER #include "NodeDB.h" #include "PowerFSM.h" #include "RadioLibInterface.h" @@ -855,3 +856,4 @@ void handleScanNetworks(HTTPRequest *req, HTTPResponse *res) res->print(value->Stringify().c_str()); delete value; } +#endif \ No newline at end of file diff --git a/src/mesh/http/WebServer.cpp b/src/mesh/http/WebServer.cpp index 7814f2c296..83fe20dd85 100644 --- a/src/mesh/http/WebServer.cpp +++ b/src/mesh/http/WebServer.cpp @@ -1,3 +1,4 @@ +#if !MESHTASTIC_EXCLUDE_WEBSERVER #include "mesh/http/WebServer.h" #include "NodeDB.h" #include "graphics/Screen.h" @@ -92,7 +93,6 @@ static void taskCreateCert(void *parameter) LOG_DEBUG("Retrieved Private Key: %d Bytes\n", cert->getPKLength()); LOG_DEBUG("Retrieved Certificate: %d Bytes\n", cert->getCertLength()); - } else { LOG_INFO("Creating the certificate. This may take a while. Please wait...\n"); @@ -105,7 +105,6 @@ static void taskCreateCert(void *parameter) if (createCertResult != 0) { LOG_ERROR("Creating the certificate failed\n"); - } else { LOG_INFO("Creating the certificate was successful\n"); @@ -210,4 +209,5 @@ void initWebServer() } else { LOG_ERROR("Web Servers Failed! ;-( \n"); } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/src/mesh/wifi/WiFiAPClient.cpp b/src/mesh/wifi/WiFiAPClient.cpp index b0b033ba0b..0bfa9f08f8 100644 --- a/src/mesh/wifi/WiFiAPClient.cpp +++ b/src/mesh/wifi/WiFiAPClient.cpp @@ -4,13 +4,17 @@ #include "concurrency/Periodic.h" #include "configuration.h" #include "main.h" +#if !MESHTASTIC_EXCLUDE_WEBSERVER #include "mesh/api/WiFiServerAPI.h" +#endif #include "mqtt/MQTT.h" #include "target_specific.h" #include #include #ifdef ARCH_ESP32 +#if !MESHTASTIC_EXCLUDE_WEBSERVER #include "mesh/http/WebServer.h" +#endif #include #include static void WiFiEvent(WiFiEvent_t event); @@ -92,11 +96,13 @@ static void onNetworkConnected() syslog.enable(); } +#if !MESHTASTIC_EXCLUDE_WEBSERVER + #ifdef ARCH_ESP32 initWebServer(); #endif initApiServer(); - +#endif APStartupComplete = true; } @@ -146,7 +152,6 @@ static int32_t reconnectWiFi() perhapsSetRTC(RTCQualityNTP, &tv); lastrun_ntp = millis(); - } else { LOG_DEBUG("NTP Update failed\n"); } @@ -204,7 +209,9 @@ bool initWifi() const char *wifiPsw = config.network.wifi_psk; #ifndef ARCH_RP2040 - createSSLCert(); // For WebServer +#if !MESHTASTIC_EXCLUDE_WEBSERVER + createSSLCert(); // For WebServer +#endif esp_wifi_set_storage(WIFI_STORAGE_RAM); // Disable flash storage for WiFi credentials #endif if (!*wifiPsw) // Treat empty password as no password From f6ff3f287bff9a9c04714cfe4c09a0e690b678b4 Mon Sep 17 00:00:00 2001 From: Jim Whitelaw Date: Mon, 11 Mar 2024 18:34:44 -0600 Subject: [PATCH 03/11] Keep initApiServer when excluding webserver --- src/mesh/wifi/WiFiAPClient.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/mesh/wifi/WiFiAPClient.cpp b/src/mesh/wifi/WiFiAPClient.cpp index 0bfa9f08f8..6a78022d93 100644 --- a/src/mesh/wifi/WiFiAPClient.cpp +++ b/src/mesh/wifi/WiFiAPClient.cpp @@ -4,9 +4,7 @@ #include "concurrency/Periodic.h" #include "configuration.h" #include "main.h" -#if !MESHTASTIC_EXCLUDE_WEBSERVER #include "mesh/api/WiFiServerAPI.h" -#endif #include "mqtt/MQTT.h" #include "target_specific.h" #include @@ -96,13 +94,10 @@ static void onNetworkConnected() syslog.enable(); } -#if !MESHTASTIC_EXCLUDE_WEBSERVER - -#ifdef ARCH_ESP32 +#if defined(ARCH_ESP32) && !MESHTASTIC_EXCLUDE_WEBSERVER initWebServer(); #endif initApiServer(); -#endif APStartupComplete = true; } From 817675052d0107dfc1c65d2a15b23ca1e3e0addb Mon Sep 17 00:00:00 2001 From: Jim Whitelaw Date: Mon, 11 Mar 2024 18:47:29 -0600 Subject: [PATCH 04/11] fixes for failed formatting check --- src/mesh/wifi/WiFiAPClient.cpp | 74 +++++++++++----------------------- 1 file changed, 23 insertions(+), 51 deletions(-) diff --git a/src/mesh/wifi/WiFiAPClient.cpp b/src/mesh/wifi/WiFiAPClient.cpp index 1bd294a589..bf1e993f92 100644 --- a/src/mesh/wifi/WiFiAPClient.cpp +++ b/src/mesh/wifi/WiFiAPClient.cpp @@ -53,19 +53,15 @@ Periodic *wifiReconnect; static void onNetworkConnected() { - if (!APStartupComplete) - { + if (!APStartupComplete) { // Start web server LOG_INFO("Starting network services\n"); #ifdef ARCH_ESP32 // start mdns - if (!MDNS.begin("Meshtastic")) - { + if (!MDNS.begin("Meshtastic")) { LOG_ERROR("Error setting up MDNS responder!\n"); - } - else - { + } else { LOG_INFO("mDNS responder started\n"); LOG_INFO("mDNS Host: Meshtastic.local\n"); MDNS.addService("http", "tcp", 80); @@ -81,16 +77,14 @@ static void onNetworkConnected() timeClient.setUpdateInterval(60 * 60); // Update once an hour #endif - if (config.network.rsyslog_server[0]) - { + if (config.network.rsyslog_server[0]) { LOG_INFO("Starting Syslog client\n"); // Defaults int serverPort = 514; const char *serverAddr = config.network.rsyslog_server; String server = String(serverAddr); int delimIndex = server.indexOf(':'); - if (delimIndex > 0) - { + if (delimIndex > 0) { String port = server.substring(delimIndex + 1, server.length()); server[delimIndex] = 0; serverPort = port.toInt(); @@ -120,8 +114,7 @@ static int32_t reconnectWiFi() const char *wifiName = config.network.wifi_ssid; const char *wifiPsw = config.network.wifi_psk; - if (config.network.wifi_enabled && needReconnect) - { + if (config.network.wifi_enabled && needReconnect) { if (!*wifiPsw) // Treat empty password as no password wifiPsw = NULL; @@ -139,19 +132,16 @@ static int32_t reconnectWiFi() delay(5000); - if (!WiFi.isConnected()) - { + if (!WiFi.isConnected()) { WiFi.begin(wifiName, wifiPsw); } isReconnecting = false; } #ifndef DISABLE_NTP - if (WiFi.isConnected() && (((millis() - lastrun_ntp) > 43200000) || (lastrun_ntp == 0))) - { // every 12 hours + if (WiFi.isConnected() && (((millis() - lastrun_ntp) > 43200000) || (lastrun_ntp == 0))) { // every 12 hours LOG_DEBUG("Updating NTP time from %s\n", config.network.ntp_server); - if (timeClient.update()) - { + if (timeClient.update()) { LOG_DEBUG("NTP Request Success - Setting RTCQualityNTP if needed\n"); struct timeval tv; @@ -160,25 +150,20 @@ static int32_t reconnectWiFi() perhapsSetRTC(RTCQualityNTP, &tv); lastrun_ntp = millis(); - } - else - { + } else { LOG_DEBUG("NTP Update failed\n"); } } #endif - if (config.network.wifi_enabled && !WiFi.isConnected()) - { + if (config.network.wifi_enabled && !WiFi.isConnected()) { #ifdef ARCH_RP2040 // (ESP32 handles this in WiFiEvent) /* If APStartupComplete, but we're not connected, try again. Shouldn't try again before APStartupComplete. */ needReconnect = APStartupComplete; #endif return 1000; // check once per second - } - else - { + } else { #ifdef ARCH_RP2040 onNetworkConnected(); // will only do anything once #endif @@ -189,12 +174,9 @@ static int32_t reconnectWiFi() bool isWifiAvailable() { - if (config.network.wifi_enabled && (config.network.wifi_ssid[0])) - { + if (config.network.wifi_enabled && (config.network.wifi_ssid[0])) { return true; - } - else - { + } else { return false; } } @@ -204,8 +186,7 @@ void deinitWifi() { LOG_INFO("WiFi deinit\n"); - if (isWifiAvailable()) - { + if (isWifiAvailable()) { #ifdef ARCH_ESP32 WiFi.disconnect(true, false); #else @@ -220,8 +201,7 @@ void deinitWifi() // Startup WiFi bool initWifi() { - if (config.network.wifi_enabled && config.network.wifi_ssid[0]) - { + if (config.network.wifi_enabled && config.network.wifi_ssid[0]) { const char *wifiName = config.network.wifi_ssid; const char *wifiPsw = config.network.wifi_psk; @@ -235,8 +215,7 @@ bool initWifi() if (!*wifiPsw) // Treat empty password as no password wifiPsw = NULL; - if (*wifiName) - { + if (*wifiName) { uint8_t dmac[6]; getMacAddr(dmac); snprintf(ourHost, sizeof(ourHost), "Meshtastic-%02x%02x", dmac[4], dmac[5]); @@ -244,8 +223,7 @@ bool initWifi() WiFi.mode(WIFI_STA); WiFi.setHostname(ourHost); if (config.network.address_mode == meshtastic_Config_NetworkConfig_AddressMode_STATIC && - config.network.ipv4_config.ip != 0) - { + config.network.ipv4_config.ip != 0) { WiFi.config(config.network.ipv4_config.ip, config.network.ipv4_config.gateway, config.network.ipv4_config.subnet, config.network.ipv4_config.dns); } @@ -258,8 +236,7 @@ bool initWifi() esp_wifi_set_ps(WIFI_PS_NONE); // Disable radio power saving WiFi.onEvent( - [](WiFiEvent_t event, WiFiEventInfo_t info) - { + [](WiFiEvent_t event, WiFiEventInfo_t info) { LOG_WARN("WiFi lost connection. Reason: %d\n", info.wifi_sta_disconnected.reason); /* @@ -277,9 +254,7 @@ bool initWifi() wifiReconnect = new Periodic("WifiConnect", reconnectWiFi); } return true; - } - else - { + } else { LOG_INFO("Not using WIFI\n"); return false; } @@ -291,8 +266,7 @@ static void WiFiEvent(WiFiEvent_t event) { LOG_DEBUG("WiFi-Event %d: ", event); - switch (event) - { + switch (event) { case ARDUINO_EVENT_WIFI_READY: LOG_INFO("WiFi interface ready\n"); break; @@ -311,8 +285,7 @@ static void WiFiEvent(WiFiEvent_t event) break; case ARDUINO_EVENT_WIFI_STA_DISCONNECTED: LOG_INFO("Disconnected from WiFi access point\n"); - if (!isReconnecting) - { + if (!isReconnecting) { WiFi.disconnect(false, true); syslog.disable(); needReconnect = true; @@ -331,8 +304,7 @@ static void WiFiEvent(WiFiEvent_t event) break; case ARDUINO_EVENT_WIFI_STA_LOST_IP: LOG_INFO("Lost IP address and IP address is reset to 0\n"); - if (!isReconnecting) - { + if (!isReconnecting) { WiFi.disconnect(false, true); syslog.disable(); needReconnect = true; From 7e2f93737a19ea317ab42cbc81fcd4bab0439c7e Mon Sep 17 00:00:00 2001 From: Jim Whitelaw Date: Mon, 11 Mar 2024 22:56:23 -0600 Subject: [PATCH 05/11] Once more with feeling! Fix for regression. --- src/mesh/wifi/WiFiAPClient.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/mesh/wifi/WiFiAPClient.cpp b/src/mesh/wifi/WiFiAPClient.cpp index bf1e993f92..33aeea62dd 100644 --- a/src/mesh/wifi/WiFiAPClient.cpp +++ b/src/mesh/wifi/WiFiAPClient.cpp @@ -4,22 +4,17 @@ #include "concurrency/Periodic.h" #include "configuration.h" #include "main.h" -#if !MESHTASTIC_EXCLUDE_WEBSERVER #include "mesh/api/WiFiServerAPI.h" -#endif #include "mqtt/MQTT.h" #include "target_specific.h" #include #include -#ifdef ARCH_ESP32 -#if !MESHTASTIC_EXCLUDE_WEBSERVER +#if defined(ARCH_ESP32) && !MESHTASTIC_EXCLUDE_WEBSERVER #include "mesh/http/WebServer.h" #endif -#endif #include #include static void WiFiEvent(WiFiEvent_t event); -#endif #ifndef DISABLE_NTP #include From 5cd0168e927970c5349714ad5f1d4a50a50c188e Mon Sep 17 00:00:00 2001 From: Jim Whitelaw Date: Wed, 13 Mar 2024 22:05:39 -0600 Subject: [PATCH 06/11] Fix includes for ARCH_ESP32 --- src/mesh/wifi/WiFiAPClient.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mesh/wifi/WiFiAPClient.cpp b/src/mesh/wifi/WiFiAPClient.cpp index 33aeea62dd..88764d2be8 100644 --- a/src/mesh/wifi/WiFiAPClient.cpp +++ b/src/mesh/wifi/WiFiAPClient.cpp @@ -9,12 +9,14 @@ #include "target_specific.h" #include #include -#if defined(ARCH_ESP32) && !MESHTASTIC_EXCLUDE_WEBSERVER +#ifdef ARCH_ESP32 +#if !MESHTASTIC_EXCLUDE_WEBSERVER #include "mesh/http/WebServer.h" #endif #include #include static void WiFiEvent(WiFiEvent_t event); +#endif #ifndef DISABLE_NTP #include @@ -405,4 +407,4 @@ static void WiFiEvent(WiFiEvent_t event) uint8_t getWifiDisconnectReason() { return wifiDisconnectReason; -} \ No newline at end of file +} From 436e6317744576ca6b00559937ca76235b7cd66b Mon Sep 17 00:00:00 2001 From: Jim Whitelaw Date: Thu, 14 Mar 2024 10:26:07 -0600 Subject: [PATCH 07/11] Format changes from trunk --- .trunk/trunk.yaml | 12 +- .vscode/extensions.json | 7 +- bin/build-esp32.sh | 6 +- bin/build-nrf52.sh | 6 +- bin/build-rpi2040.sh | 6 +- bin/buildinfo.py | 4 +- bin/bump_version.py | 8 +- bin/device-update.sh | 48 +++--- bin/dump-ram-users.sh | 2 +- bin/gen-images.sh | 2 +- bin/genpartitions.py | 10 +- bin/platformio-custom.py | 30 ++-- bin/promote-release.sh | 4 +- bin/readprops.py | 35 ++-- bin/test-simulator.sh | 1 - bin/uf2conv.py | 223 ++++++++++++++++--------- images/compass.png | Bin 845 -> 594 bytes images/face-24px.svg | 2 +- images/face.png | Bin 329 -> 225 bytes images/location_searching-24px.svg | 2 +- images/pin.png | Bin 288 -> 203 bytes images/room-24px.svg | 2 +- images/textsms-24px.svg | 2 +- monitor/filter_c3_exception_decoder.py | 21 +-- src/GPSStatus.h | 15 +- src/mesh/SX128xInterface.cpp | 6 +- src/mesh/compression/unishox2.h | 4 +- variants/trackerd/variant.h | 6 +- 28 files changed, 267 insertions(+), 197 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 0826b71d9d..f102c779de 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -1,6 +1,6 @@ version: 0.1 cli: - version: 1.20.1 + version: 1.21.0 plugins: sources: - id: trunk @@ -8,15 +8,15 @@ plugins: uri: https://github.com/trunk-io/plugins lint: enabled: - - trufflehog@3.68.5 + - trufflehog@3.69.0 - yamllint@1.35.1 - - bandit@1.7.7 - - checkov@3.2.32 + - bandit@1.7.8 + - checkov@3.2.38 - terrascan@1.19.1 - trivy@0.49.1 #- trufflehog@3.63.2-rc0 - taplo@0.8.1 - - ruff@0.3.1 + - ruff@0.3.2 - isort@5.13.2 - markdownlint@0.39.0 - oxipng@9.0.0 @@ -25,7 +25,7 @@ lint: - flake8@7.0.0 - hadolint@2.12.0 - shfmt@3.6.0 - - shellcheck@0.9.0 + - shellcheck@0.10.0 - black@24.2.0 - git-diff-check - gitleaks@8.18.2 diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 4fc84fa780..080e70d08b 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -2,8 +2,9 @@ // See http://go.microsoft.com/fwlink/?LinkId=827846 // for the documentation about the extensions.json format "recommendations": [ - "ms-vscode.cpptools", - "platformio.platformio-ide", - "trunk.io" + "platformio.platformio-ide" ], + "unwantedRecommendations": [ + "ms-vscode.cpptools-extension-pack" + ] } diff --git a/bin/build-esp32.sh b/bin/build-esp32.sh index f60331ed52..b79cbacf0e 100755 --- a/bin/build-esp32.sh +++ b/bin/build-esp32.sh @@ -2,8 +2,8 @@ set -e -VERSION=`bin/buildinfo.py long` -SHORT_VERSION=`bin/buildinfo.py short` +VERSION=$(bin/buildinfo.py long) +SHORT_VERSION=$(bin/buildinfo.py short) OUTDIR=release/ @@ -11,7 +11,7 @@ rm -f $OUTDIR/firmware* rm -r $OUTDIR/* || true # Important to pull latest version of libs into all device flavors, otherwise some devices might be stale -platformio pkg update +platformio pkg update echo "Building for $1 with $PLATFORMIO_BUILD_FLAGS" rm -f .pio/build/$1/firmware.* diff --git a/bin/build-nrf52.sh b/bin/build-nrf52.sh index a9980f486b..c3a59dcbe5 100755 --- a/bin/build-nrf52.sh +++ b/bin/build-nrf52.sh @@ -2,8 +2,8 @@ set -e -VERSION=`bin/buildinfo.py long` -SHORT_VERSION=`bin/buildinfo.py short` +VERSION=$(bin/buildinfo.py long) +SHORT_VERSION=$(bin/buildinfo.py short) OUTDIR=release/ @@ -11,7 +11,7 @@ rm -f $OUTDIR/firmware* rm -r $OUTDIR/* || true # Important to pull latest version of libs into all device flavors, otherwise some devices might be stale -platformio pkg update +platformio pkg update echo "Building for $1 with $PLATFORMIO_BUILD_FLAGS" rm -f .pio/build/$1/firmware.* diff --git a/bin/build-rpi2040.sh b/bin/build-rpi2040.sh index fe0725085a..8eebfc8f13 100755 --- a/bin/build-rpi2040.sh +++ b/bin/build-rpi2040.sh @@ -2,8 +2,8 @@ set -e -VERSION=`bin/buildinfo.py long` -SHORT_VERSION=`bin/buildinfo.py short` +VERSION=$(bin/buildinfo.py long) +SHORT_VERSION=$(bin/buildinfo.py short) OUTDIR=release/ @@ -11,7 +11,7 @@ rm -f $OUTDIR/firmware* rm -r $OUTDIR/* || true # Important to pull latest version of libs into all device flavors, otherwise some devices might be stale -platformio pkg update +platformio pkg update echo "Building for $1 with $PLATFORMIO_BUILD_FLAGS" rm -f .pio/build/$1/firmware.* diff --git a/bin/buildinfo.py b/bin/buildinfo.py index 6b123c9cf4..2036970ea6 100755 --- a/bin/buildinfo.py +++ b/bin/buildinfo.py @@ -1,9 +1,9 @@ #!/usr/bin/env python3 import configparser import sys -from readprops import readProps +from readprops import readProps -verObj = readProps('version.properties') +verObj = readProps("version.properties") propName = sys.argv[1] print(f"{verObj[propName]}") diff --git a/bin/bump_version.py b/bin/bump_version.py index 6128fad945..43ed452d55 100755 --- a/bin/bump_version.py +++ b/bin/bump_version.py @@ -3,14 +3,14 @@ lines = None -with open('version.properties', 'r', encoding='utf-8') as f: +with open("version.properties", "r", encoding="utf-8") as f: lines = f.readlines() -with open('version.properties', 'w', encoding='utf-8') as f: +with open("version.properties", "w", encoding="utf-8") as f: for line in lines: if line.lstrip().startswith("build = "): words = line.split(" = ") - ver = f'build = {int(words[1]) + 1}' - f.write(f'{ver}\n') + ver = f"build = {int(words[1]) + 1}" + f.write(f"{ver}\n") else: f.write(line) diff --git a/bin/device-update.sh b/bin/device-update.sh index 7233f61f6e..6640741c02 100755 --- a/bin/device-update.sh +++ b/bin/device-update.sh @@ -1,10 +1,10 @@ #!/bin/sh -PYTHON=${PYTHON:-$(which python3 python|head -n 1)} +PYTHON=${PYTHON:-$(which python3 python | head -n 1)} # Usage info show_help() { -cat << EOF + cat <&2 - exit 1 - ;; - esac + case "${opt}" in + h) + show_help + exit 0 + ;; + p) + export ESPTOOL_PORT=${OPTARG} + ;; + P) + PYTHON=${OPTARG} + ;; + f) + FILENAME=${OPTARG} + ;; + *) + echo "Invalid flag." + show_help >&2 + exit 1 + ;; + esac done -shift "$((OPTIND-1))" +shift "$((OPTIND - 1))" [ -z "$FILENAME" -a -n "$1" ] && { - FILENAME=$1 - shift + FILENAME=$1 + shift } if [ -f "${FILENAME}" ] && [ -z "${FILENAME##*"update"*}" ]; then diff --git a/bin/dump-ram-users.sh b/bin/dump-ram-users.sh index 3cc3ce5dca..1fc5ebe45f 100755 --- a/bin/dump-ram-users.sh +++ b/bin/dump-ram-users.sh @@ -2,4 +2,4 @@ arm-none-eabi-readelf -s -e .pio/build/nrf52dk/firmware.elf | head -80 -nm -CSr --size-sort .pio/build/nrf52dk/firmware.elf | grep '^200' +nm -CSr --size-sort .pio/build/nrf52dk/firmware.elf | grep '^200' diff --git a/bin/gen-images.sh b/bin/gen-images.sh index 0c10fddb84..b6a4b2fe08 100755 --- a/bin/gen-images.sh +++ b/bin/gen-images.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -set -e +set -e # regen the design bins first cd design diff --git a/bin/genpartitions.py b/bin/genpartitions.py index 2e1a9f1de1..930fdc4528 100755 --- a/bin/genpartitions.py +++ b/bin/genpartitions.py @@ -10,7 +10,9 @@ start = 0x9000 nvssys = 0x3000 -nvsuser = 0x2000 # NOTE: ti seems total size of nvssys MUST be 0x5000 or device will bootloop +nvsuser = ( + 0x2000 # NOTE: ti seems total size of nvssys MUST be 0x5000 or device will bootloop +) nvs = nvssys + nvsuser ota = 0x2000 # app = 0x1c0000 @@ -18,7 +20,7 @@ # treat sys part sizes + spiffs size as reserved, then calculate what appsize can be reserved = start + nvs + ota + spi -maxsize = 0x400000 # 4MB +maxsize = 0x400000 # 4MB app = (maxsize - reserved) / 2 @@ -36,6 +38,8 @@ otadata, data, ota, , 0x{ota:x}, app0, app, ota_0, , 0x{app:x}, app1, app, ota_1, , 0x{app:x}, -spiffs, data, spiffs, , 0x{spi:x} """.format(**locals()) +spiffs, data, spiffs, , 0x{spi:x} """.format( + **locals() +) print(table) diff --git a/bin/platformio-custom.py b/bin/platformio-custom.py index e03a35e3a3..5b0da4ba58 100644 --- a/bin/platformio-custom.py +++ b/bin/platformio-custom.py @@ -1,13 +1,15 @@ -import subprocess import configparser -import traceback +import subprocess import sys +import traceback from os.path import join + from readprops import readProps Import("env") platform = env.PioPlatform() + def esp32_create_combined_bin(source, target, env): # this sub is borrowed from ESPEasy build toolchain. It's licensed under GPL V3 # https://github.com/letscontrolit/ESPEasy/blob/mega/tools/pio/post_esp32.py @@ -20,8 +22,8 @@ def esp32_create_combined_bin(source, target, env): firmware_name = env.subst("$BUILD_DIR/${PROGNAME}.bin") chip = env.get("BOARD_MCU") flash_size = env.BoardConfig().get("upload.flash_size") - flash_freq = env.BoardConfig().get("build.f_flash", '40m') - flash_freq = flash_freq.replace('000000L', 'm') + flash_freq = env.BoardConfig().get("build.f_flash", "40m") + flash_freq = flash_freq.replace("000000L", "m") flash_mode = env.BoardConfig().get("build.flash_mode", "dio") memory_type = env.BoardConfig().get("build.arduino.memory_type", "qio_qspi") if flash_mode == "qio" or flash_mode == "qout": @@ -51,23 +53,27 @@ def esp32_create_combined_bin(source, target, env): print(f" - {hex(app_offset)} | {firmware_name}") cmd += [hex(app_offset), firmware_name] - print('Using esptool.py arguments: %s' % ' '.join(cmd)) + print("Using esptool.py arguments: %s" % " ".join(cmd)) esptool.main(cmd) -if (platform.name == "espressif32"): + +if platform.name == "espressif32": sys.path.append(join(platform.get_package_dir("tool-esptoolpy"))) import esptool - env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", esp32_create_combined_bin) + + env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", esp32_create_combined_bin) Import("projenv") prefsLoc = projenv["PROJECT_DIR"] + "/version.properties" verObj = readProps(prefsLoc) -print("Using meshtastic platformio-custom.py, firmware version " + verObj['long']) +print("Using meshtastic platformio-custom.py, firmware version " + verObj["long"]) # General options that are passed to the C and C++ compilers -projenv.Append(CCFLAGS=[ - "-DAPP_VERSION=" + verObj['long'], - "-DAPP_VERSION_SHORT=" + verObj['short'] -]) +projenv.Append( + CCFLAGS=[ + "-DAPP_VERSION=" + verObj["long"], + "-DAPP_VERSION_SHORT=" + verObj["short"], + ] +) diff --git a/bin/promote-release.sh b/bin/promote-release.sh index f96d2a568b..9edafd83ce 100755 --- a/bin/promote-release.sh +++ b/bin/promote-release.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash -set -e +set -e echo "This script is only for developers who are publishing new builds on github. Most users don't need it" -VERSION=`bin/buildinfo.py long` +VERSION=$(bin/buildinfo.py long) # Must have a V prefix to trigger github git tag "v${VERSION}" diff --git a/bin/readprops.py b/bin/readprops.py index ffa3615416..db8c8c0116 100644 --- a/bin/readprops.py +++ b/bin/readprops.py @@ -1,9 +1,7 @@ - - -import subprocess import configparser -import traceback +import subprocess import sys +import traceback def readProps(prefsLoc): @@ -11,27 +9,36 @@ def readProps(prefsLoc): config = configparser.RawConfigParser() config.read(prefsLoc) - version = dict(config.items('VERSION')) - verObj = dict(short = "{}.{}.{}".format(version["major"], version["minor"], version["build"]), - long = "unset") + version = dict(config.items("VERSION")) + verObj = dict( + short="{}.{}.{}".format(version["major"], version["minor"], version["build"]), + long="unset", + ) # Try to find current build SHA if if the workspace is clean. This could fail if git is not installed try: - sha = subprocess.check_output( - ['git', 'rev-parse', '--short', 'HEAD']).decode("utf-8").strip() - isDirty = subprocess.check_output( - ['git', 'diff', 'HEAD']).decode("utf-8").strip() + sha = ( + subprocess.check_output(["git", "rev-parse", "--short", "HEAD"]) + .decode("utf-8") + .strip() + ) + isDirty = ( + subprocess.check_output(["git", "diff", "HEAD"]).decode("utf-8").strip() + ) suffix = sha # if isDirty: # # short for 'dirty', we want to keep our verstrings source for protobuf reasons # suffix = sha + "-d" - verObj['long'] = "{}.{}.{}.{}".format( - version["major"], version["minor"], version["build"], suffix) + verObj["long"] = "{}.{}.{}.{}".format( + version["major"], version["minor"], version["build"], suffix + ) except: # print("Unexpected error:", sys.exc_info()[0]) # traceback.print_exc() - verObj['long'] = verObj['short'] + verObj["long"] = verObj["short"] # print("firmware version " + verStr) return verObj + + # print("path is" + ','.join(sys.path)) diff --git a/bin/test-simulator.sh b/bin/test-simulator.sh index 3c5f8f811a..132f621a95 100755 --- a/bin/test-simulator.sh +++ b/bin/test-simulator.sh @@ -8,4 +8,3 @@ sleep 20 # 5 seconds was not enough echo "Simulator started, launching python test..." python3 -c 'from meshtastic.test import testSimulator; testSimulator()' - diff --git a/bin/uf2conv.py b/bin/uf2conv.py index b619d14db0..b0fa8a3138 100755 --- a/bin/uf2conv.py +++ b/bin/uf2conv.py @@ -1,39 +1,38 @@ #!/usr/bin/env python3 -import sys -import struct -import subprocess -import re +import argparse import os import os.path -import argparse - +import re +import struct +import subprocess +import sys -UF2_MAGIC_START0 = 0x0A324655 # "UF2\n" -UF2_MAGIC_START1 = 0x9E5D5157 # Randomly selected -UF2_MAGIC_END = 0x0AB16F30 # Ditto +UF2_MAGIC_START0 = 0x0A324655 # "UF2\n" +UF2_MAGIC_START1 = 0x9E5D5157 # Randomly selected +UF2_MAGIC_END = 0x0AB16F30 # Ditto families = { - 'SAMD21': 0x68ed2b88, - 'SAML21': 0x1851780a, - 'SAMD51': 0x55114460, - 'NRF52': 0x1b57745f, - 'STM32F0': 0x647824b6, - 'STM32F1': 0x5ee21072, - 'STM32F2': 0x5d1a0a2e, - 'STM32F3': 0x6b846188, - 'STM32F4': 0x57755a57, - 'STM32F7': 0x53b80f00, - 'STM32G0': 0x300f5633, - 'STM32G4': 0x4c71240a, - 'STM32H7': 0x6db66082, - 'STM32L0': 0x202e3a91, - 'STM32L1': 0x1e1f432d, - 'STM32L4': 0x00ff6919, - 'STM32L5': 0x04240bdf, - 'STM32WB': 0x70d16653, - 'STM32WL': 0x21460ff0, - 'ATMEGA32': 0x16573617, - 'MIMXRT10XX': 0x4FB2D5BD + "SAMD21": 0x68ED2B88, + "SAML21": 0x1851780A, + "SAMD51": 0x55114460, + "NRF52": 0x1B57745F, + "STM32F0": 0x647824B6, + "STM32F1": 0x5EE21072, + "STM32F2": 0x5D1A0A2E, + "STM32F3": 0x6B846188, + "STM32F4": 0x57755A57, + "STM32F7": 0x53B80F00, + "STM32G0": 0x300F5633, + "STM32G4": 0x4C71240A, + "STM32H7": 0x6DB66082, + "STM32L0": 0x202E3A91, + "STM32L1": 0x1E1F432D, + "STM32L4": 0x00FF6919, + "STM32L5": 0x04240BDF, + "STM32WB": 0x70D16653, + "STM32WL": 0x21460FF0, + "ATMEGA32": 0x16573617, + "MIMXRT10XX": 0x4FB2D5BD, } INFO_FILE = "/INFO_UF2.TXT" @@ -46,15 +45,17 @@ def is_uf2(buf): w = struct.unpack(" 10*1024*1024: + if padding > 10 * 1024 * 1024: assert False, "More than 10M of padding needed at " + ptr if padding % 4 != 0: assert False, "Non-word padding size at " + ptr @@ -91,6 +92,7 @@ def convert_from_uf2(buf): curraddr = newaddr + datalen return outp + def convert_to_carray(file_content): outp = "const unsigned char bindata[] __attribute__((aligned(16))) = {" for i in range(len(file_content)): @@ -100,6 +102,7 @@ def convert_to_carray(file_content): outp += "\n};\n" return outp + def convert_to_uf2(file_content): global familyid datapadding = b"" @@ -109,13 +112,21 @@ def convert_to_uf2(file_content): outp = b"" for blockno in range(numblocks): ptr = 256 * blockno - chunk = file_content[ptr:ptr + 256] + chunk = file_content[ptr : ptr + 256] flags = 0x0 if familyid: flags |= 0x2000 - hd = struct.pack(b"= 3 and words[1] == "2" and words[2] == "FAT": drives.append(words[0]) else: @@ -206,7 +238,6 @@ def get_drives(): for d in os.listdir(rootpath): drives.append(os.path.join(rootpath, d)) - def has_info(d): try: return os.path.isfile(d + INFO_FILE) @@ -217,7 +248,7 @@ def has_info(d): def board_id(path): - with open(path + INFO_FILE, mode='r') as file: + with open(path + INFO_FILE, mode="r") as file: file_content = file.read() return re.search("Board-ID: ([^\r\n]*)", file_content).group(1) @@ -235,30 +266,61 @@ def write_file(name, buf): def main(): global appstartaddr, familyid + def error(msg): print(msg) sys.exit(1) - parser = argparse.ArgumentParser(description='Convert to UF2 or flash directly.') - parser.add_argument('input', metavar='INPUT', type=str, nargs='?', - help='input file (HEX, BIN or UF2)') - parser.add_argument('-b' , '--base', dest='base', type=str, - default="0x2000", - help='set base address of application for BIN format (default: 0x2000)') - parser.add_argument('-o' , '--output', metavar="FILE", dest='output', type=str, - help='write output to named file; defaults to "flash.uf2" or "flash.bin" where sensible') - parser.add_argument('-d' , '--device', dest="device_path", - help='select a device path to flash') - parser.add_argument('-l' , '--list', action='store_true', - help='list connected devices') - parser.add_argument('-c' , '--convert', action='store_true', - help='do not flash, just convert') - parser.add_argument('-D' , '--deploy', action='store_true', - help='just flash, do not convert') - parser.add_argument('-f' , '--family', dest='family', type=str, - default="0x0", - help='specify familyID - number or name (default: 0x0)') - parser.add_argument('-C' , '--carray', action='store_true', - help='convert binary file to a C array, not UF2') + + parser = argparse.ArgumentParser(description="Convert to UF2 or flash directly.") + parser.add_argument( + "input", + metavar="INPUT", + type=str, + nargs="?", + help="input file (HEX, BIN or UF2)", + ) + parser.add_argument( + "-b", + "--base", + dest="base", + type=str, + default="0x2000", + help="set base address of application for BIN format (default: 0x2000)", + ) + parser.add_argument( + "-o", + "--output", + metavar="FILE", + dest="output", + type=str, + help='write output to named file; defaults to "flash.uf2" or "flash.bin" where sensible', + ) + parser.add_argument( + "-d", "--device", dest="device_path", help="select a device path to flash" + ) + parser.add_argument( + "-l", "--list", action="store_true", help="list connected devices" + ) + parser.add_argument( + "-c", "--convert", action="store_true", help="do not flash, just convert" + ) + parser.add_argument( + "-D", "--deploy", action="store_true", help="just flash, do not convert" + ) + parser.add_argument( + "-f", + "--family", + dest="family", + type=str, + default="0x0", + help="specify familyID - number or name (default: 0x0)", + ) + parser.add_argument( + "-C", + "--carray", + action="store_true", + help="convert binary file to a C array, not UF2", + ) args = parser.parse_args() appstartaddr = int(args.base, 0) @@ -268,14 +330,17 @@ def error(msg): try: familyid = int(args.family, 0) except ValueError: - error("Family ID needs to be a number or one of: " + ", ".join(families.keys())) + error( + "Family ID needs to be a number or one of: " + + ", ".join(families.keys()) + ) if args.list: list_drives() else: if not args.input: error("Need input file") - with open(args.input, mode='rb') as f: + with open(args.input, mode="rb") as f: inpbuf = f.read() from_uf2 = is_uf2(inpbuf) ext = "uf2" @@ -291,8 +356,10 @@ def error(msg): ext = "h" else: outbuf = convert_to_uf2(inpbuf) - print("Converting to %s, output size: %d, start address: 0x%x" % - (ext, len(outbuf), appstartaddr)) + print( + "Converting to %s, output size: %d, start address: 0x%x" + % (ext, len(outbuf), appstartaddr) + ) if args.convert or ext != "uf2": drives = [] if args.output == None: diff --git a/images/compass.png b/images/compass.png index 8639dde5241d720e47e97d63280ec8073928c2b4..c4e5b589bc42cd7b05148dbbdee01ce0fe689548 100644 GIT binary patch delta 561 zcmV-10?z%-2GRtO83+Ub008|9F$|G07k>f-NklyvaQ|Snd!k0 z`OI;De`Ye9Uv~M=M1R(0gMZLqh6X-u)u4?}gX=K75ti8{AR4f`yk!Xo>{a+clz*{~ zS-?t;4MHM~72@M!Xo7>D5=T6yMwv0j@Tjp$r>9Aaf?4_RvEr{NF-VEc*cngsTjXN9 zKczyNS{PNkjF4(sU2O#u zRdw#WqqAXKWlx_6mt!NXR2>tYyBeY9QCJ zQCGwKFHzsRiH&l9o#Y02Y~=MDT*1aw{RSm$c>Q&fFZs?;mwZSfUqV)~@l>*(k*J|Y zmW{8HeV;@#bY)bOt#9BLQ>56HuuV+8k<4vUEva!mi-~zPt`|w=@KFNKxqpVPB0nVS z2!{-FYA^e^=*aP2G6HU+!6%Y+K#?qys(i#cT3lKx<%}w6<~difdyJx~z==u=*`mxK z9i+&9KCP@vWKiMvJ}k34xi>OA2~&+|RTG33(J{P+!6XA~>9XlIu1FbDP=?y*BR z;Rj@!MI0F3G%GY?r#a*~4<4AhKtF+(4KB3b>M76a97!*<00000NkvXXu0mjfa`FP& delta 814 zcmV+}1JV4_1kDDJ85jlt00374`G)`i00eVFNmK|32nc)#WQdU=7k>a5bVXQnQ*UN; zcVTj60C#tHE@^ISb7Ns}WiD@WXPfRk8UO$S%1J~)RA_# zlVG9=+yX8ERp5{xHUHjipp{U_HZYT?`L8j?9|8**v=)F3qJMjFj~t4aCi=;L!@LW& zoCWqHbhl9+PU|sA$_m;QU?)QVzJfMjW(e8U+E1uRxQDyIqN{KL_$Y*b0JE;b5tK1Q zGMKA{`PNvoDg-^;#{4iA3HSCj7r~c8?17`fG&~YHpW6x@XK;Dok!`B9rN&?{bbvV< zp_>doiBC!f(|^zwxo^ZZOj=0E73EWRU#XF~>TwN|3OFgQ-&@?49B(<+B1st_7V#~3#4TA+tiP#lwt>$7&WC0Dr z{($5jXp8F$D%R3*QCv6U8fGcrs9sJi(|MUBDP<_{U(3CX4q z+fXn#j3*-JGZ(QHA?9JWfqAh+csaf7B3J-E2*IDg5ht6`RDkayR}+PUuXBW-$_~0) z%4y)O$k7GPXeC$^;yuhBwxXatOW1r5xTm1~k0NFxFO%%!w((xV3`wcGh3>&KU=Ex1 zB9eKSZGT{vDYgbYCi-CO3vgJ?wP1$mp6Ev#xC31FO_uzq`So0&Q1-? s({2H;f!`WQC;t \ No newline at end of file + \ No newline at end of file diff --git a/images/face.png b/images/face.png index 036e29f7349217607c53f48aed28e99484a3e648..eb6b91e13b89f3a0d27efbaf83e35f2c1f70b3c5 100644 GIT binary patch delta 188 zcmV;t07L)D0^tFW83+Ub007wHEccNy7=M#VL_t(|+J(?P4gpaVhT*4BON@<(8woX? zLS_XDt%M~QvlYFcZ7@+#}B!d5~QJk`Ieg!u6Zu6ANf zfL!gRuO;*HjTun5835X*7IGKhu7|lHM&<}gpfJPQ7!xa`&cN2*zmpA+s4PV*4=Ejh qpmLB3Qb!McqD1DRbhgoH-0ltI05a+a8KhYN0000MzCV_|S*E^l&Yo9;Xs0002SNkl|LzC>pdL!hvB*6^ z(FP3ghR+|)I{B>%HGlAmX$!bfu}tCvee7YJxCxG7C(s-nTw~VwY#*06!YQtBUMH70 zi@(7|{4jAn^8$AB@Q#!CLv-W2IEX*a+~1nu!S8y;ee \ No newline at end of file + \ No newline at end of file diff --git a/images/pin.png b/images/pin.png index 112a7ce8ed6a7537c73dc2626d2f6cab93d87fbc..3c91a726c3cf3c5605e1580a89e35f84850da2f6 100644 GIT binary patch delta 166 zcmV;X09pT_0?PrA83+Ub007wHEccNy7=L|9L_t(|+KtdL4#5BzhT&&nDRCHfEL=e( zB;q9E1TG-%!VTP@Sj56g`b(r~qv_D+8{h5I#MH^f(L}{sCVtDTDD}LA)J`fqbrr@! z7-A%Zk-|U-3oM1uS7>_(Z)YFju0?4pif#PqxaHw0Q8CZcOpSxES1YlXGMzCV_|S*E^l&Yo9;Xs0001;Nkl# BWEB7a diff --git a/images/room-24px.svg b/images/room-24px.svg index 79a4807e7c..48e55ab80e 100644 --- a/images/room-24px.svg +++ b/images/room-24px.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/images/textsms-24px.svg b/images/textsms-24px.svg index 4455f047e3..84c4fdcc1d 100644 --- a/images/textsms-24px.svg +++ b/images/textsms-24px.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/monitor/filter_c3_exception_decoder.py b/monitor/filter_c3_exception_decoder.py index e59b0be2a4..6d7b5370c2 100644 --- a/monitor/filter_c3_exception_decoder.py +++ b/monitor/filter_c3_exception_decoder.py @@ -18,10 +18,7 @@ import sys from platformio.project.exception import PlatformioException -from platformio.public import ( - DeviceMonitorFilterBase, - load_build_metadata, -) +from platformio.public import DeviceMonitorFilterBase, load_build_metadata # By design, __init__ is called inside miniterm and we can't pass context to it. # pylint: disable=attribute-defined-outside-init @@ -32,7 +29,7 @@ class Esp32C3ExceptionDecoder(DeviceMonitorFilterBase): NAME = "esp32_c3_exception_decoder" - PCADDR_PATTERN = re.compile(r'0x4[0-9a-f]{7}', re.IGNORECASE) + PCADDR_PATTERN = re.compile(r"0x4[0-9a-f]{7}", re.IGNORECASE) def __call__(self): self.buffer = "" @@ -75,14 +72,14 @@ def setup_paths(self): % self.__class__.__name__ ) return False - + if not os.path.isfile(self.addr2line_path): sys.stderr.write( "%s: disabling, addr2line at %s does not exist\n" % (self.__class__.__name__, self.addr2line_path) ) return False - + return True except PlatformioException as e: sys.stderr.write( @@ -117,7 +114,7 @@ def rx(self, text): trace = self.get_backtrace(m) if len(trace) != "": - text = text[: last] + trace + text[last :] + text = text[:last] + trace + text[last:] last += len(trace) return text @@ -125,14 +122,10 @@ def rx(self, text): def get_backtrace(self, match): trace = "\n" enc = "mbcs" if IS_WINDOWS else "utf-8" - args = [self.addr2line_path, u"-fipC", u"-e", self.firmware_path] + args = [self.addr2line_path, "-fipC", "-e", self.firmware_path] try: addr = match.group() - output = ( - subprocess.check_output(args + [addr]) - .decode(enc) - .strip() - ) + output = subprocess.check_output(args + [addr]).decode(enc).strip() output = output.replace( "\n", "\n " ) # newlines happen with inlined methods diff --git a/src/GPSStatus.h b/src/GPSStatus.h index bcfb5f2eb5..81d348c2b6 100644 --- a/src/GPSStatus.h +++ b/src/GPSStatus.h @@ -88,20 +88,11 @@ class GPSStatus : public Status } } - uint32_t getDOP() const - { - return p.PDOP; - } + uint32_t getDOP() const { return p.PDOP; } - uint32_t getHeading() const - { - return p.ground_track; - } + uint32_t getHeading() const { return p.ground_track; } - uint32_t getNumSatellites() const - { - return p.sats_in_view; - } + uint32_t getNumSatellites() const { return p.sats_in_view; } bool matches(const GPSStatus *newStatus) const { diff --git a/src/mesh/SX128xInterface.cpp b/src/mesh/SX128xInterface.cpp index d0103ec291..00894536bc 100644 --- a/src/mesh/SX128xInterface.cpp +++ b/src/mesh/SX128xInterface.cpp @@ -251,9 +251,9 @@ template void SX128xInterface::startReceive() #endif // We use the PREAMBLE_DETECTED and HEADER_VALID IRQ flag to detect whether we are actively receiving - int err = lora.startReceive(RADIOLIB_SX128X_RX_TIMEOUT_INF, RADIOLIB_SX128X_IRQ_RX_DEFAULT | - RADIOLIB_SX128X_IRQ_PREAMBLE_DETECTED | - RADIOLIB_SX128X_IRQ_HEADER_VALID); + int err = + lora.startReceive(RADIOLIB_SX128X_RX_TIMEOUT_INF, RADIOLIB_SX128X_IRQ_RX_DEFAULT | RADIOLIB_SX128X_IRQ_PREAMBLE_DETECTED | + RADIOLIB_SX128X_IRQ_HEADER_VALID); assert(err == RADIOLIB_ERR_NONE); diff --git a/src/mesh/compression/unishox2.h b/src/mesh/compression/unishox2.h index a5117a5de0..e051375688 100644 --- a/src/mesh/compression/unishox2.h +++ b/src/mesh/compression/unishox2.h @@ -156,8 +156,8 @@ 3, 1, 3, 3, 3 \ } -//#define USX_HCODES_FAVOR_UMLAUT {0x00, 0x40, 0xE0, 0xC0, 0x80} -//#define USX_HCODE_LENS_FAVOR_UMLAUT {2, 2, 3, 3, 2} +// #define USX_HCODES_FAVOR_UMLAUT {0x00, 0x40, 0xE0, 0xC0, 0x80} +// #define USX_HCODE_LENS_FAVOR_UMLAUT {2, 2, 3, 3, 2} /// Horizontal codes preset favouring umlaut letters #define USX_HCODES_FAVOR_UMLAUT \ diff --git a/variants/trackerd/variant.h b/variants/trackerd/variant.h index b3fca367f0..09dcd422ce 100644 --- a/variants/trackerd/variant.h +++ b/variants/trackerd/variant.h @@ -10,7 +10,7 @@ #define LED_PIN 13 // 13 red, 2 blue, 15 red -//#define HAS_BUTTON 0 +// #define HAS_BUTTON 0 #define BUTTON_PIN 0 #define BUTTON_NEED_PULLUP @@ -42,5 +42,5 @@ #define ADC_MULTIPLIER VBAT_DIVIDER_COMP #define VBAT_RAW_TO_SCALED(x) (REAL_VBAT_MV_PER_LSB * x) -//#define BATTERY_SENSE_SAMPLES 15 // Set the number of samples, It has an effect of increasing sensitivity. -//#define ADC_MULTIPLIER 3.3 \ No newline at end of file +// #define BATTERY_SENSE_SAMPLES 15 // Set the number of samples, It has an effect of increasing sensitivity. +// #define ADC_MULTIPLIER 3.3 \ No newline at end of file From f450aa8b192772001a3e6a290c655623c1c8a08c Mon Sep 17 00:00:00 2001 From: Jim Whitelaw Date: Thu, 14 Mar 2024 10:45:11 -0600 Subject: [PATCH 08/11] Merge updates from origin --- .vscode/extensions.json | 5 ++++- protobufs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 4fc84fa780..b119eaa4c7 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -6,4 +6,7 @@ "platformio.platformio-ide", "trunk.io" ], -} + "unwantedRecommendations": [ + "ms-vscode.cpptools-extension-pack" + ] +} \ No newline at end of file diff --git a/protobufs b/protobufs index 7e3ee8cd96..00332412b2 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 7e3ee8cd96740910d0611433cb9a05a7a692568c +Subproject commit 00332412b238fe559175a6e83fdf8d31fa5e209a From 4d9a5b8c3e9ea34ae779ba0c5a52fae206de11dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Wed, 20 Mar 2024 12:25:35 +0100 Subject: [PATCH 09/11] Revert "Format changes from trunk" This reverts commit 436e6317744576ca6b00559937ca76235b7cd66b. --- .trunk/trunk.yaml | 12 +- .vscode/extensions.json | 6 +- bin/build-esp32.sh | 6 +- bin/build-nrf52.sh | 6 +- bin/build-rpi2040.sh | 6 +- bin/buildinfo.py | 4 +- bin/bump_version.py | 8 +- bin/device-update.sh | 48 +++--- bin/dump-ram-users.sh | 2 +- bin/gen-images.sh | 2 +- bin/genpartitions.py | 10 +- bin/platformio-custom.py | 30 ++-- bin/promote-release.sh | 4 +- bin/readprops.py | 35 ++-- bin/test-simulator.sh | 1 + bin/uf2conv.py | 223 +++++++++---------------- images/compass.png | Bin 594 -> 845 bytes images/face-24px.svg | 2 +- images/face.png | Bin 225 -> 329 bytes images/location_searching-24px.svg | 2 +- images/pin.png | Bin 203 -> 288 bytes images/room-24px.svg | 2 +- images/textsms-24px.svg | 2 +- monitor/filter_c3_exception_decoder.py | 21 ++- src/GPSStatus.h | 15 +- src/mesh/SX128xInterface.cpp | 6 +- src/mesh/compression/unishox2.h | 4 +- variants/trackerd/variant.h | 6 +- 28 files changed, 199 insertions(+), 264 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index f102c779de..0826b71d9d 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -1,6 +1,6 @@ version: 0.1 cli: - version: 1.21.0 + version: 1.20.1 plugins: sources: - id: trunk @@ -8,15 +8,15 @@ plugins: uri: https://github.com/trunk-io/plugins lint: enabled: - - trufflehog@3.69.0 + - trufflehog@3.68.5 - yamllint@1.35.1 - - bandit@1.7.8 - - checkov@3.2.38 + - bandit@1.7.7 + - checkov@3.2.32 - terrascan@1.19.1 - trivy@0.49.1 #- trufflehog@3.63.2-rc0 - taplo@0.8.1 - - ruff@0.3.2 + - ruff@0.3.1 - isort@5.13.2 - markdownlint@0.39.0 - oxipng@9.0.0 @@ -25,7 +25,7 @@ lint: - flake8@7.0.0 - hadolint@2.12.0 - shfmt@3.6.0 - - shellcheck@0.10.0 + - shellcheck@0.9.0 - black@24.2.0 - git-diff-check - gitleaks@8.18.2 diff --git a/.vscode/extensions.json b/.vscode/extensions.json index b119eaa4c7..5951c2dee7 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -6,7 +6,11 @@ "platformio.platformio-ide", "trunk.io" ], +<<<<<<< HEAD "unwantedRecommendations": [ "ms-vscode.cpptools-extension-pack" ] -} \ No newline at end of file +} +======= +} +>>>>>>> parent of 436e6317 (Format changes from trunk) diff --git a/bin/build-esp32.sh b/bin/build-esp32.sh index b79cbacf0e..f60331ed52 100755 --- a/bin/build-esp32.sh +++ b/bin/build-esp32.sh @@ -2,8 +2,8 @@ set -e -VERSION=$(bin/buildinfo.py long) -SHORT_VERSION=$(bin/buildinfo.py short) +VERSION=`bin/buildinfo.py long` +SHORT_VERSION=`bin/buildinfo.py short` OUTDIR=release/ @@ -11,7 +11,7 @@ rm -f $OUTDIR/firmware* rm -r $OUTDIR/* || true # Important to pull latest version of libs into all device flavors, otherwise some devices might be stale -platformio pkg update +platformio pkg update echo "Building for $1 with $PLATFORMIO_BUILD_FLAGS" rm -f .pio/build/$1/firmware.* diff --git a/bin/build-nrf52.sh b/bin/build-nrf52.sh index c3a59dcbe5..a9980f486b 100755 --- a/bin/build-nrf52.sh +++ b/bin/build-nrf52.sh @@ -2,8 +2,8 @@ set -e -VERSION=$(bin/buildinfo.py long) -SHORT_VERSION=$(bin/buildinfo.py short) +VERSION=`bin/buildinfo.py long` +SHORT_VERSION=`bin/buildinfo.py short` OUTDIR=release/ @@ -11,7 +11,7 @@ rm -f $OUTDIR/firmware* rm -r $OUTDIR/* || true # Important to pull latest version of libs into all device flavors, otherwise some devices might be stale -platformio pkg update +platformio pkg update echo "Building for $1 with $PLATFORMIO_BUILD_FLAGS" rm -f .pio/build/$1/firmware.* diff --git a/bin/build-rpi2040.sh b/bin/build-rpi2040.sh index 8eebfc8f13..fe0725085a 100755 --- a/bin/build-rpi2040.sh +++ b/bin/build-rpi2040.sh @@ -2,8 +2,8 @@ set -e -VERSION=$(bin/buildinfo.py long) -SHORT_VERSION=$(bin/buildinfo.py short) +VERSION=`bin/buildinfo.py long` +SHORT_VERSION=`bin/buildinfo.py short` OUTDIR=release/ @@ -11,7 +11,7 @@ rm -f $OUTDIR/firmware* rm -r $OUTDIR/* || true # Important to pull latest version of libs into all device flavors, otherwise some devices might be stale -platformio pkg update +platformio pkg update echo "Building for $1 with $PLATFORMIO_BUILD_FLAGS" rm -f .pio/build/$1/firmware.* diff --git a/bin/buildinfo.py b/bin/buildinfo.py index 2036970ea6..6b123c9cf4 100755 --- a/bin/buildinfo.py +++ b/bin/buildinfo.py @@ -1,9 +1,9 @@ #!/usr/bin/env python3 import configparser import sys - from readprops import readProps -verObj = readProps("version.properties") + +verObj = readProps('version.properties') propName = sys.argv[1] print(f"{verObj[propName]}") diff --git a/bin/bump_version.py b/bin/bump_version.py index 43ed452d55..6128fad945 100755 --- a/bin/bump_version.py +++ b/bin/bump_version.py @@ -3,14 +3,14 @@ lines = None -with open("version.properties", "r", encoding="utf-8") as f: +with open('version.properties', 'r', encoding='utf-8') as f: lines = f.readlines() -with open("version.properties", "w", encoding="utf-8") as f: +with open('version.properties', 'w', encoding='utf-8') as f: for line in lines: if line.lstrip().startswith("build = "): words = line.split(" = ") - ver = f"build = {int(words[1]) + 1}" - f.write(f"{ver}\n") + ver = f'build = {int(words[1]) + 1}' + f.write(f'{ver}\n') else: f.write(line) diff --git a/bin/device-update.sh b/bin/device-update.sh index 6640741c02..7233f61f6e 100755 --- a/bin/device-update.sh +++ b/bin/device-update.sh @@ -1,10 +1,10 @@ #!/bin/sh -PYTHON=${PYTHON:-$(which python3 python | head -n 1)} +PYTHON=${PYTHON:-$(which python3 python|head -n 1)} # Usage info show_help() { - cat <&2 - exit 1 - ;; - esac + case "${opt}" in + h) + show_help + exit 0 + ;; + p) export ESPTOOL_PORT=${OPTARG} + ;; + P) PYTHON=${OPTARG} + ;; + f) FILENAME=${OPTARG} + ;; + *) + echo "Invalid flag." + show_help >&2 + exit 1 + ;; + esac done -shift "$((OPTIND - 1))" +shift "$((OPTIND-1))" [ -z "$FILENAME" -a -n "$1" ] && { - FILENAME=$1 - shift + FILENAME=$1 + shift } if [ -f "${FILENAME}" ] && [ -z "${FILENAME##*"update"*}" ]; then diff --git a/bin/dump-ram-users.sh b/bin/dump-ram-users.sh index 1fc5ebe45f..3cc3ce5dca 100755 --- a/bin/dump-ram-users.sh +++ b/bin/dump-ram-users.sh @@ -2,4 +2,4 @@ arm-none-eabi-readelf -s -e .pio/build/nrf52dk/firmware.elf | head -80 -nm -CSr --size-sort .pio/build/nrf52dk/firmware.elf | grep '^200' +nm -CSr --size-sort .pio/build/nrf52dk/firmware.elf | grep '^200' diff --git a/bin/gen-images.sh b/bin/gen-images.sh index b6a4b2fe08..0c10fddb84 100755 --- a/bin/gen-images.sh +++ b/bin/gen-images.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -set -e +set -e # regen the design bins first cd design diff --git a/bin/genpartitions.py b/bin/genpartitions.py index 930fdc4528..2e1a9f1de1 100755 --- a/bin/genpartitions.py +++ b/bin/genpartitions.py @@ -10,9 +10,7 @@ start = 0x9000 nvssys = 0x3000 -nvsuser = ( - 0x2000 # NOTE: ti seems total size of nvssys MUST be 0x5000 or device will bootloop -) +nvsuser = 0x2000 # NOTE: ti seems total size of nvssys MUST be 0x5000 or device will bootloop nvs = nvssys + nvsuser ota = 0x2000 # app = 0x1c0000 @@ -20,7 +18,7 @@ # treat sys part sizes + spiffs size as reserved, then calculate what appsize can be reserved = start + nvs + ota + spi -maxsize = 0x400000 # 4MB +maxsize = 0x400000 # 4MB app = (maxsize - reserved) / 2 @@ -38,8 +36,6 @@ otadata, data, ota, , 0x{ota:x}, app0, app, ota_0, , 0x{app:x}, app1, app, ota_1, , 0x{app:x}, -spiffs, data, spiffs, , 0x{spi:x} """.format( - **locals() -) +spiffs, data, spiffs, , 0x{spi:x} """.format(**locals()) print(table) diff --git a/bin/platformio-custom.py b/bin/platformio-custom.py index 5b0da4ba58..e03a35e3a3 100644 --- a/bin/platformio-custom.py +++ b/bin/platformio-custom.py @@ -1,15 +1,13 @@ -import configparser import subprocess -import sys +import configparser import traceback +import sys from os.path import join - from readprops import readProps Import("env") platform = env.PioPlatform() - def esp32_create_combined_bin(source, target, env): # this sub is borrowed from ESPEasy build toolchain. It's licensed under GPL V3 # https://github.com/letscontrolit/ESPEasy/blob/mega/tools/pio/post_esp32.py @@ -22,8 +20,8 @@ def esp32_create_combined_bin(source, target, env): firmware_name = env.subst("$BUILD_DIR/${PROGNAME}.bin") chip = env.get("BOARD_MCU") flash_size = env.BoardConfig().get("upload.flash_size") - flash_freq = env.BoardConfig().get("build.f_flash", "40m") - flash_freq = flash_freq.replace("000000L", "m") + flash_freq = env.BoardConfig().get("build.f_flash", '40m') + flash_freq = flash_freq.replace('000000L', 'm') flash_mode = env.BoardConfig().get("build.flash_mode", "dio") memory_type = env.BoardConfig().get("build.arduino.memory_type", "qio_qspi") if flash_mode == "qio" or flash_mode == "qout": @@ -53,27 +51,23 @@ def esp32_create_combined_bin(source, target, env): print(f" - {hex(app_offset)} | {firmware_name}") cmd += [hex(app_offset), firmware_name] - print("Using esptool.py arguments: %s" % " ".join(cmd)) + print('Using esptool.py arguments: %s' % ' '.join(cmd)) esptool.main(cmd) - -if platform.name == "espressif32": +if (platform.name == "espressif32"): sys.path.append(join(platform.get_package_dir("tool-esptoolpy"))) import esptool - - env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", esp32_create_combined_bin) + env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", esp32_create_combined_bin) Import("projenv") prefsLoc = projenv["PROJECT_DIR"] + "/version.properties" verObj = readProps(prefsLoc) -print("Using meshtastic platformio-custom.py, firmware version " + verObj["long"]) +print("Using meshtastic platformio-custom.py, firmware version " + verObj['long']) # General options that are passed to the C and C++ compilers -projenv.Append( - CCFLAGS=[ - "-DAPP_VERSION=" + verObj["long"], - "-DAPP_VERSION_SHORT=" + verObj["short"], - ] -) +projenv.Append(CCFLAGS=[ + "-DAPP_VERSION=" + verObj['long'], + "-DAPP_VERSION_SHORT=" + verObj['short'] +]) diff --git a/bin/promote-release.sh b/bin/promote-release.sh index 9edafd83ce..f96d2a568b 100755 --- a/bin/promote-release.sh +++ b/bin/promote-release.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash -set -e +set -e echo "This script is only for developers who are publishing new builds on github. Most users don't need it" -VERSION=$(bin/buildinfo.py long) +VERSION=`bin/buildinfo.py long` # Must have a V prefix to trigger github git tag "v${VERSION}" diff --git a/bin/readprops.py b/bin/readprops.py index db8c8c0116..ffa3615416 100644 --- a/bin/readprops.py +++ b/bin/readprops.py @@ -1,7 +1,9 @@ -import configparser + + import subprocess -import sys +import configparser import traceback +import sys def readProps(prefsLoc): @@ -9,36 +11,27 @@ def readProps(prefsLoc): config = configparser.RawConfigParser() config.read(prefsLoc) - version = dict(config.items("VERSION")) - verObj = dict( - short="{}.{}.{}".format(version["major"], version["minor"], version["build"]), - long="unset", - ) + version = dict(config.items('VERSION')) + verObj = dict(short = "{}.{}.{}".format(version["major"], version["minor"], version["build"]), + long = "unset") # Try to find current build SHA if if the workspace is clean. This could fail if git is not installed try: - sha = ( - subprocess.check_output(["git", "rev-parse", "--short", "HEAD"]) - .decode("utf-8") - .strip() - ) - isDirty = ( - subprocess.check_output(["git", "diff", "HEAD"]).decode("utf-8").strip() - ) + sha = subprocess.check_output( + ['git', 'rev-parse', '--short', 'HEAD']).decode("utf-8").strip() + isDirty = subprocess.check_output( + ['git', 'diff', 'HEAD']).decode("utf-8").strip() suffix = sha # if isDirty: # # short for 'dirty', we want to keep our verstrings source for protobuf reasons # suffix = sha + "-d" - verObj["long"] = "{}.{}.{}.{}".format( - version["major"], version["minor"], version["build"], suffix - ) + verObj['long'] = "{}.{}.{}.{}".format( + version["major"], version["minor"], version["build"], suffix) except: # print("Unexpected error:", sys.exc_info()[0]) # traceback.print_exc() - verObj["long"] = verObj["short"] + verObj['long'] = verObj['short'] # print("firmware version " + verStr) return verObj - - # print("path is" + ','.join(sys.path)) diff --git a/bin/test-simulator.sh b/bin/test-simulator.sh index 132f621a95..3c5f8f811a 100755 --- a/bin/test-simulator.sh +++ b/bin/test-simulator.sh @@ -8,3 +8,4 @@ sleep 20 # 5 seconds was not enough echo "Simulator started, launching python test..." python3 -c 'from meshtastic.test import testSimulator; testSimulator()' + diff --git a/bin/uf2conv.py b/bin/uf2conv.py index b0fa8a3138..b619d14db0 100755 --- a/bin/uf2conv.py +++ b/bin/uf2conv.py @@ -1,38 +1,39 @@ #!/usr/bin/env python3 -import argparse -import os -import os.path -import re +import sys import struct import subprocess -import sys +import re +import os +import os.path +import argparse + -UF2_MAGIC_START0 = 0x0A324655 # "UF2\n" -UF2_MAGIC_START1 = 0x9E5D5157 # Randomly selected -UF2_MAGIC_END = 0x0AB16F30 # Ditto +UF2_MAGIC_START0 = 0x0A324655 # "UF2\n" +UF2_MAGIC_START1 = 0x9E5D5157 # Randomly selected +UF2_MAGIC_END = 0x0AB16F30 # Ditto families = { - "SAMD21": 0x68ED2B88, - "SAML21": 0x1851780A, - "SAMD51": 0x55114460, - "NRF52": 0x1B57745F, - "STM32F0": 0x647824B6, - "STM32F1": 0x5EE21072, - "STM32F2": 0x5D1A0A2E, - "STM32F3": 0x6B846188, - "STM32F4": 0x57755A57, - "STM32F7": 0x53B80F00, - "STM32G0": 0x300F5633, - "STM32G4": 0x4C71240A, - "STM32H7": 0x6DB66082, - "STM32L0": 0x202E3A91, - "STM32L1": 0x1E1F432D, - "STM32L4": 0x00FF6919, - "STM32L5": 0x04240BDF, - "STM32WB": 0x70D16653, - "STM32WL": 0x21460FF0, - "ATMEGA32": 0x16573617, - "MIMXRT10XX": 0x4FB2D5BD, + 'SAMD21': 0x68ed2b88, + 'SAML21': 0x1851780a, + 'SAMD51': 0x55114460, + 'NRF52': 0x1b57745f, + 'STM32F0': 0x647824b6, + 'STM32F1': 0x5ee21072, + 'STM32F2': 0x5d1a0a2e, + 'STM32F3': 0x6b846188, + 'STM32F4': 0x57755a57, + 'STM32F7': 0x53b80f00, + 'STM32G0': 0x300f5633, + 'STM32G4': 0x4c71240a, + 'STM32H7': 0x6db66082, + 'STM32L0': 0x202e3a91, + 'STM32L1': 0x1e1f432d, + 'STM32L4': 0x00ff6919, + 'STM32L5': 0x04240bdf, + 'STM32WB': 0x70d16653, + 'STM32WL': 0x21460ff0, + 'ATMEGA32': 0x16573617, + 'MIMXRT10XX': 0x4FB2D5BD } INFO_FILE = "/INFO_UF2.TXT" @@ -45,17 +46,15 @@ def is_uf2(buf): w = struct.unpack(" 10 * 1024 * 1024: + if padding > 10*1024*1024: assert False, "More than 10M of padding needed at " + ptr if padding % 4 != 0: assert False, "Non-word padding size at " + ptr @@ -92,7 +91,6 @@ def convert_from_uf2(buf): curraddr = newaddr + datalen return outp - def convert_to_carray(file_content): outp = "const unsigned char bindata[] __attribute__((aligned(16))) = {" for i in range(len(file_content)): @@ -102,7 +100,6 @@ def convert_to_carray(file_content): outp += "\n};\n" return outp - def convert_to_uf2(file_content): global familyid datapadding = b"" @@ -112,21 +109,13 @@ def convert_to_uf2(file_content): outp = b"" for blockno in range(numblocks): ptr = 256 * blockno - chunk = file_content[ptr : ptr + 256] + chunk = file_content[ptr:ptr + 256] flags = 0x0 if familyid: flags |= 0x2000 - hd = struct.pack( - b"= 3 and words[1] == "2" and words[2] == "FAT": drives.append(words[0]) else: @@ -238,6 +206,7 @@ def get_drives(): for d in os.listdir(rootpath): drives.append(os.path.join(rootpath, d)) + def has_info(d): try: return os.path.isfile(d + INFO_FILE) @@ -248,7 +217,7 @@ def has_info(d): def board_id(path): - with open(path + INFO_FILE, mode="r") as file: + with open(path + INFO_FILE, mode='r') as file: file_content = file.read() return re.search("Board-ID: ([^\r\n]*)", file_content).group(1) @@ -266,61 +235,30 @@ def write_file(name, buf): def main(): global appstartaddr, familyid - def error(msg): print(msg) sys.exit(1) - - parser = argparse.ArgumentParser(description="Convert to UF2 or flash directly.") - parser.add_argument( - "input", - metavar="INPUT", - type=str, - nargs="?", - help="input file (HEX, BIN or UF2)", - ) - parser.add_argument( - "-b", - "--base", - dest="base", - type=str, - default="0x2000", - help="set base address of application for BIN format (default: 0x2000)", - ) - parser.add_argument( - "-o", - "--output", - metavar="FILE", - dest="output", - type=str, - help='write output to named file; defaults to "flash.uf2" or "flash.bin" where sensible', - ) - parser.add_argument( - "-d", "--device", dest="device_path", help="select a device path to flash" - ) - parser.add_argument( - "-l", "--list", action="store_true", help="list connected devices" - ) - parser.add_argument( - "-c", "--convert", action="store_true", help="do not flash, just convert" - ) - parser.add_argument( - "-D", "--deploy", action="store_true", help="just flash, do not convert" - ) - parser.add_argument( - "-f", - "--family", - dest="family", - type=str, - default="0x0", - help="specify familyID - number or name (default: 0x0)", - ) - parser.add_argument( - "-C", - "--carray", - action="store_true", - help="convert binary file to a C array, not UF2", - ) + parser = argparse.ArgumentParser(description='Convert to UF2 or flash directly.') + parser.add_argument('input', metavar='INPUT', type=str, nargs='?', + help='input file (HEX, BIN or UF2)') + parser.add_argument('-b' , '--base', dest='base', type=str, + default="0x2000", + help='set base address of application for BIN format (default: 0x2000)') + parser.add_argument('-o' , '--output', metavar="FILE", dest='output', type=str, + help='write output to named file; defaults to "flash.uf2" or "flash.bin" where sensible') + parser.add_argument('-d' , '--device', dest="device_path", + help='select a device path to flash') + parser.add_argument('-l' , '--list', action='store_true', + help='list connected devices') + parser.add_argument('-c' , '--convert', action='store_true', + help='do not flash, just convert') + parser.add_argument('-D' , '--deploy', action='store_true', + help='just flash, do not convert') + parser.add_argument('-f' , '--family', dest='family', type=str, + default="0x0", + help='specify familyID - number or name (default: 0x0)') + parser.add_argument('-C' , '--carray', action='store_true', + help='convert binary file to a C array, not UF2') args = parser.parse_args() appstartaddr = int(args.base, 0) @@ -330,17 +268,14 @@ def error(msg): try: familyid = int(args.family, 0) except ValueError: - error( - "Family ID needs to be a number or one of: " - + ", ".join(families.keys()) - ) + error("Family ID needs to be a number or one of: " + ", ".join(families.keys())) if args.list: list_drives() else: if not args.input: error("Need input file") - with open(args.input, mode="rb") as f: + with open(args.input, mode='rb') as f: inpbuf = f.read() from_uf2 = is_uf2(inpbuf) ext = "uf2" @@ -356,10 +291,8 @@ def error(msg): ext = "h" else: outbuf = convert_to_uf2(inpbuf) - print( - "Converting to %s, output size: %d, start address: 0x%x" - % (ext, len(outbuf), appstartaddr) - ) + print("Converting to %s, output size: %d, start address: 0x%x" % + (ext, len(outbuf), appstartaddr)) if args.convert or ext != "uf2": drives = [] if args.output == None: diff --git a/images/compass.png b/images/compass.png index c4e5b589bc42cd7b05148dbbdee01ce0fe689548..8639dde5241d720e47e97d63280ec8073928c2b4 100644 GIT binary patch delta 814 zcmV+}1JV4_1kDDJ85jlt00374`G)`i00eVFNmK|32nc)#WQdU=7k>a5bVXQnQ*UN; zcVTj60C#tHE@^ISb7Ns}WiD@WXPfRk8UO$S%1J~)RA_# zlVG9=+yX8ERp5{xHUHjipp{U_HZYT?`L8j?9|8**v=)F3qJMjFj~t4aCi=;L!@LW& zoCWqHbhl9+PU|sA$_m;QU?)QVzJfMjW(e8U+E1uRxQDyIqN{KL_$Y*b0JE;b5tK1Q zGMKA{`PNvoDg-^;#{4iA3HSCj7r~c8?17`fG&~YHpW6x@XK;Dok!`B9rN&?{bbvV< zp_>doiBC!f(|^zwxo^ZZOj=0E73EWRU#XF~>TwN|3OFgQ-&@?49B(<+B1st_7V#~3#4TA+tiP#lwt>$7&WC0Dr z{($5jXp8F$D%R3*QCv6U8fGcrs9sJi(|MUBDP<_{U(3CX4q z+fXn#j3*-JGZ(QHA?9JWfqAh+csaf7B3J-E2*IDg5ht6`RDkayR}+PUuXBW-$_~0) z%4y)O$k7GPXeC$^;yuhBwxXatOW1r5xTm1~k0NFxFO%%!w((xV3`wcGh3>&KU=Ex1 zB9eKSZGT{vDYgbYCi-CO3vgJ?wP1$mp6Ev#xC31FO_uzq`So0&Q1-? s({2H;f!`WQC;tf-NklyvaQ|Snd!k0 z`OI;De`Ye9Uv~M=M1R(0gMZLqh6X-u)u4?}gX=K75ti8{AR4f`yk!Xo>{a+clz*{~ zS-?t;4MHM~72@M!Xo7>D5=T6yMwv0j@Tjp$r>9Aaf?4_RvEr{NF-VEc*cngsTjXN9 zKczyNS{PNkjF4(sU2O#u zRdw#WqqAXKWlx_6mt!NXR2>tYyBeY9QCJ zQCGwKFHzsRiH&l9o#Y02Y~=MDT*1aw{RSm$c>Q&fFZs?;mwZSfUqV)~@l>*(k*J|Y zmW{8HeV;@#bY)bOt#9BLQ>56HuuV+8k<4vUEva!mi-~zPt`|w=@KFNKxqpVPB0nVS z2!{-FYA^e^=*aP2G6HU+!6%Y+K#?qys(i#cT3lKx<%}w6<~difdyJx~z==u=*`mxK z9i+&9KCP@vWKiMvJ}k34xi>OA2~&+|RTG33(J{P+!6XA~>9XlIu1FbDP=?y*BR z;Rj@!MI0F3G%GY?r#a*~4<4AhKtF+(4KB3b>M76a97!*<00000NkvXXu0mjfa`FP& diff --git a/images/face-24px.svg b/images/face-24px.svg index 08e8f5ffcc..293468664d 100644 --- a/images/face-24px.svg +++ b/images/face-24px.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/images/face.png b/images/face.png index eb6b91e13b89f3a0d27efbaf83e35f2c1f70b3c5..036e29f7349217607c53f48aed28e99484a3e648 100644 GIT binary patch delta 293 zcmV+=0owlI0m%Z885jlt00469MzCV_|S*E^l&Yo9;Xs0002SNkl|LzC>pdL!hvB*6^ z(FP3ghR+|)I{B>%HGlAmX$!bfu}tCvee7YJxCxG7C(s-nTw~VwY#*06!YQtBUMH70 zi@(7|{4jAn^8$AB@Q#!CLv-W2IEX*a+~1nu!S8y;ee#}B!d5~QJk`Ieg!u6Zu6ANf zfL!gRuO;*HjTun5835X*7IGKhu7|lHM&<}gpfJPQ7!xa`&cN2*zmpA+s4PV*4=Ejh qpmLB3Qb!McqD1DRbhgoH-0ltI05a+a8KhYN0000 \ No newline at end of file + \ No newline at end of file diff --git a/images/pin.png b/images/pin.png index 3c91a726c3cf3c5605e1580a89e35f84850da2f6..112a7ce8ed6a7537c73dc2626d2f6cab93d87fbc 100644 GIT binary patch delta 251 zcmVMzCV_|S*E^l&Yo9;Xs0001;Nkl# BWEB7a delta 166 zcmV;X09pT_0?PrA83+Ub007wHEccNy7=L|9L_t(|+KtdL4#5BzhT&&nDRCHfEL=e( zB;q9E1TG-%!VTP@Sj56g`b(r~qv_D+8{h5I#MH^f(L}{sCVtDTDD}LA)J`fqbrr@! z7-A%Zk-|U-3oM1uS7>_(Z)YFju0?4pif#PqxaHw0Q8CZcOpSxES1YlXG \ No newline at end of file + \ No newline at end of file diff --git a/images/textsms-24px.svg b/images/textsms-24px.svg index 84c4fdcc1d..4455f047e3 100644 --- a/images/textsms-24px.svg +++ b/images/textsms-24px.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/monitor/filter_c3_exception_decoder.py b/monitor/filter_c3_exception_decoder.py index 6d7b5370c2..e59b0be2a4 100644 --- a/monitor/filter_c3_exception_decoder.py +++ b/monitor/filter_c3_exception_decoder.py @@ -18,7 +18,10 @@ import sys from platformio.project.exception import PlatformioException -from platformio.public import DeviceMonitorFilterBase, load_build_metadata +from platformio.public import ( + DeviceMonitorFilterBase, + load_build_metadata, +) # By design, __init__ is called inside miniterm and we can't pass context to it. # pylint: disable=attribute-defined-outside-init @@ -29,7 +32,7 @@ class Esp32C3ExceptionDecoder(DeviceMonitorFilterBase): NAME = "esp32_c3_exception_decoder" - PCADDR_PATTERN = re.compile(r"0x4[0-9a-f]{7}", re.IGNORECASE) + PCADDR_PATTERN = re.compile(r'0x4[0-9a-f]{7}', re.IGNORECASE) def __call__(self): self.buffer = "" @@ -72,14 +75,14 @@ def setup_paths(self): % self.__class__.__name__ ) return False - + if not os.path.isfile(self.addr2line_path): sys.stderr.write( "%s: disabling, addr2line at %s does not exist\n" % (self.__class__.__name__, self.addr2line_path) ) return False - + return True except PlatformioException as e: sys.stderr.write( @@ -114,7 +117,7 @@ def rx(self, text): trace = self.get_backtrace(m) if len(trace) != "": - text = text[:last] + trace + text[last:] + text = text[: last] + trace + text[last :] last += len(trace) return text @@ -122,10 +125,14 @@ def rx(self, text): def get_backtrace(self, match): trace = "\n" enc = "mbcs" if IS_WINDOWS else "utf-8" - args = [self.addr2line_path, "-fipC", "-e", self.firmware_path] + args = [self.addr2line_path, u"-fipC", u"-e", self.firmware_path] try: addr = match.group() - output = subprocess.check_output(args + [addr]).decode(enc).strip() + output = ( + subprocess.check_output(args + [addr]) + .decode(enc) + .strip() + ) output = output.replace( "\n", "\n " ) # newlines happen with inlined methods diff --git a/src/GPSStatus.h b/src/GPSStatus.h index 81d348c2b6..bcfb5f2eb5 100644 --- a/src/GPSStatus.h +++ b/src/GPSStatus.h @@ -88,11 +88,20 @@ class GPSStatus : public Status } } - uint32_t getDOP() const { return p.PDOP; } + uint32_t getDOP() const + { + return p.PDOP; + } - uint32_t getHeading() const { return p.ground_track; } + uint32_t getHeading() const + { + return p.ground_track; + } - uint32_t getNumSatellites() const { return p.sats_in_view; } + uint32_t getNumSatellites() const + { + return p.sats_in_view; + } bool matches(const GPSStatus *newStatus) const { diff --git a/src/mesh/SX128xInterface.cpp b/src/mesh/SX128xInterface.cpp index 00894536bc..d0103ec291 100644 --- a/src/mesh/SX128xInterface.cpp +++ b/src/mesh/SX128xInterface.cpp @@ -251,9 +251,9 @@ template void SX128xInterface::startReceive() #endif // We use the PREAMBLE_DETECTED and HEADER_VALID IRQ flag to detect whether we are actively receiving - int err = - lora.startReceive(RADIOLIB_SX128X_RX_TIMEOUT_INF, RADIOLIB_SX128X_IRQ_RX_DEFAULT | RADIOLIB_SX128X_IRQ_PREAMBLE_DETECTED | - RADIOLIB_SX128X_IRQ_HEADER_VALID); + int err = lora.startReceive(RADIOLIB_SX128X_RX_TIMEOUT_INF, RADIOLIB_SX128X_IRQ_RX_DEFAULT | + RADIOLIB_SX128X_IRQ_PREAMBLE_DETECTED | + RADIOLIB_SX128X_IRQ_HEADER_VALID); assert(err == RADIOLIB_ERR_NONE); diff --git a/src/mesh/compression/unishox2.h b/src/mesh/compression/unishox2.h index e051375688..a5117a5de0 100644 --- a/src/mesh/compression/unishox2.h +++ b/src/mesh/compression/unishox2.h @@ -156,8 +156,8 @@ 3, 1, 3, 3, 3 \ } -// #define USX_HCODES_FAVOR_UMLAUT {0x00, 0x40, 0xE0, 0xC0, 0x80} -// #define USX_HCODE_LENS_FAVOR_UMLAUT {2, 2, 3, 3, 2} +//#define USX_HCODES_FAVOR_UMLAUT {0x00, 0x40, 0xE0, 0xC0, 0x80} +//#define USX_HCODE_LENS_FAVOR_UMLAUT {2, 2, 3, 3, 2} /// Horizontal codes preset favouring umlaut letters #define USX_HCODES_FAVOR_UMLAUT \ diff --git a/variants/trackerd/variant.h b/variants/trackerd/variant.h index 09dcd422ce..b3fca367f0 100644 --- a/variants/trackerd/variant.h +++ b/variants/trackerd/variant.h @@ -10,7 +10,7 @@ #define LED_PIN 13 // 13 red, 2 blue, 15 red -// #define HAS_BUTTON 0 +//#define HAS_BUTTON 0 #define BUTTON_PIN 0 #define BUTTON_NEED_PULLUP @@ -42,5 +42,5 @@ #define ADC_MULTIPLIER VBAT_DIVIDER_COMP #define VBAT_RAW_TO_SCALED(x) (REAL_VBAT_MV_PER_LSB * x) -// #define BATTERY_SENSE_SAMPLES 15 // Set the number of samples, It has an effect of increasing sensitivity. -// #define ADC_MULTIPLIER 3.3 \ No newline at end of file +//#define BATTERY_SENSE_SAMPLES 15 // Set the number of samples, It has an effect of increasing sensitivity. +//#define ADC_MULTIPLIER 3.3 \ No newline at end of file From 2de35a8e1bfa6cb4349a4c2a829a1bf017f608a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Wed, 20 Mar 2024 12:27:35 +0100 Subject: [PATCH 10/11] jeez! --- .vscode/extensions.json | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 5951c2dee7..4fc84fa780 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -6,11 +6,4 @@ "platformio.platformio-ide", "trunk.io" ], -<<<<<<< HEAD - "unwantedRecommendations": [ - "ms-vscode.cpptools-extension-pack" - ] } -======= -} ->>>>>>> parent of 436e6317 (Format changes from trunk) From b612d9ccdd548a9ab39d5e5028cfce2e3f85ee5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Wed, 20 Mar 2024 12:48:40 +0100 Subject: [PATCH 11/11] tryfix proto conflict --- protobufs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protobufs b/protobufs index 00332412b2..556e49ba61 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 00332412b238fe559175a6e83fdf8d31fa5e209a +Subproject commit 556e49ba619e2f4d8fa3c2dee2a94129a43d5f08