Repository navigation
feat: batch BLE readings into one message per send window - #13
Merged
Merged
Conversation
The unit now sends the readings from each scan window together on
invigil/node/{node}/ble instead of one message per advertisement:
{ "ts": <end of scan window>, "node": "N1", "readings": [...] }.
Each reading keeps its own ts, addr, rssi and mfr with the same rules.
A message is split when it would go over 1400 bytes, so it fits one
TCP segment and several fit lwIP's MQTT output buffer at once.
- docs/contract.md: new ble format, field tables and the size limit.
- server/contract.py: validates batches, adds ble_rows() and pack_ble().
- Logger still writes one ble.csv row per reading, same columns.
- Fake publisher, dashboard demo source and store use the new format.
- Launcher status counts BLE readings, not messages.
- Firmware 0.2.0: batch builder in portable/payload.c, ring peek_at,
MQTT output buffer 8 KB, ble_msgs in the summary line, host tests
and the contract check cover the size limit.
- Results of a 10-minute crowded-room run in docs/results/.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The unit now sends the BLE readings from each scan window together instead of one MQTT message per advertisement:
Each reading keeps exactly the old fields and rules. A message is split when it would go over 1400 bytes: with the MQTT header and topic that fits one TCP segment (MSS 1460), lwIP's MQTT output buffer (now 8 KB) holds several at once, and Mosquitto, paho and the browser client have no limit near it. The worst-case reading is 69 bytes, so a message carries at least 19 readings. Details in
docs/contract.md.Changes
docs/contract.md: newbleformat, field tables, the size limit and why.server/contract.py: validates batches and each reading; addsble_rows(),pack_ble()andencode().ble.csvrow per reading, same columns, latency from each reading's ownts.ml/: onlysynth.py, which validated single readings.portable/payload.c,ble_ring_peek_at(),MQTT_OUTPUT_RINGBUF_SIZE8192,ble_msgsin the summary line. Host tests cover the format, the off-contract checks and the size limit, andcheck_contract.pychecks the samples against the limit.Hardware result
10 minutes in the same crowded room as the send-window-500 run (
docs/results/2026-10-27-ble-batches/report.md):tx_in_scanThe nRF24L01 still fails its self-check (wiring), so the run has no spectrum.
Tests
python -m pytest: 139 passed.pico2_wwith no warnings. The host C tests were only compile-checked locally (no PC compiler on this laptop); CI runs them.