michaeljolley / aviary

Aviary is a soil moisture management system that runs within a Particle mesh network consisting of an Argon and n Xenons.
MIT License
4 stars 0 forks source link

Put the baby-bird to sleep when not actively sensing/watering to save battery power #16

Open michaeljolley opened 5 years ago

michaeljolley commented 5 years ago

Current Situation

The baby-bird is using delay(2000) in the loop method to check and send the moisture level every two seconds. However, we won't need to check this often and don't need to use battery power when not actively sensing or watering.

Goals

bsatrom commented 5 years ago

For the first item, you can use the System.sleep api. https://docs.particle.io/reference/device-os/firmware/argon/#sleep-sleep-. The third overload allows you to set a wakeUpPin, edgeTrigger and time in seconds, and I'd use that even if you don't want to trigger on anything other than time.

If you wanted to use it, you could use it to wake up on a pin that's monitoring battery charge (voltage) a rain sensor, or something else.

michaeljolley commented 5 years ago

You beat me to it. I actually had those docs saved from yesterday and forgot to include in the issue description. Gotta add the other tasks with their doc pages as well. Still got my browser open from the stream with doc links