endail / hx711

Raspberry Pi HX711 C++ Library
MIT License
18 stars 10 forks source link

Typedef for raw values #41

Closed endail closed 2 years ago

endail commented 2 years ago

https://github.com/endail/hx711/blob/de87c5b54282c7e86e214a7ec04d64beda106735/include/HX711.h#L91

https://github.com/endail/hx711/blob/de87c5b54282c7e86e214a7ec04d64beda106735/src/HX711.cpp#L65-L67

https://github.com/endail/hx711/blob/de87c5b54282c7e86e214a7ec04d64beda106735/src/HX711.cpp#L121

https://github.com/endail/hx711/blob/de87c5b54282c7e86e214a7ec04d64beda106735/src/HX711.cpp#L314

HX711 uses 24 bits, but in code it's unclear why a 32 bit int is used.

Suggest typedef'ing std::int32_t (or one of the other std ints) with HX711::rawval_t or similar.

endail commented 2 years ago

Renamed to val_t.

https://github.com/endail/hx711/commit/9335a38887740bb1d6a61b0435b2cfb7b719f663#diff-55eb0f8f68ee330d4ffa3f69b670fb0e83e5d1d3a5ac4c5f094dd9bc72501c38R43

fixes #41