-
Notifications
You must be signed in to change notification settings - Fork 49
Description
@PaulZC , while BLE is our #1 want right now (any updates?), #100 made me think of a similar feature. Right now you can use pin 11 to go into slow logging mode (longer sleeps). It would be nice if you could exit low power mode if the status of pin 11 changes while asleep. It would even improve your example sunlight monitor by waking sooner when there's light.
For example, we might have logging set to every 5 minutes when PIN11 is low and 60 minutes when PIN11 is high. The OLA would sleep for 5 minutes at a time, but only wake up enough to check pin11's status (no . If it was still unchanged, and less than 60 minutes had passed since the last sample, it would go back to sleep. In theory you could set the slow sleep period to infinite.
As far as implementation, I think rather than set a longer sleep time with checkSleepOnFastSlowPin(), you'd need to split wakeFromSleep() into two levels. The first level would be just enough functionality to check some critical status items, like pin 11. You'd need to calculate time since last sample, and compare it to settings.slowLoggingIntervalSeconds. Hopefully this brief change from fully asleep to partially asleep wouldn't have major power consumption ramifications so long as the fast sampling interval isn't too fast.
This intermediate sleep level might also be useful for waking on IMU interrupts as was requested in #100, or just IMU changes. I could see "wake if any IMU orientation value has changed more than X% since OLA started sleeping" could be useful for some people.