Files
meshcore-tth/examples
tthandClaude Opus 5 85be4a76a6 feat(repeater/ble): runtime conn TX power (blepwr) + negotiated params (bleconn)
Two diagnostic levers for the BLE/LoRa coexistence work, plus a correction to
what the existing tx power call actually does.

Bluefruit.setTxPower(8) is ADVERTISING power only. Bluefruit stores the value
and BLEAdvertising::start() hands it to sd_ble_gap_tx_power_set() with
BLE_GAP_TX_POWER_ROLE_ADV; nothing in the library ever sets the CONN role, so an
established link runs at the SoftDevice default of 0 dBm. The +8 buys discovery
range and nothing else. Confirmed on hardware: `blepwr` reports
"conn tx: 0 dBm, adv tx: 8 dBm".

- RPT_BLE_CONN_TX_POWER (default 0 = unchanged behaviour), applied per
  connection on every 'secured' since the handle is new each time.
- `blepwr [dBm]` sets it at runtime over serial, the BLE console or the mesh
  admin CLI. Runtime rather than a build flag because a dose-response sweep
  needs many points and reflashing the XIAO costs a physical UF2 dance.
- Auto-revert after 5 min (`blepwr <p> hold` opts out). Without it the command
  locks you out of the console you would need to undo it: the value is
  re-applied on every 'secured', at -20 dBm the node's replies stop arriving and
  at -40 dBm a connection cannot be established at all. Hit this on the bench;
  recovery was over USB, and on the mast the only way back would be `reboot`
  over the mesh admin CLI.
- `bleconn` reports the connection parameters actually in force. bleOnSecured()
  only REQUESTS 15-30/60-80 ms and the central may refuse, so without reading
  them back "the pre-fix interval showed no loss either" cannot be told apart
  from "the pre-fix interval was never in force". Latched once a second from
  loop() so it can be read over USB after the central is gone -- reading it over
  the BLE console while connected would collide on the shared command[160].

Measured with these: at a verified 22.50 ms interval, sweeping the connection
tx power from 0 to -20 dBm (RSSI -67..-87 at the central, covering the whole
-75..-90 window the mast sits in) produced zero lost DIRECT forwards, with
tx_timeout and tx_start_fail at zero in every cell.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-03 19:12:04 +02:00
..
2026-06-06 21:09:38 +10:00
2026-06-06 21:09:38 +10:00