thinknode_m9: pick GPS enable polarity from the board revision

The GPS enable pin (GPIO11) is active-LOW on the original ThinkNode-M9 but
active-HIGH on the newer revision (keyboard controller at 0x6D, e.g. Elecrow's
Meshtastic SKU LMM15409D2). Driven LOW on those units the GPS never gets a
fix: on one unit, same spot, 0 satellites with EN active-LOW vs 15 with
active-HIGH, and 34 after 20 minutes outdoors with the GPS toggled off and on
again from the UI. Meshtastic's ELECROW-ThinkNode-M9 variant makes the same
split, keyed on the same keyboard address (m9Version > 1 ? HIGH : LOW), and
Elecrow engineers have confirmed the split.

WadaNmeaLocationProvider: keep the enable level in a member that defaults to
the compile-time GPS_EN_ACTIVE, add setEnActive() to override it at runtime
(re-driving the pin so a running GPS stays on), and an optional
setPostEnableHook() run at the end of begin(). Every other board is unaffected.

thinknode_m9: m9KeyboardAddr() and a one-shot found-callback on the keyboard
driver; target.cpp uses it, when the controller is at 0x6D, to call
gps.setEnActive(true) and to register a GPIO10 wake pulse (50 ms, HIGH 5 ms,
LOW, 50 ms) after enabling, as Elecrow engineers confirmed. Any other address
keeps the existing default (LOW, no pulse), so the 0x6C path is unchanged; it
is not tested here, no 0x6C unit was available.

Depends on the keyboard 0x6D probe change.

Signed-off-by: Pratik Patel <Pratik@MakerNova.io>
This commit is contained in:
Pratik Patel authored and Kaj Schittecat committed 2026-10-13 08:22:55 +02:00
1 parent 9cd10dfe30
commit 8dbb349fc6
5 files changed
+74 -5

No files matched your search

+8 -1
View File
@@ -27,6 +27,8 @@ static volatile uint8_t s_ring[16];
static volatile uint8_t s_head = 0;
static volatile uint8_t s_tail = 0;
static bool s_inited = false;
static void (*s_found_cb)(uint8_t) = nullptr;
static bool s_found_cb_done = false;
static TwoWire* s_bus = nullptr; // set once the controller answers
static uint8_t s_address = PIN_KB_ADDR;
static uint32_t s_last_probe_ms = 0;
@@ -59,10 +61,15 @@ static void kbTryFindBus() {
const uint8_t addresses[] = {PIN_KB_ADDR, M9_KB_V11_ADDR};
for (uint8_t address : addresses) {
if (kbProbe(Wire1, "Wire1 (20/21)", address) ||
kbProbe(Wire, "Wire (7/6)", address)) return;
kbProbe(Wire, "Wire (7/6)", address)) break;
}
if (s_bus && s_found_cb && !s_found_cb_done) { s_found_cb_done = true; s_found_cb(s_address); }
}
uint8_t m9KeyboardAddr() { return s_bus ? s_address : 0; }
void m9KeyboardSetFoundCallback(void (*cb)(uint8_t addr)) { s_found_cb = cb; s_found_cb_done = false; }
void m9KeyboardBegin() {
Wire1.begin(PIN_KB_SDA, PIN_KB_SCL);
// The controller is its own MCU (ESP32-S2) on the ALWAYS-ON 3V3 rail via R3