feat(repeater): blink [n] — ask a board to identify itself
A bench of identical XIAOs cannot be told apart. The USB serial number needs a data cable, and boards sharing power rails have none; the BLE MAC is printed nowhere; and ADVERT_NAME is only as trustworthy as the last flash, which is usually the thing being checked. Today two boards in the same breadboard were both advertising "bench-board" -- one of them the board with the burned DIO1, still happily running BLE. `blink 10` flashes an LED ten times (default 6, clamped 1..30), and works from serial, the BLE console and the mesh admin CLI, so it also reaches a node that is already mounted somewhere. Deliberately not the status LED. On XIAO that is LED_BLUE, which Bluefruit drives as its connection indicator -- every BLE node blinks blue the same way, which is why the LED was useless for identification in the first place. Preference order LED_GREEN (XIAO, free) -> LED_WHITE (SenseCap, only ever touched at boot and powerOff) -> LED_BUILTIN, which is last because on SenseCap it is pin 12, the LoRa TX indicator. Variants may define a colour they do not physically have by pointing it at PINS_COUNT (SenseCap does that with LED_RED), so the chain range-checks rather than trusting #ifdef. Driven from loop(), not inline: a blocking burst would stall the mesh for up to ~7 s at the cap and disturb the very LoRa timing this fleet measures. Always finishes dark. Goes through LED_STATE_ON, which is 0 on XIAO and 1 on SenseCap -- hard-coding HIGH would leave half the fleet unlit. Verified on bench-board over the USB console: "blink 10" -> "OK - blinking 10 times", and the build stamps v1.16.0-ttha12965f+. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7c071d1515
commit
29d620e1a6
2 files changed
+104
No files matched your search
@@ -1624,6 +1624,11 @@ void MyMesh::handleCommand(uint32_t sender_timestamp, char *command, char *reply
|
||||
formatPktFeedReply(reply, reply_max, cursor);
|
||||
#endif
|
||||
} else{
|
||||
// CUSTOM (TeTeHacko): `blink [n]` — flash the LED to identify this board.
|
||||
// Outside the BLE guard on purpose: a USB-only build needs it just as much,
|
||||
// since a board with no data cable and no BLE cannot be identified at all.
|
||||
extern bool identHandleCommand(const char* command, char* reply);
|
||||
if (identHandleCommand(command, reply)) return;
|
||||
#if defined(BLE_PIN_CODE) && defined(NRF52_PLATFORM)
|
||||
// CUSTOM (TeTeHacko): `ble on|off|ble` — implemented in main.cpp (BLE console).
|
||||
// Available from serial, the BLE console and remotely via MC (admin remote CLI).
|
||||
|
||||
Reference in new issue
Block a user