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:
tthandClaude Fable 5 committed 2026-07-15 11:53:48 +02:00
1 parent ce907bbe4a
commit 91f827cede
4 files changed
+37 -20

No files matched your search

+7 -3
View File
@@ -199,11 +199,11 @@ class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
void putHeardNode(const mesh::Identity& id, uint32_t advert_timestamp, uint8_t type,
int32_t lat, int32_t lon, const char* name,
int8_t snr, int8_t rssi, const mesh::Packet* pkt);
void formatNodesReply(char* reply, uint16_t offset);
void formatNodesReply(char* reply, int max_len, uint16_t offset);
#endif
#if RXLOG_SIZE
void captureRx(const mesh::Packet* pkt);
void formatRxLogReply(char* reply, uint32_t cursor);
void formatRxLogReply(char* reply, int max_len, uint32_t cursor);
#endif
uint8_t handleLoginReq(const mesh::Identity& sender, const uint8_t* secret, uint32_t sender_timestamp, const uint8_t* data, bool is_flood);
uint8_t handleAnonRegionsReq(const mesh::Identity& sender, uint32_t sender_timestamp, const uint8_t* data);
@@ -308,7 +308,11 @@ public:
void saveIdentity(const mesh::LocalIdentity& new_id) override;
void clearStats() override;
void handleCommand(uint32_t sender_timestamp, char* command, char* reply);
// reply_max = usable reply capacity. Default 150 keeps the mesh admin CLI reply
// inside one LoRa packet; the local console (USB/BLE, big buffer) passes more so
// the paged analyzer replies (nodes/rxlog) can use big pages. Explicit parameter
// on purpose — a forged sender_timestamp must never be able to grow the reply.
void handleCommand(uint32_t sender_timestamp, char* command, char* reply, int reply_max = 150);
void loop();
#if defined(WITH_BRIDGE)