From ed26ab801c8e6edbca8bb6fbc04561f77572e28b Mon Sep 17 00:00:00 2001 From: Lars Weber Date: Sat, 5 Nov 2022 14:37:00 +0100 Subject: [PATCH 01/15] fix: use RF95_IRQ for wakeup source in doLightSleep (#1899) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Thomas Göttgens Co-authored-by: Ben Meadors --- src/sleep.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sleep.cpp b/src/sleep.cpp index 055cf770d..390ab7f65 100644 --- a/src/sleep.cpp +++ b/src/sleep.cpp @@ -263,8 +263,8 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r #ifdef BUTTON_PIN gpio_wakeup_enable((gpio_num_t)BUTTON_PIN, GPIO_INTR_LOW_LEVEL); // when user presses, this button goes low #endif -#ifdef RF95_IRQ_GPIO - gpio_wakeup_enable((gpio_num_t)RF95_IRQ_GPIO, GPIO_INTR_HIGH_LEVEL); // RF95 interrupt, active high +#ifdef RF95_IRQ + gpio_wakeup_enable((gpio_num_t)RF95_IRQ, GPIO_INTR_HIGH_LEVEL); // RF95 interrupt, active high #endif #ifdef PMU_IRQ // wake due to PMU can happen repeatedly if there is no battery installed or the battery fills From cda7a6073440148000d6da5f94f4dfb0b980b1da Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 5 Nov 2022 08:43:44 -0500 Subject: [PATCH 02/15] Update protos --- protobufs | 2 +- src/mesh/generated/mesh.pb.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/protobufs b/protobufs index a0fe9ec86..6b46e42a6 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit a0fe9ec8614cd27af7691869ccbd20c39e48a086 +Subproject commit 6b46e42a656dd3aab74c373e79b70e699eeac834 diff --git a/src/mesh/generated/mesh.pb.h b/src/mesh/generated/mesh.pb.h index 812099166..c1c2bdd7b 100644 --- a/src/mesh/generated/mesh.pb.h +++ b/src/mesh/generated/mesh.pb.h @@ -501,7 +501,7 @@ typedef PB_BYTES_ARRAY_T(256) MeshPacket_encrypted_t; typedef struct _MeshPacket { /* The sending node number. Note: Our crypto implementation uses this field as well. - See [crypto](/docs/developers/firmware/encryption) for details. + See [crypto](/docs/about/overview/encryption) for details. FIXME - really should be fixed32 instead, this encoding only hurts the ble link though. */ uint32_t from; /* The (immediatSee Priority description for more details.y should be fixed32 instead, this encoding only @@ -529,7 +529,7 @@ typedef struct _MeshPacket { needs to be unique for a few minutes (long enough to last for the length of any ACK or the completion of a mesh broadcast flood). Note: Our crypto implementation uses this id as well. - See [crypto](/docs/developers/firmware/encryption) for details. + See [crypto](/docs/about/overview/encryption) for details. FIXME - really should be fixed32 instead, this encoding only hurts the ble link though. */ uint32_t id; From c6f060a24fed4c9ff0e3eed81110b8bb07c85bc3 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 5 Nov 2022 09:21:51 -0500 Subject: [PATCH 03/15] Add develop to CI --- .github/workflows/main_matrix.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 66bf7539c..4736de06e 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -2,14 +2,14 @@ name: CI on: # # Triggers the workflow on push but only for the master branch push: - branches: [master] + branches: [master, develop] paths-ignore: - "**.md" - "version.properties" # Note: This is different from "pull_request". Need to specify ref when doing checkouts. pull_request_target: - branches: [master] + branches: [master, develop] paths-ignore: - "**.md" #- "**.yml" From 30e5706eaa313966fe8a636606fb85cfa12aad7a Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 5 Nov 2022 15:10:43 -0500 Subject: [PATCH 04/15] Fix for alpine linux builds --- src/gps/NMEAWPL.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gps/NMEAWPL.h b/src/gps/NMEAWPL.h index 853c850eb..44e081bf7 100644 --- a/src/gps/NMEAWPL.h +++ b/src/gps/NMEAWPL.h @@ -3,5 +3,5 @@ #include #include "main.h" -uint printWPL(char *buf, const Position &pos, const char *name); -uint printGGA(char *buf, const Position &pos); +uin32_t printWPL(char *buf, const Position &pos, const char *name); +uin32_t printGGA(char *buf, const Position &pos); From a08ac5a47e0d21d5cd3dba20ad97e88e915ed01a Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 5 Nov 2022 15:11:11 -0500 Subject: [PATCH 05/15] Update NMEAWPL.cpp --- src/gps/NMEAWPL.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gps/NMEAWPL.cpp b/src/gps/NMEAWPL.cpp index 95e69343b..d23e78182 100644 --- a/src/gps/NMEAWPL.cpp +++ b/src/gps/NMEAWPL.cpp @@ -15,7 +15,7 @@ * ------------------------------------------- */ -uint printWPL(char *buf, const Position &pos, const char *name) +uint32_t printWPL(char *buf, const Position &pos, const char *name) { uint len = sprintf(buf, "$GNWPL,%07.2f,%c,%08.2f,%c,%s", pos.latitude_i * 1e-5, pos.latitude_i < 0 ? 'S' : 'N', pos.longitude_i * 1e-5, pos.longitude_i < 0 ? 'W' : 'E', name); uint chk = 0; @@ -50,9 +50,9 @@ uint printWPL(char *buf, const Position &pos, const char *name) * ------------------------------------------- */ -uint printGGA(char *buf, const Position &pos) +uint32_t printGGA(char *buf, const Position &pos) { - uint len = sprintf(buf, "$GNGGA,%06u.%03u,%07.2f,%c,%08.2f,%c,%u,%02u,%04u,%04d,%c,%04d,%c,%d,%04d", + uint32_t len = sprintf(buf, "$GNGGA,%06u.%03u,%07.2f,%c,%08.2f,%c,%u,%02u,%04u,%04d,%c,%04d,%c,%d,%04d", pos.time / 1000, pos.time % 1000, pos.latitude_i * 1e-5, pos.latitude_i < 0 ? 'S' : 'N', @@ -67,10 +67,10 @@ uint printGGA(char *buf, const Position &pos) 0, 0); - uint chk = 0; - for (uint i = 1; i < len; i++) { + uint32_t chk = 0; + for (uint32_t i = 1; i < len; i++) { chk ^= buf[i]; } len += sprintf(buf + len, "*%02X\r\n", chk); return len; -} \ No newline at end of file +} From a7a020f431cc153932e783ef7ba35d1f44b7085a Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 5 Nov 2022 15:14:08 -0500 Subject: [PATCH 06/15] Update NMEAWPL.cpp --- src/gps/NMEAWPL.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gps/NMEAWPL.cpp b/src/gps/NMEAWPL.cpp index d23e78182..666f9131b 100644 --- a/src/gps/NMEAWPL.cpp +++ b/src/gps/NMEAWPL.cpp @@ -17,8 +17,8 @@ uint32_t printWPL(char *buf, const Position &pos, const char *name) { - uint len = sprintf(buf, "$GNWPL,%07.2f,%c,%08.2f,%c,%s", pos.latitude_i * 1e-5, pos.latitude_i < 0 ? 'S' : 'N', pos.longitude_i * 1e-5, pos.longitude_i < 0 ? 'W' : 'E', name); - uint chk = 0; + uint32_t len = sprintf(buf, "$GNWPL,%07.2f,%c,%08.2f,%c,%s", pos.latitude_i * 1e-5, pos.latitude_i < 0 ? 'S' : 'N', pos.longitude_i * 1e-5, pos.longitude_i < 0 ? 'W' : 'E', name); + uint32_t chk = 0; for (uint i = 1; i < len; i++) { chk ^= buf[i]; } From d641adc0fc677548753af2d1571441c27997913a Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 5 Nov 2022 15:20:09 -0500 Subject: [PATCH 07/15] Update NMEAWPL.h --- src/gps/NMEAWPL.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gps/NMEAWPL.h b/src/gps/NMEAWPL.h index 44e081bf7..aaa18933c 100644 --- a/src/gps/NMEAWPL.h +++ b/src/gps/NMEAWPL.h @@ -3,5 +3,5 @@ #include #include "main.h" -uin32_t printWPL(char *buf, const Position &pos, const char *name); -uin32_t printGGA(char *buf, const Position &pos); +uint32_t printWPL(char *buf, const Position &pos, const char *name); +uint32_t printGGA(char *buf, const Position &pos); From 9c0483975c2406a0c13333037a08c62432beb04c Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 5 Nov 2022 15:34:54 -0500 Subject: [PATCH 08/15] Somehow I still missed one :-| --- src/gps/NMEAWPL.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gps/NMEAWPL.cpp b/src/gps/NMEAWPL.cpp index 666f9131b..222a2d04c 100644 --- a/src/gps/NMEAWPL.cpp +++ b/src/gps/NMEAWPL.cpp @@ -19,7 +19,7 @@ uint32_t printWPL(char *buf, const Position &pos, const char *name) { uint32_t len = sprintf(buf, "$GNWPL,%07.2f,%c,%08.2f,%c,%s", pos.latitude_i * 1e-5, pos.latitude_i < 0 ? 'S' : 'N', pos.longitude_i * 1e-5, pos.longitude_i < 0 ? 'W' : 'E', name); uint32_t chk = 0; - for (uint i = 1; i < len; i++) { + for (uint32_t i = 1; i < len; i++) { chk ^= buf[i]; } len += sprintf(buf + len, "*%02X\r\n", chk); From d74bcd3583ced44764301a045d133c0ea5f0c68f Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 5 Nov 2022 18:21:35 -0500 Subject: [PATCH 09/15] Portduino build flags --- variants/portduino/platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index c95ae37fe..016ef61bd 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -1,6 +1,6 @@ [env:native] platform = https://github.com/meshtastic/platform-native.git -build_flags = ${portduino_base.build_flags} -O0 -I variants/portduino +build_flags = ${portduino_base.build_flags} -O0 -I variants/portduino -E framework = arduino board = cross_platform lib_deps = ${portduino_base.lib_deps} From e1e607cba3f9c30c6f9b7ea31ac727886d7e9143 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 5 Nov 2022 19:09:04 -0500 Subject: [PATCH 10/15] Remove flag --- variants/portduino/platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index 016ef61bd..c95ae37fe 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -1,6 +1,6 @@ [env:native] platform = https://github.com/meshtastic/platform-native.git -build_flags = ${portduino_base.build_flags} -O0 -I variants/portduino -E +build_flags = ${portduino_base.build_flags} -O0 -I variants/portduino framework = arduino board = cross_platform lib_deps = ${portduino_base.lib_deps} From 9805319940a2499386a1c84fa6030c9e9f579818 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 5 Nov 2022 21:08:29 -0500 Subject: [PATCH 11/15] Docker is back --- Dockerfile | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..45aa5df45 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM debian:bullseye-slim +RUN apt-get update +RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install wget python3 g++ zip python3-venv git vim +RUN wget https://raw.githubusercontent.com/platformio/platformio-core-installer/master/get-platformio.py -O get-platformio.py; chmod +x get-platformio.py +RUN python3 get-platformio.py +RUN git clone https://github.com/meshtastic/firmware --recurse-submodules +RUN cd firmware +RUN chmod +x ./firmware/bin/build-native.sh +RUN . ~/.platformio/penv/bin/activate; cd firmware; sh ./bin/build-native.sh + +CMD ["/firmware/release/meshtasticd_linux_amd64"] From f1416ac9f779e5713504af7816285e33574bc18c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Sun, 6 Nov 2022 14:49:02 +0100 Subject: [PATCH 12/15] Reduce retention to 30 days. --- .github/workflows/main_matrix.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 4736de06e..aacdc72af 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -170,7 +170,7 @@ jobs: path: | release/*.bin release/*.elf - retention-days: 90 + retention-days: 30 build-nrf52: strategy: @@ -229,7 +229,7 @@ jobs: release/*.uf2 release/*.elf release/*.zip - retention-days: 90 + retention-days: 30 build-rpi2040: strategy: @@ -283,7 +283,7 @@ jobs: path: | release/*.uf2 release/*.elf - retention-days: 90 + retention-days: 30 build-native: runs-on: ubuntu-latest @@ -342,7 +342,7 @@ jobs: release/meshtasticd_linux_amd64 release/device-*.sh release/device-*.bat - retention-days: 90 + retention-days: 30 after-checks: runs-on: ubuntu-latest From 9513209b70baa5286917b1791ae3deccb268f81e Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sun, 6 Nov 2022 09:30:46 -0600 Subject: [PATCH 13/15] Alpine --- Dockerfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 45aa5df45..01d262ce3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:bullseye-slim +FROM debian:bullseye-slim AS builder RUN apt-get update RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install wget python3 g++ zip python3-venv git vim RUN wget https://raw.githubusercontent.com/platformio/platformio-core-installer/master/get-platformio.py -O get-platformio.py; chmod +x get-platformio.py @@ -8,4 +8,8 @@ RUN cd firmware RUN chmod +x ./firmware/bin/build-native.sh RUN . ~/.platformio/penv/bin/activate; cd firmware; sh ./bin/build-native.sh -CMD ["/firmware/release/meshtasticd_linux_amd64"] +FROM frolvlad/alpine-glibc +WORKDIR /root/ +COPY --from=builder /firmware/release/meshtasticd_linux_amd64 ./ +RUN apk --update add --no-cache g++ +CMD ["./meshtasticd_linux_amd64"] From 6934e0bce7a18fb087e54c8f443ef14f04c5d300 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Sun, 6 Nov 2022 18:36:17 +0100 Subject: [PATCH 14/15] Fix assert --- src/mesh/RadioLibInterface.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/mesh/RadioLibInterface.cpp b/src/mesh/RadioLibInterface.cpp index 262a10c18..c08220555 100644 --- a/src/mesh/RadioLibInterface.cpp +++ b/src/mesh/RadioLibInterface.cpp @@ -317,7 +317,13 @@ ErrorCode RadioLibInterface::send(MeshPacket *p) void RadioLibInterface::handleReceiveInterrupt() { uint32_t xmitMsec; - assert(isReceiving); + + // when this is called, we should be in receive mode - if we are not, just jump out instead of bombing. Possible Race Condition? + if (!isReceiving) { + DEBUG_MSG("*** WAS_ASSERT *** handleReceiveInterrupt called when not in receive mode\n"); + return; + } + isReceiving = false; // read the number of actually received bytes From 0832cc50a89d03f06e5bf223989b4c62913d5d57 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sun, 6 Nov 2022 13:19:49 -0600 Subject: [PATCH 15/15] Add a docker-compose --- docker-compose.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..28b8c2ebd --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,5 @@ +version: "3.7" + +services: + meshtastic-device: + build: .