kivancsikert / ugly-duckling

Firmware for FarmHub devices
0 stars 0 forks source link

Soft start device when battery is mostly depleted #173

Closed lptr closed 1 month ago

lptr commented 1 month ago

When the device depletes its battery completely, it can happen that the next day the solar panels only get a small amount of light. During boot the device uses a lot of energy (connecting to WiFi, closing a left-open valve etc.), which can again deplete the battery. This can lead to a loop of restarts, until the solar input is increased to a level that the device can operate on it alone throughout the boot process.

When this happens, it would be better if the device did not attempt to start up until the battery has charged to a small amount. Let's check battery status upon boot, and put the device to deep sleep for a short while (say, 5 seconds) if the battery level is below, say, 2%.