floodnet-nyc / flood-sensor

This repo contains source code, manuals, and additional information needed to build, deploy, and maintain a Flood Sensor
https://www.floodnet.nyc
Other
45 stars 12 forks source link

first reading in loop wrong #26

Closed rictolcrow closed 2 years ago

rictolcrow commented 2 years ago

https://github.com/floodsense/floodsense_sensor/blob/0db0efaf8eafbbec5f2b7618c8418ed5ae939a7c/src/maxbotix.cpp#L73

The first reading in loop is always in error making the mean functions useless. No effect on median and mode.

Suggested fix is to flip lines 74 and 75 and possibly lines 70 and 71. I tried it and it fixes the bug

Praneethsvch commented 2 years ago

ac3409e0aa656bf015f5f783dcf4253ea90fa8b5 first reading bug is fixed by adding an extra read. Bug is due to the 'R's in the startup serial output; "MAXBOTIX CORPORATION INC"