bristlemouth / bm_protocol

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

fix: drop rbr readings that arrive after timer fires #159

Closed towynlin closed 2 months ago

towynlin commented 2 months ago

One task catches RBR pressure readings and enqueues them. Another task reads from the queue and adds the readings to the difference signal buffer. When the "end of sample" timer fires, we already don't enqueue any more readings. However, the question is how we should deal with the ones that might be sitting in the queue, not yet processed.

After discussion, we agreed that it's better to drop these on the floor rather than add them to the beginning of the next sample, since the difference signal buffer may already have been cleared.

The tradeoff here is that we may drop valid readings at the tail end of a sample before calculating the difference signal and sending messages to Spotter. That's acceptable.