toblum / McLighting

The ESP8266 based multi-client lighting gadget
MIT License
1.05k stars 291 forks source link

Battery power #405

Open iansexton opened 5 years ago

iansexton commented 5 years ago

Hi, I really like McLighting! Great work guys :)

I have a project which is powered from a LiPo battery. I intend to monitor the battery voltage using the ESP8266 ADC - if it drops too low everything will shut down, LEDs off & ESP8266 into deep sleep. I'm wondering what is the most elegant way to do this? My initial thoughts are to use a 'Ticker' to periodically check the voltage but I thought I'd ask if there was a better way. Maybe you could add a 'user ticker' utility? I can imagine a lot of cases where this might be useful, eg read a temperature probe & change the display colour/pattern. I imagine it could be difficult to provide something that would please everyone, however my immediate need is simple. Ian

toblum commented 5 years ago

Hi @iansexton, using a ticker or just checking millis() in the main loop to check is a time interval has elapsed is also the first thing that comes into my mind. As the Ticker library is already in place, why don't you go with it? Doing something more generic is not easy as it would need custom code anyway.

Regards Tobias

iansexton commented 5 years ago

@toblum Thx, we're thinking the same way - Your coding is great, easy to slip in my mods. Cheers Ian

iansexton commented 5 years ago

Hi @Tobias Glad you agree :) I have a habit of doing things the hard way first & realising afterwards...

Cheers Ian

On Fri, May 31, 2019 at 8:49 PM Tobias Blum notifications@github.com wrote:

Hi @iansexton https://github.com/iansexton, using a ticker or just checking millis() in the main loop to check is a time interval has elapsed is also the first thing that comes into my mind. As the Ticker library is already in place, why don't you go with it? Doing something more generic is not easy as it would need custom code anyway.

Regards Tobias

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/toblum/McLighting/issues/405?email_source=notifications&email_token=AISXEEJPEH6CELEJ75NEQ3DPYF6NPA5CNFSM4HRGHBW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWWGXAY#issuecomment-497838979, or mute the thread https://github.com/notifications/unsubscribe-auth/AISXEENP2JOK5SSSTJRUL6TPYF6NPANCNFSM4HRGHBWQ .