ThinkNode M6: enable status LED, button and low-battery shutdown (run UITask)#2837
Open
benskigomez wants to merge 1 commit into
Open
ThinkNode M6: enable status LED, button and low-battery shutdown (run UITask)#2837benskigomez wants to merge 1 commit into
benskigomez wants to merge 1 commit into
Conversation
a85f938 to
dd9f70b
Compare
…utdown) The M6's two LEDs work in the bootloader and on other firmware, but the MeshCore companion builds gave no status indication: the red LED (P0.12) was initialised off and never used, and the blue LED only blinked on LoRa TX. The companion status LED, user-button handling and low-battery auto-shutdown all live in UITask, which is only instantiated when DISPLAY_CLASS is defined. The M6 is screenless, so UITask never ran and none of those worked - including AUTO_SHUTDOWN_MILLIVOLTS, which was set in the env but had no effect. Run UITask headless via NullDisplayDriver, the same way the other screenless boards (t1000-e, RAK WisMesh Tag) do, and define PIN_STATUS_LED. This enables, on both companion_radio_ble and companion_radio_usb: - status LED on the previously-unused red LED (heartbeat, longer blink on unread messages); blue keeps its LoRa-TX function - the user button (navigation + long-press), groundwork for the shutdown request in meshcore-dev#2313 - the already-configured low-battery auto-shutdown (3.3V) Because the M6 is screenless, also hide the Bluetooth toggle page from the button menu (new UI_HIDE_BLUETOOTH_PAGE flag, opt-in, no effect on boards that don't set it). On a screenless node a blind long-press on that page would silently disable BLE with no way to see or undo it; removing it leaves advert / GPS-toggle / hibernate, which are safe. The LED pins/polarity were already correct (RED=12, BLUE=7, active-high), so no hardware-config change is needed. Relates to meshcore-dev#2313.
dd9f70b to
2742f16
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Elecrow ThinkNode M6's two LEDs work in the bootloader and on other firmware, but the MeshCore companion builds give no status indication. The red LED (P0.12) is initialised off and never used again; the blue LED only blinks on LoRa TX.
Cause
The companion status LED, user-button handling, and low-battery auto-shutdown all live in
UITask, which is only instantiated whenDISPLAY_CLASSis defined. The M6 is screenless, soUITasknever ran —PIN_STATUS_LEDwas never set, the button was inert, and even theAUTO_SHUTDOWN_MILLIVOLTS=3300flag already in the env had no effect.Fix
Run
UITaskheadless withNullDisplayDriver, exactly as the other screenless boards (t1000-e, RAK WisMesh Tag) do, and definePIN_STATUS_LED. This enables, on bothcompanion_radio_bleandcompanion_radio_usb:Screenless-safe button menu
Because the M6 has no screen, this also hides the Bluetooth toggle page from the button menu, behind a new opt-in
UI_HIDE_BLUETOOTH_PAGEflag (no effect on boards that don't set it). On a screenless node, a blind long-press on that page would silently disable BLE with no way to see it or undo it. With it hidden, the reachable button actions are send-advert / GPS-toggle / hibernate, which are all safe to trigger blind.The LED pins/polarity were already correct (RED=12, BLUE=7, active-high), so no hardware-config change is needed — only
target.h(useNullDisplayDriver), the two env definitions, and theUI_HIDE_BLUETOOTH_PAGEguards inUITask.cpp.Testing
Built and flashed on a ThinkNode M6: the red LED shows the heartbeat and blinks longer with unread messages; the blue TX blink is unchanged; the Bluetooth page is gone from the menu. Both companion BLE and USB build and run.
Notes
Relates to #2313 (Shutdown for ThinkNode M6) — this makes the user button active, a prerequisite for button-driven shutdown, though it doesn't add a dedicated long-press-shutdown/wakeup mapping itself.