Skip to content

feat: Support Elecrow ThinkNode M9 - #10908

Merged
mverch67 merged 96 commits into
developfrom
thinknode-m9
Aug 17, 2026
Merged

mverch67 merged 96 commits into
developfrom
thinknode-m9

Conversation

@mverch67

@mverch67 mverch67 commented Jul 6, 2026 •

Copy link
Copy Markdown
Collaborator
IMG_20260706_220149_824~2

🤝 Attestations

  • I have tested that my proposed changes behave as described.
  • I have tested that my proposed changes do not cause any obvious regressions on the following devices:
    • Heltec (Lora32) V3
    • LilyGo T-Deck
    • LilyGo T-Beam
    • RAK WisBlock 4631
    • Seeed Studio T-1000E tracker card
    • Other (please specify below)

Summary by CodeRabbit

  • New Features
    • Added support for the ELECROW ThinkNode M9 hardware variant, including TFT display, GPS/LoRa setup, battery monitoring, and STC8H companion keypad controls.
    • Expanded I2C device detection for additional sensors (STC8HKB, QMC6309, QMI8658) to improve compass/heading updates using magnetometer sampling and tilt compensation.
    • Added optional on-screen raw compass diagnostics when compass debug is enabled.
  • Bug Fixes
    • Improved light-sleep wake handling to correctly detect key-press wakeups (and avoid misclassifying non-press GPIO wakes), with configurable GPIO wake polarity.

@coderabbitai

coderabbitai Bot commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds ELECROW ThinkNode M9 board support, an STC8H I2C keyboard driver, QMI8658/QMC6309 motion sensors, expanded I2C detection, compass diagnostics, GPIO wake handling, build configuration, and related GPS, locking, and dependency updates.

Changes

ThinkNode M9 integration

Layer / File(s) Summary
Board foundation and defaults
variants/esp32s3/ELECROW-ThinkNode-M9/*, src/mesh/NodeDB.cpp
Adds board pins, peripherals, RF switching, lifecycle hooks, battery settings, display configuration, PlatformIO environments, and TFT-related defaults.
I2C device detection
src/configuration.h, src/detect/*
Adds STC8HKB and QMC6309 device types, addresses, candidate lists, and reserved-address probing.
STC8H keyboard and wake flow
src/input/*, src/main.cpp, src/PowerFSM.cpp, src/sleep.cpp
Implements keyboard I2C access, key-to-input mapping, interrupt handling, light-sleep integration, and GPIO wake polarity selection.
Motion sensor pipeline and diagnostics
src/motion/*, src/graphics/draw/UIRenderer.cpp
Adds QMI8658 and QMC6309 drivers, compass sample publication/access, heading computation, calibration, and optional raw-sensor display output.
Supporting updates
platformio.ini, src/concurrency/*, src/gps/GPS.cpp, variants/esp32s3/t-deck/platformio.ini
Adds timed locking, a GNSS probe mapping, a dependency pin update, and a linker-script configuration hook.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant I2CScanner
  participant STC8HKeyboard
  participant KbI2cBase
  participant PowerFSM
  I2CScanner->>STC8HKeyboard: detect address TSTC8_KB_ADDR
  KbI2cBase->>STC8HKeyboard: initialize selected I2C bus
  STC8HKeyboard->>KbI2cBase: read key value
  STC8HKeyboard->>PowerFSM: signal GPIO wake
  PowerFSM->>KbI2cBase: emit press event
Loading

Possibly related PRs

Suggested labels: enhancement, needs-review

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description includes an image and one completed attestation, but it lacks a written change summary and leaves regression testing incomplete. Add a concise change summary and document regression testing for the listed devices, or explain why those tests were not performed.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely identifies the main change: adding support for the Elecrow ThinkNode M9.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch thinknode-m9

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

Firmware Size Report

23 targets | vs develop: 21 increased, 1 decreased, net +464,992 (+454.1 KB)

Target Flash vs develop RAM RAM vs develop
elecrow-adv-35-tft 3,458,464 📈 +41,840 (+40.9 KB) 95,040 n/a
t-deck-tft 3,851,808 📈 +41,136 (+40.2 KB) 108,416 n/a
picow 1,273,844 📈 +28,964 (+28.3 KB) 152,512 n/a
pico2w 1,248,384 📈 +27,868 (+27.2 KB) 158,992 n/a
pico 810,168 📈 +27,480 (+26.8 KB) 85,880 n/a
Show 18 more target(s)
Target Flash vs develop RAM RAM vs develop
rak11310 832,896 📈 +27,472 (+26.8 KB) 86,324 n/a
seeed_xiao_rp2040 808,360 📈 +27,456 (+26.8 KB) 85,872 n/a
pico2 796,328 📈 +26,552 (+25.9 KB) 92,380 n/a
seeed_xiao_rp2350 794,488 📈 +26,552 (+25.9 KB) 92,372 n/a
heltec-vision-master-e213-inkhud 2,249,328 📈 +21,968 (+21.5 KB) 92,408 n/a
heltec-ht62-esp32c3-sx1262 2,152,544 📈 +17,552 (+17.1 KB) 112,004 n/a
seeed-xiao-s3 2,293,648 📈 +17,504 (+17.1 KB) 102,064 n/a
heltec-v3 2,281,424 📈 +17,344 (+16.9 KB) 130,224 n/a
station-g3 2,283,664 📈 +17,312 (+16.9 KB) 101,856 n/a
station-g2 2,283,648 📈 +17,296 (+16.9 KB) 101,856 n/a
rak3312 2,289,504 📈 +17,264 (+16.9 KB) 101,944 n/a
rak11200 1,877,824 📈 +17,216 (+16.8 KB) 87,060 n/a
t-eth-elite 2,507,904 📈 +16,416 (+16.0 KB) 103,076 n/a
heltec-v4 2,293,424 📈 +16,128 (+15.8 KB) 101,120 n/a
tlora-c6 2,384,208 📈 +15,904 (+15.5 KB) 102,764 n/a
rak3172 182,824 📉 -3,472 (-3.4 KB) 25,000 n/a
wio-e5 239,868 📈 +1,240 (+1.2 KB) 26,640 n/a
meshnology_w10 2,467,536 136,220 n/a

Size budgets

Env Metric Measured Budget Used
rak4631 RAM (.data+.bss) n/a 113,000 n/a
rak4631 flash n/a 786,000 n/a

Budgets live in bin/ram_budgets.json and are raised deliberately in the PR that needs the headroom - never automatically.


Updated for 2ebde7d

@github-actions

github-actions Bot commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

⚡ Try this PR in the Web Flasher

Flash this PR in the Web Flasher

firmware commit boards expires

Warning

This is an automated, unreviewed CI test build. Back up your device configuration
before flashing, and only flash devices you are able to recover.

Supported boards built by this PR (31)
Device Board Platform
Crowpanel Adv 3.5 TFT elecrow-adv-35-tft esp32-s3
Heltec HT62 heltec-ht62-esp32c3-sx1262 esp32-c3
Heltec Mesh Node 096 heltec-mesh-node-t096 nrf52840
Heltec Mesh Node T1 heltec-mesh-node-t1 nrf52840
Heltec Mesh Node T114 heltec-mesh-node-t114 nrf52840
Heltec V3 heltec-v3 esp32-s3
Heltec V4 heltec-v4 esp32-s3
Meshnology W10 meshnology_w10 esp32-s3
Meshnology W12 meshnology_w12 esp32-s3
Raspberry Pi Pico pico rp2040
Raspberry Pi Pico W picow rp2040
RAK WisMesh Pocket V3 rak_wismesh_pocket nrf52840
RAK WisMesh Pod rak_wismesh_pod nrf52840
RAK WisMesh Repeater Mini V2 rak_wismesh_repeater_mini nrf52840
RAK WisMesh Tag rak_wismeshtag nrf52840
RAK WisBlock 11200 rak11200 esp32
RAK WisBlock 11310 rak11310 rp2040
RAK3312 rak3312 esp32-s3
RAK WisBlock 4631 rak4631 nrf52840
Seeed SenseCAP Mesh-Tracker-X1 seeed_mesh_tracker_X1 nrf52840
Seeed Wio Tracker L1 seeed_wio_tracker_L1 nrf52840
Seeed Xiao NRF52840 Kit seeed_xiao_nrf52840_kit nrf52840
Seeed Xiao ESP32-S3 seeed-xiao-s3 esp32-s3
Station G2 station-g2 esp32-s3
Station G3 station-g3 esp32-s3
LILYGO T-Deck t-deck-tft esp32-s3
LILYGO T-Echo t-echo nrf52840
LILYGO T-Echo Plus t-echo-plus nrf52840
LILYGO T-Impulse Plus t-impulse-plus nrf52840
LilyGo T3-C6 tlora-c6 esp32-c6
Seeed SenseCAP T1000-E tracker-t1000-e nrf52840

Build artifacts expire on 2026-08-28. Updated for 3691565.

@mverch67 mverch67 added the hardware-support Hardware related: new devices or modules, problems specific to hardware label Jul 7, 2026
Co-authored-by: mverch67 <71137295+mverch67@users.noreply.github.com>
@mverch67
mverch67 enabled auto-merge August 17, 2026 17:08
@mverch67
mverch67 added this pull request to the merge queue Aug 17, 2026
Merged via the queue into develop with commit c308d0a Aug 17, 2026
60 checks passed
thebentern added a commit that referenced this pull request Aug 19, 2026
The M9's variant.h defines ST7789_CS, so TFTDisplay.cpp compiles its
ST7789 LGFX branch, which reads SPI_FREQUENCY for the panel write clock
(SPI_READ_FREQUENCY, its pair, is already in variant.h). The flag was only
set in the -tft env, so `build (thinknode_m9, esp32s3)` has failed on
develop since the board landed in #10908:

  src/graphics/TFTDisplay.cpp:504:30: error: 'SPI_FREQUENCY' was not
  declared in this scope; did you mean 'SD_SPI_FREQUENCY'?

Move the flag up into thinknode_m9_base, keeping the 75 MHz the -tft env
already used for the same panel and matching the SD card's 75 MHz on the
bus they share. The -tft env inherits the base flags, so device-ui's
LGFX_GENERIC.h - which falls back to 20 MHz when the macro is absent -
still sees the identical value.
@coderabbitai coderabbitai Bot mentioned this pull request Aug 20, 2026
@caveman99
caveman99 deleted the thinknode-m9 branch August 26, 2026 19:08
papadopouloskyriakos pushed a commit to meshsat/meshsat-firmware that referenced this pull request Oct 18, 2026
* thinknode-m9 variant

* move lora to SPI1 device

* enable SDcard

* use HSPI

* BaseUI tft -> HSPI

* buzzer, webdav lib

* fix build issues

* M9 default to MUI, no BT, short ringtone

* add keyboard long-press config

* update variant

* add ThingNode-M9 GPS string

* GPS 115200 baud

* Basic BaseUI support

* Fixup power detection

* Compass and KB fixes for M9

* add timed Lock::lock()

* add SD card

* point device-ui to thinknode m9 draft branch

* trunk fmt

* fix FusionCompass

* Fix t-deck-tft linker arg list overflow in CI

* SDcard/lora fix: SPI1 must not be declared twice in arduino 3.x -> reuse SPI1 defined in FSCommon.cpp

* update battery parameters

* reinit SD card when updating; fix PSRAM size

* update lib versions

* fix wakeup on key press (KB_INT)

* fix default nag_timeout for TFT/MUI devices with buzzer

* increase PSRAM and SD freq

* trunk fmt

* update lovyanGFX 1.2.26

* update device-ui commit reference

* fix screen definition

* remove DONE; maybe a keyword or other used identifier

* fixed CI error nag_timeout

* fix prepareSleep initialization

* trunk fmt

* reduce SD SPI frequency

* update device-ui

* fix SDcard issue

* stage

* fix device-ui commit reference

* fix device-ui commit

* update device-ui commit (fixed keyboard lag)

* fix QMI8658

* trunk fmt

* update .ini meta information, align SD freq

* fix device-ui reference to target (ready to merge)

* device-ui for all other targets

* make the rabbit happy

* trunk fmt

* fixed lock screen

* fix compile error

* SPI lock timeout

* apply device-ui fix

* revert bad RadioLib commit hash in platformio.ini

Co-authored-by: mverch67 <71137295+mverch67@users.noreply.github.com>

* fix wrong commit hash change

* fix fix commit fix

* I love changing random numbers in random files

---------

Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz>
Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
papadopouloskyriakos pushed a commit to meshsat/meshsat-firmware that referenced this pull request Oct 18, 2026
…stic#11546)

The M9's variant.h defines ST7789_CS, so TFTDisplay.cpp compiles its
ST7789 LGFX branch, which reads SPI_FREQUENCY for the panel write clock
(SPI_READ_FREQUENCY, its pair, is already in variant.h). The flag was only
set in the -tft env, so `build (thinknode_m9, esp32s3)` has failed on
develop since the board landed in meshtastic#10908:

  src/graphics/TFTDisplay.cpp:504:30: error: 'SPI_FREQUENCY' was not
  declared in this scope; did you mean 'SD_SPI_FREQUENCY'?

Move the flag up into thinknode_m9_base, keeping the 75 MHz the -tft env
already used for the same panel and matching the SD card's 75 MHz on the
bus they share. The -tft env inherits the base flags, so device-ui's
LGFX_GENERIC.h - which falls back to 20 MHz when the macro is absent -
still sees the identical value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hardware-support Hardware related: new devices or modules, problems specific to hardware

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants