From 0e3e8b7607ffdeeabc34a3a349e108e0c3a1363d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 21 Nov 2025 11:02:13 +0100 Subject: [PATCH 1/9] Update protobufs (#8707) Co-authored-by: caveman99 <25002+caveman99@users.noreply.github.com> --- protobufs | 2 +- src/mesh/generated/meshtastic/mesh.pb.h | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/protobufs b/protobufs index 7654db2e2..52fa252f1 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 7654db2e2d1834aebde40090a9b74162ad1048ae +Subproject commit 52fa252f1e01be87ad2f7ab17ceef7882b2a4a93 diff --git a/src/mesh/generated/meshtastic/mesh.pb.h b/src/mesh/generated/meshtastic/mesh.pb.h index 0da44cce0..46de1dee0 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.h +++ b/src/mesh/generated/meshtastic/mesh.pb.h @@ -288,6 +288,12 @@ typedef enum _meshtastic_HardwareModel { meshtastic_HardwareModel_WISMESH_TAP_V2 = 116, /* RAK3401 */ meshtastic_HardwareModel_RAK3401 = 117, + /* RAK6421 Hat+ */ + meshtastic_HardwareModel_RAK6421 = 118, + /* Elecrow ThinkNode M4 */ + meshtastic_HardwareModel_THINKNODE_M4 = 119, + /* Elecrow ThinkNode M6 */ + meshtastic_HardwareModel_THINKNODE_M6 = 120, /* ------------------------------------------------------------------------------------------------------------------------------------------ Reserved ID For developing private Ports. These will show up in live traffic sparsely, so we can use a high number. Keep it within 8 bits. ------------------------------------------------------------------------------------------------------------------------------------------ */ @@ -825,7 +831,11 @@ typedef struct _meshtastic_MeshPacket { Note: Our crypto implementation uses this field as well. See [crypto](/docs/overview/encryption) for details. */ uint32_t from; - /* The (immediate) destination for this packet */ + /* The (immediate) destination for this packet + If the value is 4,294,967,295 (maximum value of an unsigned 32bit integer), this indicates that the packet was + not destined for a specific node, but for a channel as indicated by the value of `channel` below. + If the value is another, this indicates that the packet was destined for a specific + node (i.e. a kind of "Direct Message" to this node) and not broadcast on a channel. */ uint32_t to; /* (Usually) If set, this indicates the index in the secondary_channels table that this packet was sent/received on. If unset, packet was on the primary channel. From c051c56544e4faedd7c9b5e75ecf11ec2cd88b54 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 22 Nov 2025 08:26:39 -0600 Subject: [PATCH 2/9] Update Kongduino-Adafruit_nRFCrypto digest to 8cde718 (#8708) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- arch/nrf52/nrf52840.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/nrf52/nrf52840.ini b/arch/nrf52/nrf52840.ini index 5e846b3b7..e13443152 100644 --- a/arch/nrf52/nrf52840.ini +++ b/arch/nrf52/nrf52840.ini @@ -8,7 +8,7 @@ lib_deps = ${environmental_base.lib_deps} ${environmental_extra.lib_deps} # renovate: datasource=git-refs depName=Kongduino-Adafruit_nRFCrypto packageName=https://github.com/Kongduino/Adafruit_nRFCrypto gitBranch=master - https://github.com/Kongduino/Adafruit_nRFCrypto/archive/5f838d2709461a2c981f642917aa50254a25c14c.zip + https://github.com/Kongduino/Adafruit_nRFCrypto/archive/8cde7189b5ead9dcd49f72601b43b969c0bbc06e.zip ; Common NRF52 debugging settings follow. See the Meshtastic developer docs for how to connect SWD debugging probes to your board. From 376dc7ef3a184113ff8060c5a4c6870209f55690 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 22 Nov 2025 08:27:00 -0600 Subject: [PATCH 3/9] Update actions/checkout action to v6 (#8695) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/actions/setup-base/action.yml | 2 +- .github/workflows/build_debian_src.yml | 2 +- .github/workflows/build_firmware.yml | 2 +- .github/workflows/build_one_arch.yml | 6 +++--- .github/workflows/build_one_target.yml | 6 +++--- .github/workflows/docker_build.yml | 2 +- .github/workflows/docker_manifest.yml | 2 +- .github/workflows/hook_copr.yml | 2 +- .github/workflows/main_matrix.yml | 14 +++++++------- .github/workflows/merge_queue.yml | 14 +++++++------- .github/workflows/nightly.yml | 4 ++-- .github/workflows/package_obs.yml | 2 +- .github/workflows/package_pio_deps.yml | 2 +- .github/workflows/package_ppa.yml | 2 +- .github/workflows/pr_tests.yml | 2 +- .github/workflows/release_channels.yml | 2 +- .github/workflows/sec_sast_semgrep_cron.yml | 2 +- .github/workflows/sec_sast_semgrep_pull.yml | 2 +- .github/workflows/test_native.yml | 6 +++--- .github/workflows/tests.yml | 2 +- .github/workflows/trunk_annotate_pr.yml | 2 +- .github/workflows/trunk_check.yml | 2 +- .github/workflows/trunk_format_pr.yml | 2 +- .github/workflows/update_protobufs.yml | 2 +- 24 files changed, 43 insertions(+), 43 deletions(-) diff --git a/.github/actions/setup-base/action.yml b/.github/actions/setup-base/action.yml index f6c1fd80c..80f5c6855 100644 --- a/.github/actions/setup-base/action.yml +++ b/.github/actions/setup-base/action.yml @@ -5,7 +5,7 @@ runs: using: composite steps: - name: Checkout code - uses: actions/checkout@v5 + uses: actions/checkout@v6 with: submodules: recursive ref: ${{github.event.pull_request.head.ref}} diff --git a/.github/workflows/build_debian_src.yml b/.github/workflows/build_debian_src.yml index d36e7fea1..d7d26f0e8 100644 --- a/.github/workflows/build_debian_src.yml +++ b/.github/workflows/build_debian_src.yml @@ -24,7 +24,7 @@ jobs: runs-on: ubuntu-24.04 steps: - name: Checkout code - uses: actions/checkout@v5 + uses: actions/checkout@v6 with: submodules: recursive path: meshtasticd diff --git a/.github/workflows/build_firmware.yml b/.github/workflows/build_firmware.yml index 57c1e72c7..9ac84c23e 100644 --- a/.github/workflows/build_firmware.yml +++ b/.github/workflows/build_firmware.yml @@ -22,7 +22,7 @@ jobs: outputs: artifact-id: ${{ steps.upload.outputs.artifact-id }} steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: submodules: recursive ref: ${{github.event.pull_request.head.ref}} diff --git a/.github/workflows/build_one_arch.yml b/.github/workflows/build_one_arch.yml index 6d5462c93..5673f8cb6 100644 --- a/.github/workflows/build_one_arch.yml +++ b/.github/workflows/build_one_arch.yml @@ -26,7 +26,7 @@ jobs: setup: runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: actions/setup-python@v6 with: python-version: 3.x @@ -44,7 +44,7 @@ jobs: version: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Get release version string run: | echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT @@ -108,7 +108,7 @@ jobs: needs: [version, build] steps: - name: Checkout code - uses: actions/checkout@v5 + uses: actions/checkout@v6 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} diff --git a/.github/workflows/build_one_target.yml b/.github/workflows/build_one_target.yml index 46362a629..343e5be64 100644 --- a/.github/workflows/build_one_target.yml +++ b/.github/workflows/build_one_target.yml @@ -45,7 +45,7 @@ jobs: runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: actions/setup-python@v6 with: python-version: 3.x @@ -66,7 +66,7 @@ jobs: if: ${{ inputs.target != '' }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Get release version string run: | echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT @@ -114,7 +114,7 @@ jobs: needs: [version, build] steps: - name: Checkout code - uses: actions/checkout@v5 + uses: actions/checkout@v6 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} diff --git a/.github/workflows/docker_build.yml b/.github/workflows/docker_build.yml index 26a9cff18..8d19af894 100644 --- a/.github/workflows/docker_build.yml +++ b/.github/workflows/docker_build.yml @@ -47,7 +47,7 @@ jobs: runs-on: ${{ inputs.runs-on }} steps: - name: Checkout code - uses: actions/checkout@v5 + uses: actions/checkout@v6 with: submodules: recursive ref: ${{github.event.pull_request.head.ref}} diff --git a/.github/workflows/docker_manifest.yml b/.github/workflows/docker_manifest.yml index 20b9ceee6..396ddb68e 100644 --- a/.github/workflows/docker_manifest.yml +++ b/.github/workflows/docker_manifest.yml @@ -83,7 +83,7 @@ jobs: runs-on: ubuntu-24.04 steps: - name: Checkout code - uses: actions/checkout@v5 + uses: actions/checkout@v6 with: submodules: recursive ref: ${{github.event.pull_request.head.ref}} diff --git a/.github/workflows/hook_copr.yml b/.github/workflows/hook_copr.yml index 2204cc02c..eb4ebc57b 100644 --- a/.github/workflows/hook_copr.yml +++ b/.github/workflows/hook_copr.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-24.04 steps: - name: Checkout code - uses: actions/checkout@v5 + uses: actions/checkout@v6 with: submodules: recursive ref: ${{ github.ref }} diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 7ea033d55..38373a2fc 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -35,7 +35,7 @@ jobs: - check runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: actions/setup-python@v6 with: python-version: 3.x @@ -59,7 +59,7 @@ jobs: version: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Get release version string run: | echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT @@ -81,7 +81,7 @@ jobs: runs-on: ubuntu-latest if: ${{ github.event_name != 'workflow_dispatch' && github.repository == 'meshtastic/firmware' }} steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Build base id: base uses: ./.github/actions/setup-base @@ -163,7 +163,7 @@ jobs: needs: [version, build] steps: - name: Checkout code - uses: actions/checkout@v5 + uses: actions/checkout@v6 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} @@ -242,7 +242,7 @@ jobs: - package-pio-deps-native-tft steps: - name: Checkout - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Setup Python uses: actions/setup-python@v6 @@ -311,7 +311,7 @@ jobs: needs: [release-artifacts, version] steps: - name: Checkout - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Setup Python uses: actions/setup-python@v6 @@ -366,7 +366,7 @@ jobs: esp32,esp32s3,esp32c3,esp32c6,nrf52840,rp2040,rp2350,stm32 steps: - name: Checkout - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Setup Python uses: actions/setup-python@v6 diff --git a/.github/workflows/merge_queue.yml b/.github/workflows/merge_queue.yml index 6d69258c9..154b230c7 100644 --- a/.github/workflows/merge_queue.yml +++ b/.github/workflows/merge_queue.yml @@ -17,7 +17,7 @@ jobs: - check runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: actions/setup-python@v6 with: python-version: 3.x @@ -40,7 +40,7 @@ jobs: version: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Get release version string run: | echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT @@ -62,7 +62,7 @@ jobs: runs-on: ubuntu-latest if: ${{ github.event_name != 'workflow_dispatch' }} steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Build base id: base uses: ./.github/actions/setup-base @@ -142,7 +142,7 @@ jobs: needs: [version, build] steps: - name: Checkout code - uses: actions/checkout@v5 + uses: actions/checkout@v6 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} @@ -221,7 +221,7 @@ jobs: - package-pio-deps-native-tft steps: - name: Checkout - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Setup Python uses: actions/setup-python@v6 @@ -290,7 +290,7 @@ jobs: needs: [release-artifacts, version] steps: - name: Checkout - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Setup Python uses: actions/setup-python@v6 @@ -345,7 +345,7 @@ jobs: esp32,esp32s3,esp32c3,esp32c6,nrf52840,rp2040,rp2350,stm32 steps: - name: Checkout - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Setup Python uses: actions/setup-python@v6 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index f26073ec4..045e94895 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -14,7 +14,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Trunk Check uses: trunk-io/trunk-action@v1 @@ -31,7 +31,7 @@ jobs: pull-requests: write # For trunk to create PRs steps: - name: Checkout - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Trunk Upgrade uses: trunk-io/trunk-action/upgrade@v1 diff --git a/.github/workflows/package_obs.yml b/.github/workflows/package_obs.yml index b8a829d9a..2b202ed95 100644 --- a/.github/workflows/package_obs.yml +++ b/.github/workflows/package_obs.yml @@ -34,7 +34,7 @@ jobs: needs: build-debian-src steps: - name: Checkout code - uses: actions/checkout@v5 + uses: actions/checkout@v6 with: submodules: recursive path: meshtasticd diff --git a/.github/workflows/package_pio_deps.yml b/.github/workflows/package_pio_deps.yml index c52dfe348..cb10a79f3 100644 --- a/.github/workflows/package_pio_deps.yml +++ b/.github/workflows/package_pio_deps.yml @@ -24,7 +24,7 @@ jobs: runs-on: ubuntu-24.04 steps: - name: Checkout code - uses: actions/checkout@v5 + uses: actions/checkout@v6 with: submodules: recursive ref: ${{github.event.pull_request.head.ref}} diff --git a/.github/workflows/package_ppa.yml b/.github/workflows/package_ppa.yml index 2d6c257e6..2e3278041 100644 --- a/.github/workflows/package_ppa.yml +++ b/.github/workflows/package_ppa.yml @@ -32,7 +32,7 @@ jobs: needs: build-debian-src steps: - name: Checkout code - uses: actions/checkout@v5 + uses: actions/checkout@v6 with: submodules: recursive path: meshtasticd diff --git a/.github/workflows/pr_tests.yml b/.github/workflows/pr_tests.yml index c3a964e04..048186538 100644 --- a/.github/workflows/pr_tests.yml +++ b/.github/workflows/pr_tests.yml @@ -40,7 +40,7 @@ jobs: checks: write pull-requests: write steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: submodules: recursive diff --git a/.github/workflows/release_channels.yml b/.github/workflows/release_channels.yml index 4e5a48dfe..f21b13ee1 100644 --- a/.github/workflows/release_channels.yml +++ b/.github/workflows/release_channels.yml @@ -60,7 +60,7 @@ jobs: shell: bash steps: - name: Checkout - uses: actions/checkout@v5 + uses: actions/checkout@v6 with: # Always use master branch for version bumps ref: master diff --git a/.github/workflows/sec_sast_semgrep_cron.yml b/.github/workflows/sec_sast_semgrep_cron.yml index dfb828bf6..d044f9038 100644 --- a/.github/workflows/sec_sast_semgrep_cron.yml +++ b/.github/workflows/sec_sast_semgrep_cron.yml @@ -21,7 +21,7 @@ jobs: steps: # step 1 - name: clone application source code - uses: actions/checkout@v5 + uses: actions/checkout@v6 # step 2 - name: full scan diff --git a/.github/workflows/sec_sast_semgrep_pull.yml b/.github/workflows/sec_sast_semgrep_pull.yml index e93b2ae8b..e9b4108a1 100644 --- a/.github/workflows/sec_sast_semgrep_pull.yml +++ b/.github/workflows/sec_sast_semgrep_pull.yml @@ -13,7 +13,7 @@ jobs: steps: # step 1 - name: clone application source code - uses: actions/checkout@v5 + uses: actions/checkout@v6 with: fetch-depth: 0 diff --git a/.github/workflows/test_native.yml b/.github/workflows/test_native.yml index 591d52bd0..a2328022e 100644 --- a/.github/workflows/test_native.yml +++ b/.github/workflows/test_native.yml @@ -14,7 +14,7 @@ jobs: name: Native Simulator Tests runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} @@ -70,7 +70,7 @@ jobs: name: Native PlatformIO Tests runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} @@ -127,7 +127,7 @@ jobs: - platformio-tests if: always() steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1ec435512..4a97853e2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,7 +20,7 @@ jobs: runs-on: test-runner steps: - name: Checkout code - uses: actions/checkout@v5 + uses: actions/checkout@v6 # - uses: actions/setup-python@v5 # with: diff --git a/.github/workflows/trunk_annotate_pr.yml b/.github/workflows/trunk_annotate_pr.yml index 23dcf8d09..59ab25c28 100644 --- a/.github/workflows/trunk_annotate_pr.yml +++ b/.github/workflows/trunk_annotate_pr.yml @@ -18,7 +18,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Trunk Check uses: trunk-io/trunk-action@v1 diff --git a/.github/workflows/trunk_check.yml b/.github/workflows/trunk_check.yml index 41731d491..874374fe0 100644 --- a/.github/workflows/trunk_check.yml +++ b/.github/workflows/trunk_check.yml @@ -16,7 +16,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Trunk Check uses: trunk-io/trunk-action@v1 diff --git a/.github/workflows/trunk_format_pr.yml b/.github/workflows/trunk_format_pr.yml index 51082fc5f..8fa0cc1eb 100644 --- a/.github/workflows/trunk_format_pr.yml +++ b/.github/workflows/trunk_format_pr.yml @@ -15,7 +15,7 @@ jobs: pull-requests: write steps: - name: Checkout repository - uses: actions/checkout@v5 + uses: actions/checkout@v6 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} diff --git a/.github/workflows/update_protobufs.yml b/.github/workflows/update_protobufs.yml index c06e06b0a..af0557fda 100644 --- a/.github/workflows/update_protobufs.yml +++ b/.github/workflows/update_protobufs.yml @@ -11,7 +11,7 @@ jobs: pull-requests: write steps: - name: Checkout code - uses: actions/checkout@v5 + uses: actions/checkout@v6 with: submodules: true From 14463043bd3c4d01f79ea7d5c70d1279ae22ef15 Mon Sep 17 00:00:00 2001 From: Avi0n <14863961+Avi0n@users.noreply.github.com> Date: Sat, 22 Nov 2025 10:03:47 -0800 Subject: [PATCH 4/9] Add WisMesh Tag OCV array (#8646) * Add WisMesh Tag OCV array * Update 10% to 3650 --------- Co-authored-by: Jonathan Bennett --- src/power.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/power.h b/src/power.h index 8fc7c8f45..84efbeb9e 100644 --- a/src/power.h +++ b/src/power.h @@ -36,6 +36,8 @@ #define OCV_ARRAY 4200, 3986, 3922, 3812, 3734, 3645, 3527, 3420, 3281, 3087, 2786 #elif defined(R1_NEO) #define OCV_ARRAY 4330, 4292, 4254, 4216, 4178, 4140, 4102, 4064, 4026, 3988, 3950 +#elif defined(WISMESH_TAG) +#define OCV_ARRAY 4240, 4112, 4029, 3970, 3906, 3846, 3824, 3802, 3776, 3650, 3072 #else // LiIon #define OCV_ARRAY 4190, 4050, 3990, 3890, 3800, 3720, 3630, 3530, 3420, 3300, 3100 #endif From f4e260e0f1dc45b08d25827deb53b50f24d907e7 Mon Sep 17 00:00:00 2001 From: simon-muzi Date: Sat, 22 Nov 2025 14:54:10 -0500 Subject: [PATCH 5/9] R1 Neo - Added OCV_ARRAY from measured discharge curve testing + update ADC multiplier (#8716) * Added OCV_ARRAY from measured discharge curve testing and update ADC multiplier The ADC resistor divider ratio is 0.6 -> multiplier should be 1/0.6 ~=1.667 We data logged a full discharge curve at constant 100mA draw over 15hours to get a realistic voltage curve for battery SoC measurements. * Remove power.h in favor of variant.h --------- Co-authored-by: Jason P Co-authored-by: Jonathan Bennett --- src/power.h | 2 -- variants/nrf52840/r1-neo/variant.h | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/power.h b/src/power.h index 84efbeb9e..3f28dedb2 100644 --- a/src/power.h +++ b/src/power.h @@ -34,8 +34,6 @@ #define OCV_ARRAY 4200, 3876, 3826, 3763, 3713, 3660, 3573, 3485, 3422, 3359, 3300 #elif defined(SEEED_SOLAR_NODE) #define OCV_ARRAY 4200, 3986, 3922, 3812, 3734, 3645, 3527, 3420, 3281, 3087, 2786 -#elif defined(R1_NEO) -#define OCV_ARRAY 4330, 4292, 4254, 4216, 4178, 4140, 4102, 4064, 4026, 3988, 3950 #elif defined(WISMESH_TAG) #define OCV_ARRAY 4240, 4112, 4029, 3970, 3906, 3846, 3824, 3802, 3776, 3650, 3072 #else // LiIon diff --git a/variants/nrf52840/r1-neo/variant.h b/variants/nrf52840/r1-neo/variant.h index 901e993e3..ef975433a 100644 --- a/variants/nrf52840/r1-neo/variant.h +++ b/variants/nrf52840/r1-neo/variant.h @@ -132,7 +132,8 @@ static const uint8_t SCK = PIN_SPI_SCK; #undef AREF_VOLTAGE #define AREF_VOLTAGE 3.0 #define VBAT_AR_INTERNAL AR_INTERNAL_3_0 -#define ADC_MULTIPLIER 1.73 +#define ADC_MULTIPLIER 1.667 +#define OCV_ARRAY 4200, 4020, 4000, 3940, 3870, 3820, 3750, 3630, 3550, 3450, 3100 #define HAS_RTC 1 From b18794e98da1f346e0290747ca97744a79632d20 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Sat, 22 Nov 2025 13:54:24 -0600 Subject: [PATCH 6/9] Log error if startReceive fails in LR11x0Interface (#8718) --- src/mesh/LR11x0Interface.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mesh/LR11x0Interface.cpp b/src/mesh/LR11x0Interface.cpp index 3831a384d..af6dd92e9 100644 --- a/src/mesh/LR11x0Interface.cpp +++ b/src/mesh/LR11x0Interface.cpp @@ -244,6 +244,8 @@ template void LR11x0Interface::startReceive() // We use a 16 bit preamble so this should save some power by letting radio sit in standby mostly. int err = lora.startReceive(RADIOLIB_LR11X0_RX_TIMEOUT_INF, MESHTASTIC_RADIOLIB_IRQ_RX_FLAGS, RADIOLIB_IRQ_RX_DEFAULT_MASK, 0); + if (err) + LOG_ERROR("StartReceive error: %d", err); assert(err == RADIOLIB_ERR_NONE); RadioLibInterface::startReceive(); @@ -304,4 +306,4 @@ template bool LR11x0Interface::sleep() return true; } -#endif \ No newline at end of file +#endif From 1bfa9ed4c4d166e3141a392dc601aa10b5a917e0 Mon Sep 17 00:00:00 2001 From: simon-muzi Date: Sat, 22 Nov 2025 17:35:10 -0500 Subject: [PATCH 7/9] Tweak OCV_ARRAY 100% voltage to take into account charger hysteresis and voltage sag after charge (#8720) Measured voltage of fully charged battery after a few minutes of rest --- variants/nrf52840/r1-neo/variant.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variants/nrf52840/r1-neo/variant.h b/variants/nrf52840/r1-neo/variant.h index ef975433a..b1d96ebd0 100644 --- a/variants/nrf52840/r1-neo/variant.h +++ b/variants/nrf52840/r1-neo/variant.h @@ -133,7 +133,7 @@ static const uint8_t SCK = PIN_SPI_SCK; #define AREF_VOLTAGE 3.0 #define VBAT_AR_INTERNAL AR_INTERNAL_3_0 #define ADC_MULTIPLIER 1.667 -#define OCV_ARRAY 4200, 4020, 4000, 3940, 3870, 3820, 3750, 3630, 3550, 3450, 3100 +#define OCV_ARRAY 4120, 4020, 4000, 3940, 3870, 3820, 3750, 3630, 3550, 3450, 3100 #define HAS_RTC 1 From ed4a798c60f8d25e9f7037d69b4b001f6b1a6d81 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Mon, 24 Nov 2025 16:35:54 -0600 Subject: [PATCH 8/9] Thinknode M3 support against master (#8630) * Add variant_shutdown() as a week function in main-nrf52.cpp * Add Status LED module * Add Thinknode M3 support * Catch case of BLE disabled * Update src/modules/StatusLEDModule.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/modules/StatusLEDModule.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update variants/nrf52840/ELECROW-ThinkNode-M3/rfswitch.h Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Remove unused pin * M3 pairing LED only active for 30 seconds after state change * Thinknode M3 shutdown work --------- Co-authored-by: Ben Meadors Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- boards/ThinkNode-M3.json | 53 ++++++++ src/configuration.h | 7 + src/modules/Modules.cpp | 6 + src/modules/SerialModule.cpp | 9 +- src/modules/StatusLEDModule.cpp | 94 ++++++++++++++ src/modules/StatusLEDModule.h | 44 +++++++ src/modules/Telemetry/Sensor/AHT10.cpp | 2 +- src/modules/Telemetry/Sensor/AHT10.h | 4 + src/platform/nrf52/architecture.h | 4 + src/platform/nrf52/main-nrf52.cpp | 6 + .../ELECROW-ThinkNode-M3/platformio.ini | 17 +++ .../nrf52840/ELECROW-ThinkNode-M3/rfswitch.h | 15 +++ .../nrf52840/ELECROW-ThinkNode-M3/variant.cpp | 93 +++++++++++++ .../nrf52840/ELECROW-ThinkNode-M3/variant.h | 122 ++++++++++++++++++ 14 files changed, 471 insertions(+), 5 deletions(-) create mode 100644 boards/ThinkNode-M3.json create mode 100644 src/modules/StatusLEDModule.cpp create mode 100644 src/modules/StatusLEDModule.h create mode 100644 variants/nrf52840/ELECROW-ThinkNode-M3/platformio.ini create mode 100644 variants/nrf52840/ELECROW-ThinkNode-M3/rfswitch.h create mode 100644 variants/nrf52840/ELECROW-ThinkNode-M3/variant.cpp create mode 100644 variants/nrf52840/ELECROW-ThinkNode-M3/variant.h diff --git a/boards/ThinkNode-M3.json b/boards/ThinkNode-M3.json new file mode 100644 index 000000000..ff21e046a --- /dev/null +++ b/boards/ThinkNode-M3.json @@ -0,0 +1,53 @@ +{ + "build": { + "arduino": { + "ldscript": "nrf52840_s140_v6.ld" + }, + "core": "nRF5", + "cpu": "cortex-m4", + "extra_flags": "-DNRF52840_XXAA", + "f_cpu": "64000000L", + "hwids": [ + ["0x239A", "0x4405"], + ["0x239A", "0x0029"], + ["0x239A", "0x002A"] + ], + "usb_product": "elecrow_eink", + "mcu": "nrf52840", + "variant": "ELECROW-ThinkNode-M3", + "variants_dir": "variants", + "bsp": { + "name": "adafruit" + }, + "softdevice": { + "sd_flags": "-DS140", + "sd_name": "s140", + "sd_version": "6.1.1", + "sd_fwid": "0x00B6" + }, + "bootloader": { + "settings_addr": "0xFF000" + } + }, + "connectivity": ["bluetooth"], + "debug": { + "jlink_device": "nRF52840_xxAA", + "onboard_tools": ["jlink"], + "svd_path": "nrf52840.svd", + "openocd_target": "nrf52840-mdk-rs" + }, + "frameworks": ["arduino"], + "name": "elecrow nrf", + "upload": { + "maximum_ram_size": 248832, + "maximum_size": 815104, + "speed": 115200, + "protocol": "nrfutil", + "protocols": ["jlink", "nrfjprog", "nrfutil", "stlink"], + "use_1200bps_touch": true, + "require_upload_port": true, + "wait_for_upload_port": true + }, + "url": "", + "vendor": "ELECROW" +} diff --git a/src/configuration.h b/src/configuration.h index 8ec3b2211..d37269995 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -396,6 +396,13 @@ along with this program. If not, see . #define HAS_RGB_LED #endif +#ifndef LED_STATE_OFF +#define LED_STATE_OFF 0 +#endif +#ifndef LED_STATE_ON +#define LED_STATE_ON 1 +#endif + // default mapping of pins #if defined(PIN_BUTTON2) && !defined(CANCEL_BUTTON_PIN) #define ALT_BUTTON_PIN PIN_BUTTON2 diff --git a/src/modules/Modules.cpp b/src/modules/Modules.cpp index e477574dd..9e4401e05 100644 --- a/src/modules/Modules.cpp +++ b/src/modules/Modules.cpp @@ -13,6 +13,8 @@ #include "input/TrackballInterruptImpl1.h" #endif +#include "modules/StatusLEDModule.h" + #if !MESHTASTIC_EXCLUDE_I2C #include "input/cardKbI2cImpl.h" #endif @@ -119,6 +121,10 @@ void setupModules() buzzerFeedbackThread = new BuzzerFeedbackThread(); } #endif +#if defined(LED_CHARGE) || defined(LED_PAIRING) + statusLEDModule = new StatusLEDModule(); +#endif + #if !MESHTASTIC_EXCLUDE_ADMIN adminModule = new AdminModule(); #endif diff --git a/src/modules/SerialModule.cpp b/src/modules/SerialModule.cpp index 575e9fa96..d04daf594 100644 --- a/src/modules/SerialModule.cpp +++ b/src/modules/SerialModule.cpp @@ -64,7 +64,7 @@ SerialModule *serialModule; SerialModuleRadio *serialModuleRadio; #if defined(TTGO_T_ECHO) || defined(CANARYONE) || defined(MESHLINK) || defined(ELECROW_ThinkNode_M1) || \ - defined(ELECROW_ThinkNode_M5) || defined(HELTEC_MESH_SOLAR) || defined(T_ECHO_LITE) + defined(ELECROW_ThinkNode_M5) || defined(HELTEC_MESH_SOLAR) || defined(T_ECHO_LITE) || defined(ELECROW_ThinkNode_M3) SerialModule::SerialModule() : StreamAPI(&Serial), concurrency::OSThread("Serial") { api_type = TYPE_SERIAL; @@ -204,7 +204,7 @@ int32_t SerialModule::runOnce() Serial.setTimeout(moduleConfig.serial.timeout > 0 ? moduleConfig.serial.timeout : TIMEOUT); } #elif !defined(TTGO_T_ECHO) && !defined(T_ECHO_LITE) && !defined(CANARYONE) && !defined(MESHLINK) && \ - !defined(ELECROW_ThinkNode_M1) && !defined(ELECROW_ThinkNode_M5) + !defined(ELECROW_ThinkNode_M1) && !defined(ELECROW_ThinkNode_M3) && !defined(ELECROW_ThinkNode_M5) if (moduleConfig.serial.rxd && moduleConfig.serial.txd) { #ifdef ARCH_RP2040 Serial2.setFIFOSize(RX_BUFFER); @@ -261,7 +261,7 @@ int32_t SerialModule::runOnce() } #if !defined(TTGO_T_ECHO) && !defined(T_ECHO_LITE) && !defined(CANARYONE) && !defined(MESHLINK) && \ - !defined(ELECROW_ThinkNode_M1) && !defined(ELECROW_ThinkNode_M5) + !defined(ELECROW_ThinkNode_M1) && !defined(ELECROW_ThinkNode_M3) && !defined(ELECROW_ThinkNode_M5) else if ((moduleConfig.serial.mode == meshtastic_ModuleConfig_SerialConfig_Serial_Mode_WS85)) { processWXSerial(); @@ -536,7 +536,8 @@ ParsedLine parseLine(const char *line) void SerialModule::processWXSerial() { #if !defined(TTGO_T_ECHO) && !defined(T_ECHO_LITE) && !defined(CANARYONE) && !defined(CONFIG_IDF_TARGET_ESP32C6) && \ - !defined(MESHLINK) && !defined(ELECROW_ThinkNode_M1) && !defined(ELECROW_ThinkNode_M5) && !defined(ARCH_STM32WL) + !defined(MESHLINK) && !defined(ELECROW_ThinkNode_M1) && !defined(ELECROW_ThinkNode_M3) && !defined(ELECROW_ThinkNode_M5) && \ + !defined(ARCH_STM32WL) static unsigned int lastAveraged = 0; static unsigned int averageIntervalMillis = 300000; // 5 minutes hard coded. static double dir_sum_sin = 0; diff --git a/src/modules/StatusLEDModule.cpp b/src/modules/StatusLEDModule.cpp new file mode 100644 index 000000000..fc9ed310e --- /dev/null +++ b/src/modules/StatusLEDModule.cpp @@ -0,0 +1,94 @@ +#include "StatusLEDModule.h" +#include "MeshService.h" +#include "configuration.h" +#include + +/* +StatusLEDModule manages the device's status LEDs, updating their states based on power and Bluetooth status. +It reflects charging, charged, discharging, and Bluetooth connection states using the appropriate LEDs. +*/ +StatusLEDModule *statusLEDModule; + +StatusLEDModule::StatusLEDModule() : concurrency::OSThread("StatusLEDModule") +{ + bluetoothStatusObserver.observe(&bluetoothStatus->onNewStatus); + powerStatusObserver.observe(&powerStatus->onNewStatus); +} + +int StatusLEDModule::handleStatusUpdate(const meshtastic::Status *arg) +{ + switch (arg->getStatusType()) { + case STATUS_TYPE_POWER: { + meshtastic::PowerStatus *powerStatus = (meshtastic::PowerStatus *)arg; + if (powerStatus->getHasUSB()) { + power_state = charging; + if (powerStatus->getBatteryChargePercent() >= 100) { + power_state = charged; + } + } else { + power_state = discharging; + } + break; + } + case STATUS_TYPE_BLUETOOTH: { + meshtastic::BluetoothStatus *bluetoothStatus = (meshtastic::BluetoothStatus *)arg; + switch (bluetoothStatus->getConnectionState()) { + case meshtastic::BluetoothStatus::ConnectionState::DISCONNECTED: { + ble_state = unpaired; + PAIRING_LED_starttime = millis(); + break; + } + case meshtastic::BluetoothStatus::ConnectionState::PAIRING: { + ble_state = pairing; + PAIRING_LED_starttime = millis(); + break; + } + case meshtastic::BluetoothStatus::ConnectionState::CONNECTED: { + ble_state = connected; + PAIRING_LED_starttime = millis(); + break; + } + } + + break; + } + } + return 0; +}; + +int32_t StatusLEDModule::runOnce() +{ + + if (power_state == charging) { + CHARGE_LED_state = !CHARGE_LED_state; + } else if (power_state == charged) { + CHARGE_LED_state = LED_STATE_ON; + } else { + CHARGE_LED_state = LED_STATE_OFF; + } + + if (!config.bluetooth.enabled || PAIRING_LED_starttime + 30 * 1000 < millis()) { + PAIRING_LED_state = LED_STATE_OFF; + } else if (ble_state == unpaired) { + if (slowTrack) { + PAIRING_LED_state = !PAIRING_LED_state; + slowTrack = false; + } else { + slowTrack = true; + } + } else if (ble_state == pairing) { + PAIRING_LED_state = !PAIRING_LED_state; + } else { + PAIRING_LED_state = LED_STATE_ON; + } + +#ifdef LED_CHARGE + digitalWrite(LED_CHARGE, CHARGE_LED_state); +#endif + // digitalWrite(green_LED_PIN, LED_STATE_OFF); +#ifdef LED_PAIRING + digitalWrite(LED_PAIRING, PAIRING_LED_state); +#endif + + return (my_interval); +} diff --git a/src/modules/StatusLEDModule.h b/src/modules/StatusLEDModule.h new file mode 100644 index 000000000..d9e3a4f33 --- /dev/null +++ b/src/modules/StatusLEDModule.h @@ -0,0 +1,44 @@ +#pragma once + +#include "BluetoothStatus.h" +#include "MeshModule.h" +#include "PowerStatus.h" +#include "concurrency/OSThread.h" +#include "configuration.h" +#include +#include + +class StatusLEDModule : private concurrency::OSThread +{ + bool slowTrack = false; + + public: + StatusLEDModule(); + + int handleStatusUpdate(const meshtastic::Status *); + + protected: + unsigned int my_interval = 1000; // interval in millisconds + virtual int32_t runOnce() override; + + CallbackObserver bluetoothStatusObserver = + CallbackObserver(this, &StatusLEDModule::handleStatusUpdate); + CallbackObserver powerStatusObserver = + CallbackObserver(this, &StatusLEDModule::handleStatusUpdate); + + private: + bool CHARGE_LED_state = LED_STATE_OFF; + bool PAIRING_LED_state = LED_STATE_OFF; + + uint32_t PAIRING_LED_starttime = 0; + + enum PowerState { discharging, charging, charged }; + + PowerState power_state = discharging; + + enum BLEState { unpaired, pairing, connected }; + + BLEState ble_state = unpaired; +}; + +extern StatusLEDModule *statusLEDModule; diff --git a/src/modules/Telemetry/Sensor/AHT10.cpp b/src/modules/Telemetry/Sensor/AHT10.cpp index 52fdc05c0..c38fd2a92 100644 --- a/src/modules/Telemetry/Sensor/AHT10.cpp +++ b/src/modules/Telemetry/Sensor/AHT10.cpp @@ -35,7 +35,7 @@ bool AHT10Sensor::getMetrics(meshtastic_Telemetry *measurement) // prefer other sensors like bmp280, bmp3xx if (!measurement->variant.environment_metrics.has_temperature) { measurement->variant.environment_metrics.has_temperature = true; - measurement->variant.environment_metrics.temperature = temp.temperature; + measurement->variant.environment_metrics.temperature = temp.temperature + AHT10_TEMP_OFFSET; } if (!measurement->variant.environment_metrics.has_relative_humidity) { diff --git a/src/modules/Telemetry/Sensor/AHT10.h b/src/modules/Telemetry/Sensor/AHT10.h index ab3f5806c..f85f04aa0 100644 --- a/src/modules/Telemetry/Sensor/AHT10.h +++ b/src/modules/Telemetry/Sensor/AHT10.h @@ -6,6 +6,10 @@ #if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && __has_include() +#ifndef AHT10_TEMP_OFFSET +#define AHT10_TEMP_OFFSET 0 +#endif + #include "../mesh/generated/meshtastic/telemetry.pb.h" #include "TelemetrySensor.h" #include diff --git a/src/platform/nrf52/architecture.h b/src/platform/nrf52/architecture.h index 6ddb41b16..75ca7567e 100644 --- a/src/platform/nrf52/architecture.h +++ b/src/platform/nrf52/architecture.h @@ -68,6 +68,8 @@ #define HW_VENDOR meshtastic_HardwareModel_T_ECHO_LITE #elif defined(ELECROW_ThinkNode_M1) #define HW_VENDOR meshtastic_HardwareModel_THINKNODE_M1 +#elif defined(ELECROW_ThinkNode_M3) +#define HW_VENDOR meshtastic_HardwareModel_THINKNODE_M3 #elif defined(ELECROW_ThinkNode_M6) #define HW_VENDOR meshtastic_HardwareModel_THINKNODE_M6 #elif defined(NANO_G2_ULTRA) @@ -130,7 +132,9 @@ #endif +#ifdef PIN_LED1 #define LED_PIN PIN_LED1 // LED1 on nrf52840-DK +#endif #ifdef PIN_BUTTON1 #define BUTTON_PIN PIN_BUTTON1 diff --git a/src/platform/nrf52/main-nrf52.cpp b/src/platform/nrf52/main-nrf52.cpp index 827863f33..c03cc4454 100644 --- a/src/platform/nrf52/main-nrf52.cpp +++ b/src/platform/nrf52/main-nrf52.cpp @@ -30,6 +30,11 @@ #include "BQ25713.h" #endif +// Weak empty variant initialization function. +// May be redefined by variant files. +void variant_shutdown() __attribute__((weak)); +void variant_shutdown() {} + static nrfx_wdt_t nrfx_wdt = NRFX_WDT_INSTANCE(0); static nrfx_wdt_channel_id nrfx_wdt_channel_id_nrf52_main; @@ -391,6 +396,7 @@ void cpuDeepSleep(uint32_t msecToWake) NRF_GPIO->DIRCLR = (1 << pin); } #endif + variant_shutdown(); // Sleepy trackers or sensors can low power "sleep" // Don't enter this if we're sleeping portMAX_DELAY, since that's a shutdown event diff --git a/variants/nrf52840/ELECROW-ThinkNode-M3/platformio.ini b/variants/nrf52840/ELECROW-ThinkNode-M3/platformio.ini new file mode 100644 index 000000000..958e48e48 --- /dev/null +++ b/variants/nrf52840/ELECROW-ThinkNode-M3/platformio.ini @@ -0,0 +1,17 @@ +[env:thinknode_m3] +extends = nrf52840_base +board = ThinkNode-M3 +board_check = true +debug_tool = jlink +build_flags = + ${nrf52840_base.build_flags} + -Ivariants/nrf52840/ELECROW-ThinkNode-M3 + -DELECROW_ThinkNode_M3 + -DGPS_POWER_TOGGLE + -D CONFIG_NFCT_PINS_AS_GPIOS=1 + -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" +build_src_filter = ${nrf52_base.build_src_filter} +<../variants/nrf52840/ELECROW-ThinkNode-M3> +lib_deps = + ${nrf52840_base.lib_deps} + khoih-prog/nRF52_PWM@^1.0.1 + lewisxhe/PCF8563_Library@^1.0.1 diff --git a/variants/nrf52840/ELECROW-ThinkNode-M3/rfswitch.h b/variants/nrf52840/ELECROW-ThinkNode-M3/rfswitch.h new file mode 100644 index 000000000..77ae9ef73 --- /dev/null +++ b/variants/nrf52840/ELECROW-ThinkNode-M3/rfswitch.h @@ -0,0 +1,15 @@ +#include "RadioLib.h" +#include "nrf.h" + +// set RF switch configuration for ELECROW ThinkNode M3 +// ELECROW ThinkNode M3 uses DIO5 and DIO6 for RF switching + +static const uint32_t rfswitch_dio_pins[] = {RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC}; + +static const Module::RfSwitchMode_t rfswitch_table[] = { + // mode DIO5 DIO6 + {LR11x0::MODE_STBY, {LOW, LOW}}, {LR11x0::MODE_RX, {HIGH, LOW}}, + {LR11x0::MODE_TX, {HIGH, HIGH}}, {LR11x0::MODE_TX_HP, {LOW, HIGH}}, + {LR11x0::MODE_TX_HF, {LOW, LOW}}, {LR11x0::MODE_GNSS, {LOW, LOW}}, + {LR11x0::MODE_WIFI, {LOW, LOW}}, END_OF_MODE_TABLE, +}; diff --git a/variants/nrf52840/ELECROW-ThinkNode-M3/variant.cpp b/variants/nrf52840/ELECROW-ThinkNode-M3/variant.cpp new file mode 100644 index 000000000..b7a7b7342 --- /dev/null +++ b/variants/nrf52840/ELECROW-ThinkNode-M3/variant.cpp @@ -0,0 +1,93 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "variant.h" +#include "meshUtils.h" +#include "nrf.h" +#include "wiring_constants.h" +#include "wiring_digital.h" + +const uint32_t g_ADigitalPinMap[] = { + // P0 + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + + // P1 + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47}; + +void initVariant() +{ + pinMode(KEY_POWER, OUTPUT); + digitalWrite(KEY_POWER, HIGH); + pinMode(RGB_POWER, OUTPUT); + digitalWrite(RGB_POWER, HIGH); + pinMode(green_LED_PIN, OUTPUT); + digitalWrite(green_LED_PIN, LED_STATE_OFF); + pinMode(LED_BLUE, OUTPUT); + pinMode(PIN_POWER_USB, INPUT); + pinMode(PIN_POWER_DONE, INPUT); + pinMode(PIN_POWER_CHRG, INPUT); + pinMode(BUTTON_PIN, INPUT_PULLUP); + pinMode(EEPROM_POWER, OUTPUT); + digitalWrite(EEPROM_POWER, HIGH); + pinMode(PIN_EN1, OUTPUT); + digitalWrite(PIN_EN1, HIGH); + pinMode(PIN_EN2, OUTPUT); + digitalWrite(PIN_EN2, HIGH); + pinMode(ACC_POWER, OUTPUT); + digitalWrite(ACC_POWER, LOW); + pinMode(DHT_POWER, OUTPUT); + digitalWrite(DHT_POWER, HIGH); + pinMode(Battery_POWER, OUTPUT); + digitalWrite(Battery_POWER, HIGH); + pinMode(GPS_POWER, OUTPUT); + digitalWrite(GPS_POWER, HIGH); +} + +// called from main-nrf52.cpp during the cpuDeepSleep() function +void variant_shutdown() +{ + digitalWrite(EEPROM_POWER, LOW); + digitalWrite(KEY_POWER, LOW); + + for (int pin = 0; pin < 48; pin++) { + if (pin == PIN_POWER_USB || pin == BUTTON_PIN || pin == PIN_EN1 || pin == PIN_EN2 || pin == DHT_POWER || + pin == ACC_POWER || pin == Battery_POWER || pin == GPS_POWER || pin == LR1110_SPI_MISO_PIN || + pin == LR1110_SPI_MOSI_PIN || pin == LR1110_SPI_SCK_PIN || pin == LR1110_SPI_NSS_PIN || pin == LR1110_BUSY_PIN || + pin == LR1110_NRESET_PIN || pin == LR1110_IRQ_PIN || pin == GPS_TX_PIN || pin == GPS_RX_PIN || pin == green_LED_PIN || + pin == red_LED_PIN || pin == LED_BLUE) { + continue; + } + pinMode(pin, OUTPUT); + digitalWrite(pin, LOW); + if (pin >= 32) { + NRF_P1->DIRCLR = (1 << (pin - 32)); + } else { + NRF_GPIO->DIRCLR = (1 << pin); + } + } + + nrf_gpio_cfg_input(BUTTON_PIN, NRF_GPIO_PIN_PULLUP); // Configure the pin to be woken up as an input + nrf_gpio_pin_sense_t sense1 = NRF_GPIO_PIN_SENSE_LOW; + nrf_gpio_cfg_sense_set(BUTTON_PIN, sense1); + + nrf_gpio_cfg_input(PIN_POWER_USB, NRF_GPIO_PIN_PULLDOWN); // Configure the pin to be woken up as an input + nrf_gpio_pin_sense_t sense2 = NRF_GPIO_PIN_SENSE_HIGH; + nrf_gpio_cfg_sense_set(PIN_POWER_USB, sense2); +} \ No newline at end of file diff --git a/variants/nrf52840/ELECROW-ThinkNode-M3/variant.h b/variants/nrf52840/ELECROW-ThinkNode-M3/variant.h new file mode 100644 index 000000000..cf940172b --- /dev/null +++ b/variants/nrf52840/ELECROW-ThinkNode-M3/variant.h @@ -0,0 +1,122 @@ +/* + Copyright (c) 2014-2015 Arduino LLC. All right reserved. + Copyright (c) 2016 Sandeep Mistry All right reserved. + Copyright (c) 2018, Adafruit Industries (adafruit.com) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef _VARIANT_ELECROW_EINK_V1_0_ +#define _VARIANT_ELECROW_EINK_V1_0_ + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +#include "WVariant.h" + +#define VARIANT_MCK (64000000ul) +#define USE_LFXO // Board uses 32khz crystal for LF + +#define ELECROW_ThinkNode_M3 1 +// Number of pins defined in PinDescription array +#define PINS_COUNT (48) +#define NUM_DIGITAL_PINS (48) +#define NUM_ANALOG_INPUTS (1) +#define NUM_ANALOG_OUTPUTS (0) + +// Power Pin +#define NRF_APM +#define GPS_POWER 14 +#define PIN_POWER_USB 31 +#define EXT_PWR_DETECT PIN_POWER_USB +#define PIN_POWER_DONE 24 +#define PIN_POWER_CHRG 32 +#define KEY_POWER 16 +#define ACC_POWER 2 +#define DHT_POWER 3 +#define Battery_POWER 17 +#define RGB_POWER 29 +#define EEPROM_POWER 7 + +// LED +#define red_LED_PIN 33 +#define LED_POWER red_LED_PIN +#define LED_CHARGE LED_POWER // Signals the Status LED Module to handle this LED +#define green_LED_PIN 35 +#define LED_BLUE 37 +#define LED_PAIRING LED_BLUE // Signals the Status LED Module to handle this LED + +#define LED_BUILTIN -1 +#define LED_STATE_ON LOW +#define LED_STATE_OFF HIGH + +// BUZZER +#define PIN_BUZZER 23 +#define PIN_EN1 36 +#define PIN_EN2 34 +/*Wire Interfaces*/ +#define WIRE_INTERFACES_COUNT 1 +#define PIN_WIRE_SDA 26 +#define PIN_WIRE_SCL 27 + +// Temperature correction for sensor +#define AHT10_TEMP_OFFSET -5.0 + +/*GPS pins*/ +#define HAS_GPS 1 +#define GPS_BAUDRATE 9600 +#define PIN_GPS_RESET 25 +#define PIN_GPS_STANDBY 21 +#define GPS_TX_PIN 20 +#define GPS_RX_PIN 22 +#define GPS_THREAD_INTERVAL 50 +#define PIN_SERIAL1_RX GPS_TX_PIN +#define PIN_SERIAL1_TX GPS_RX_PIN +// Button +#define BUTTON_PIN 12 +#define BUTTON_PIN_ALT (0 + 12) +// Battery +#define BATTERY_PIN 5 +#define BATTERY_SENSE_RESOLUTION_BITS 12 +#define BATTERY_SENSE_RESOLUTION 4096.0 +#undef AREF_VOLTAGE +#define AREF_VOLTAGE 2.4 +#define VBAT_AR_INTERNAL AR_INTERNAL_2_4 +#define ADC_MULTIPLIER (1.75) +/*SPI Interfaces*/ +#define SPI_INTERFACES_COUNT 1 +#define PIN_SPI_MISO (32 + 15) // P1.15 47 +#define PIN_SPI_MOSI (32 + 14) // P1.14 46 +#define PIN_SPI_SCK (32 + 13) // P1.13 45 +#define PIN_SPI_NSS (32 + 12) // P1.12 44 +/*LORA Interfaces*/ +#define USE_LR1110 +#define LR1110_IRQ_PIN 40 +#define LR1110_NRESET_PIN 42 +#define LR1110_BUSY_PIN 43 +#define LR1110_SPI_NSS_PIN 44 +#define LR1110_SPI_SCK_PIN 45 +#define LR1110_SPI_MOSI_PIN 46 +#define LR1110_SPI_MISO_PIN 47 +#define LR11X0_DIO3_TCXO_VOLTAGE 3.3 +#define LR11X0_DIO_AS_RF_SWITCH + +// PCF8563 RTC Module +#define PCF8563_RTC 0x51 + +#ifdef __cplusplus +} +#endif + +#endif From 0336331411f864ef0ea81c5ada391b56cd06101b Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Tue, 25 Nov 2025 02:29:35 -0600 Subject: [PATCH 9/9] Use LED_CHARGE and LED_PAIRING for M6 led control (#8742) --- variants/nrf52840/ELECROW-ThinkNode-M6/variant.cpp | 8 ++++---- variants/nrf52840/ELECROW-ThinkNode-M6/variant.h | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/variants/nrf52840/ELECROW-ThinkNode-M6/variant.cpp b/variants/nrf52840/ELECROW-ThinkNode-M6/variant.cpp index b84079e66..09872d409 100644 --- a/variants/nrf52840/ELECROW-ThinkNode-M6/variant.cpp +++ b/variants/nrf52840/ELECROW-ThinkNode-M6/variant.cpp @@ -32,11 +32,11 @@ const uint32_t g_ADigitalPinMap[] = { void initVariant() { - pinMode(PIN_LED1, OUTPUT); - ledOff(PIN_LED1); + pinMode(LED_CHARGE, OUTPUT); + ledOff(LED_CHARGE); - pinMode(PIN_LED2, OUTPUT); - ledOff(PIN_LED2); + pinMode(LED_PAIRING, OUTPUT); + ledOff(LED_PAIRING); pinMode(VDD_FLASH_EN, OUTPUT); digitalWrite(VDD_FLASH_EN, HIGH); diff --git a/variants/nrf52840/ELECROW-ThinkNode-M6/variant.h b/variants/nrf52840/ELECROW-ThinkNode-M6/variant.h index 98c654df2..5e543b21f 100644 --- a/variants/nrf52840/ELECROW-ThinkNode-M6/variant.h +++ b/variants/nrf52840/ELECROW-ThinkNode-M6/variant.h @@ -40,10 +40,11 @@ extern "C" { #define NUM_ANALOG_OUTPUTS (0) // LEDs -#define PIN_LED1 (12) -#define PIN_LED2 (7) -#define LED_BUILTIN PIN_LED1 -#define LED_BLUE PIN_LED2 +#define LED_BUILTIN -1 +#define LED_BLUE -1 +#define LED_CHARGE (12) +#define LED_PAIRING (7) + #define LED_STATE_ON 1 // USB power detection