fix(tools/ble_dfu): require the target address; feat: ble_cli.py; feat: silent-by-default repeater
ble_dfu find(): with want_dfu it accepted ANY device whose name contained "DFU" and then took the first one the scan returned. With more than one board in bootloader at the same time that reaches for someone else's hardware. It just did: target CE:72:…:02, connected FE:11:…:C4. Caught only because the log was being read by hand -- a few seconds later START_DFU would have overwritten a different node. The address is now mandatory (MAC or MAC+1, covering both the SCAP_DFU-on-MAC+1 and AdaDFU-on-same-MAC bootloaders), and foreign boards in bootloader are listed as explicitly ignored. ble_cli.py: the BLE console had no tool, so every ad-hoc script re-implemented it and re-learned the same trap: a NUS write carries ATT_MTU-3 bytes and BlueZ will not split it, so at the usual MTU 23 anything over 20 bytes fails with "Failed to initiate write" -- which reads like a dropped link, not "command too long". Commands up to 18 chars work, longer ones fail, deterministically. Chunking is now in one place, with retries and the pairing/single-console caveats documented. simple_repeater: ADVERT_INTERVAL_DEFAULT / FLOOD_ADVERT_INTERVAL_DEFAULT / DISABLE_FWD_DEFAULT, so a node can be built to ship silent. ENABLE_ADVERT_ON_BOOT alone is not enough -- it only suppresses the boot advert, the periodic timer still fires, so an `erase`d node is on the air within two minutes. Found the hard way: a node flashed before this change and then erased spent ~44 s transmitting on the live CZ frequency from a desk. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8c3d7b076d
commit
5333a71927
1 file changed
+19
-2
@@ -1215,8 +1215,25 @@ MyMesh::MyMesh(mesh::MainBoard &board, mesh::Radio &radio, mesh::MillisecondCloc
|
||||
#define PATH_HASH_MODE_DEFAULT 1 // 1 = 2 bytes per hop
|
||||
#endif
|
||||
_prefs.path_hash_mode = PATH_HASH_MODE_DEFAULT;
|
||||
_prefs.advert_interval = 1; // default to 2 minutes for NEW installs
|
||||
_prefs.flood_advert_interval = 47; // 47 hours
|
||||
// CUSTOM (TeTeHacko): overridable so a node can be built to SHIP SILENT.
|
||||
// ENABLE_ADVERT_ON_BOOT only suppresses the advert at boot, not the periodic
|
||||
// timer -- with the upstream defaults an `erase`d node starts advertising
|
||||
// within 2 minutes. For a repeater that is going somewhere unreachable that
|
||||
// is the wrong way round: it must stay quiet until somebody deliberately
|
||||
// turns it on, and a reboot on the mast must not undo that.
|
||||
// Set both to 0 in the deployment envs; 0 = off (CommonCLI.cpp:615-630).
|
||||
#ifndef ADVERT_INTERVAL_DEFAULT
|
||||
#define ADVERT_INTERVAL_DEFAULT 1 // *2 = 2 minutes, upstream default
|
||||
#endif
|
||||
#ifndef FLOOD_ADVERT_INTERVAL_DEFAULT
|
||||
#define FLOOD_ADVERT_INTERVAL_DEFAULT 47 // hours
|
||||
#endif
|
||||
#ifndef DISABLE_FWD_DEFAULT
|
||||
#define DISABLE_FWD_DEFAULT 0 // 0 = repeat on
|
||||
#endif
|
||||
_prefs.advert_interval = ADVERT_INTERVAL_DEFAULT;
|
||||
_prefs.flood_advert_interval = FLOOD_ADVERT_INTERVAL_DEFAULT;
|
||||
_prefs.disable_fwd = DISABLE_FWD_DEFAULT;
|
||||
_prefs.flood_max = 64;
|
||||
_prefs.flood_max_unscoped = 64;
|
||||
_prefs.flood_max_advert = 8;
|
||||
|
||||
Reference in new issue
Block a user