bristlemouth / bm_protocol

Primary Bristlemouth firmware repository
https://www.bristlemouth.org/
Apache License 2.0
12 stars 8 forks source link

Sc 196635/report builder #31

Closed victorsowa12 closed 11 months ago

victorsowa12 commented 12 months ago

The report builder gathers samples from the aanderaa controller, creates a corresponding element in a linked list, adds the data to element in an array of length samplesPerReport. Then after we reach samplesPerReport samples, the report builder searches through its linked list and looks for elements that correspond to the "max topology" during the "report period". The report builder tracks "max topology" by checking the network CRC periodically and updating the CRC and topology it will use to build the report if its current topology is smaller than the new one. If there is an element in the linked list that is also in the topology the array of samples will be copied into the report. If there is no element in the linked list then the report gets filled with NAN's. Once the entire report is built the report builder publishes the Cbor array to spotter via bm_serial. After publishing the report, the linked list is cleared and all of the network tracking (crc, "max topology") are cleared in the report builders local context to be re-created during the next report window.

Example data being sent out of Spotter:

343a0f3044f7c28,27.582,30.562,2.127,1.307,26.942
Current bit offset: 166
Rounded bit offset: 168
New bit offset: 552
10858606t [MS] [INFO] Added message(id: 102 len: 69) to queue MS_Q_LEGACY: (1)!
Message: E6 00 00 00 00 D5 AA A0 12 1D 16 D8 00 06 D4 00 01 00 F5 F8 80 81 81 85 FB 40 3B 95 04 54 EB 05 8F FB 40 3E 8F C7 68 0E 66 E9 FB 40 01 04 33 45 30 3F 0E FB 3F F4 E9 1E 81 A3 DA 3F FB 40 3A F1 2B A1 6E 7A 31
Submitted sensor data to sat/cell queue

the CBOR buffer is 81 81 85 FB 40 3B 95 04 54 EB 05 8F FB 40 3E 8F C7 68 0E 66 E9 FB 40 01 04 33 45 30 3F 0E FB 3F F4 E9 1E 81 A3 DA 3F FB 40 3A F1 2B A1 6E 7A 31 and can be decoded on cbor.me to:

[[[27.582097346666668, 30.56163645125972, 2.127050915274487, 1.3069138588013087, 26.942072]]]
from the printout on spotter the means/stdevs:
343a0f3044f7c28, 27.582, 30.562, 2.127, 1.307, 26.942