Closed SUPScientist closed 11 months ago
This enhancement will require a few steps, I imagine:
Alternatively, there may be a Boron-specific function that allows sleep until a specific time.
This Particle reference (https://docs.particle.io/reference/device-os/api/language-syntax/arithmetic-operators/#-modulo-) may have some useful information for one possible approach. For example, use modulo operator on the current time (decimal minutes??) to determine how long until that modulo would = 0, then sleep for that amount of time.
Starting point: https://community.particle.io/t/boron-lte-waking-up-from-sleep-mode/64050/4. Includes sleep code and hints at function for calculating sleep time. Looks like it's necessary to keep cell modem in standby mode to avoid getting SIM deactivated for "aggressive reconnection" when sleep time is ≤ 10 mins.
Attempted fix, yet to be tested: https://github.com/COAST-Lab/Open-Water-Level/tree/iss1
Prior comment suggests this is an untested solution, but it was tested successfully in a commit that followed.
Code currently uses a 54-minute sleep timer to determine sample frequency. Change from hard-coded 54 minutes to user-defined time interval (e.g., 6 minutes following NOAA standard) and wake up/sample at as close to exact time as possible. E.g., sample at 12:00, 12:06, 12:12, etc.
Relevant chunk:
https://github.com/COAST-Lab/Open-Water-Level/blob/d125831b358b25830306dcf23a7a3b608678d8ff/Firmware/SLR_Boron_Maxbotix_MB7092_cm/src/SLR_Boron_Maxbotix_MB7092_cm.ino#L204-L208