bristlemouth / bm_protocol

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

diff signal lib #137

Closed russelldeguzman closed 2 months ago

russelldeguzman commented 2 months ago

A library for computing a difference signal of N samples.

evanShap commented 2 months ago

@russelldeguzman This looks right to me, but we'll need to make a few additions (or can handle one of them in higher scope):

  1. When encoding to buffer, we should preserve or return the "residual" to the caller - which is simply r[0] in your code. This is required to reconstruct the full decoded info. We may or may not preserve the residuals of our encoding depending on what Isabel comes up with.

  2. Technically the difference signal should simply be shorter than the input series by 1 - rather than setting the first element to 0. Implementing it that way may minimize confusion - especially if we end up going more than 1 order up in encoding.

  3. We'll need to enforce the 500ms reading gap check when adding to the buffer, but can do that outside the scope of this class?

russelldeguzman commented 2 months ago

We'll need to enforce the 500ms reading gap check when adding to the buffer, but can do that outside the scope of this class?

@evanShap We can do this in the controller outside of this class. I'll make a follow-up PR to address your first two bullets!