gfroerli / firmware

Firmware for the water temperature sensor project
GNU General Public License v3.0
6 stars 1 forks source link

Implement new measurement wire format #82

Closed rnestler closed 3 years ago

rnestler commented 3 years ago

See #79

rnestler commented 3 years ago

I think that API could be improved a bit, I'm not too fond of the mutable integer reference...

Well which API? The internal one of MeasurementValue? Or the public one of MeasurementMessage?

Maybe an Encoder could be created that tracks the bit index internally by using the associated constant of the MeasurementValue trait?

That sounds overly complicated to me to track a single value, but if you propose something concrete I may change my opinion :slightly_smiling_face:

dbrgn commented 3 years ago

The internal API.

Here are three commits that would (in my view) improve the API. If you agree, you can apply them with git am <filename>.

https://gist.github.com/dbrgn/c576858d0138fd8ba406cf92937324c8