COAST-Lab / Open-Water-Level

An open-source, low-cost, DIY ultrasonic water level sensor
MIT License
9 stars 4 forks source link

Make single data buffer for serial, SD, and publish writing #7

Closed SUPScientist closed 11 months ago

SUPScientist commented 11 months ago

Code currently repeats versions of what it intends to serial print, SD log, or publish. Create a single data buffer and serial print, SD log, and/or publish that buffer as desired.

E.g., current code shows https://github.com/COAST-Lab/Open-Water-Level/blob/20a093c28c221f682e9bd088dc9954c6d17718ae/Firmware/SLR_Boron_Maxbotix_MB7092_cm/src/SLR_Boron_Maxbotix_MB7092_cm.ino#L106-L110

followed by https://github.com/COAST-Lab/Open-Water-Level/blob/20a093c28c221f682e9bd088dc9954c6d17718ae/Firmware/SLR_Boron_Maxbotix_MB7092_cm/src/SLR_Boron_Maxbotix_MB7092_cm.ino#L127-L132

and https://github.com/COAST-Lab/Open-Water-Level/blob/20a093c28c221f682e9bd088dc9954c6d17718ae/Firmware/SLR_Boron_Maxbotix_MB7092_cm/src/SLR_Boron_Maxbotix_MB7092_cm.ino#L157-L162

Fill this final buffer earlier in code and use it throughout.

SUPScientist commented 11 months ago

Attempted fix in https://github.com/COAST-Lab/Open-Water-Level/commit/b6b4c36b9efedac537f859ba2a237e7fdca54750. Compiled but untested.

SUPScientist commented 11 months ago

Tested and works as intended. Closing.