feat(repeater/analyzer): big console pages + physics-sized tables (rxlog 512, heard 128)
The BLE bridge drain was throttled by three multiplied costs: 150 B pages (~3 rxlog records), 20 B NUS notification chunks, and the bridge waiting for line silence per page. This fixes the firmware half: - handleCommand() takes an explicit reply_max (default 150). The local console (USB/BLE) passes ~1000 B -> ~20 rxlog records / ~7 nodes lines per round trip; the mesh admin CLI keeps 150 so its reply still fits one LoRa packet. Explicit parameter on purpose: a forged sender_timestamp==0 from the mesh path must never be able to grow the reply past its 166 B buffer. - bleWriteAll() chunks by negotiated MTU (247 -> 244 B) instead of fixed 20 B. - Tables sized from channel physics instead of last week's traffic: RXLOG_SIZE 512 = ~2 min of a saturated SF8/62.5k channel (~2-4 frames/s), MAX_HEARD_NODES 128 > distinct nodes heard per neighbour advert period (48 filled in <2 h and churned out real 0-hop neighbours). - Page-sort scratch arrays moved off the loop-task stack into BSS. RAM 17.7% -> 25.3% (59.6 KB / 235 KB). Flashed via BLE DFU 2026-07-15. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ce907bbe4a
commit
91f827cede
4 files changed
+37
-20
No files matched your search
@@ -28,8 +28,13 @@
|
||||
// no flush needed.
|
||||
static void bleWriteAll(const char* s) {
|
||||
size_t n = strlen(s), i = 0; uint32_t stall = 0;
|
||||
// chunk = ATT payload (MTU-3); bridge negotiates MTU 247 -> 244 B chunks.
|
||||
// Fallback 20 B when MTU stayed at the 23 B default (unpaired phone etc.).
|
||||
size_t maxchunk = 20;
|
||||
BLEConnection* conn = Bluefruit.Connection(Bluefruit.connHandle());
|
||||
if (conn && conn->getMtu() > 23) maxchunk = conn->getMtu() - 3;
|
||||
while (i < n && Bluefruit.connected() && stall < 300) { // max ~0.9 s stall → bail
|
||||
size_t chunk = n - i; if (chunk > 20) chunk = 20;
|
||||
size_t chunk = n - i; if (chunk > maxchunk) chunk = maxchunk;
|
||||
size_t w = bleuart.write((const uint8_t*)(s + i), chunk);
|
||||
if (w > 0) { i += w; stall = 0; }
|
||||
else { stall++; delay(3); } // queue full -> wait a moment and retry
|
||||
@@ -342,8 +347,8 @@ void loop() {
|
||||
if (len > 0 && command[len - 1] == '\r') { // received complete line
|
||||
Serial.print('\n');
|
||||
command[len - 1] = 0; // replace newline with C string null terminator
|
||||
char reply[160];
|
||||
the_mesh.handleCommand(0, command, reply); // NOTE: there is no sender_timestamp via serial!
|
||||
static char reply[1032]; // big pages for paged analyzer replies (nodes/rxlog); BSS, ne stack
|
||||
the_mesh.handleCommand(0, command, reply, (int)sizeof(reply) - 32); // NOTE: there is no sender_timestamp via serial!
|
||||
if (reply[0]) {
|
||||
Serial.print(" -> "); Serial.println(reply);
|
||||
#if defined(BLE_PIN_CODE) && defined(NRF52_PLATFORM)
|
||||
|
||||
Reference in new issue
Block a user