Closed SUPScientist closed 6 months ago
One possible solution is to use a while(1)
loop to force the device to hang if SD card stuff isn't working.
A better but harder solution would be to separate sampling from the DATALOG_STATE and if SD doesn't work, it could still try PUBLISH_STATE or SLEEP_STATE according to PUBLISHING definition.
Temporary fix here: https://github.com/COAST-Lab/Open-Water-Level/commit/07ea9f39437c375042c1267e6dedeea19c17c7c1. This just forces code to hang, which is not a real solution, but hopefully minimizes data operations while sensor not working.
Update: it doesn't actually hang in while loop. It just moves right on past it. while(1)
statement is a complete waste.
https://github.com/COAST-Lab/Open-Water-Level/blob/c1495ac5710489bb421941316cdee38f318033c5/Firmware/SLR_Boron_Maxbotix_MB7092_cm/src/SLR_Boron_Maxbotix_MB7092_cm.ino#L129
Update SD logic to prevent hanging. It would hang on while(1)
, contrary to comment above.
Updated in https://github.com/COAST-Lab/Open-Water-Level/commit/0af4f6e1b60785f17403fc15a08bfeb9ed8cfcaf
New logic has it print error but not hang.
If SD stuff fails in these chunks: https://github.com/COAST-Lab/Open-Water-Level/blob/a136a71cb4b3972a8e5b6aeaf3e89f752977792d/Firmware/SLR_Boron_Maxbotix_MB7092_cm/src/SLR_Boron_Maxbotix_MB7092_cm.ino#L126-L136 then the firmware will restart at the top without any sleep. It will therefore stay connected indefinitely by continuously taking a sample and trying to save it to SD card, but likely always failing and therefore restarting the firmware. Never makes it to PUBLISH_STATE nor SLEEP_STATE.