thebedroomlaboratory / BrewMonitor

The Arduino and Cloud-based homebrewing controller
Other
16 stars 6 forks source link

Replace long delays with millis check #11

Closed matsstaff closed 9 years ago

matsstaff commented 9 years ago

In main loop, it would be better to use the standard if(last-millis() > xxx) instead of long delays.

catchmartin commented 9 years ago

Will do, thanks for the feedback!

This is a very early version of the code/circuit though. I think in the final version it's more likely we'll handle this in hardware using something like the TPL5100. Or at least some deep sleeping in the firmware instead of using delay() or clock check.

matsstaff commented 9 years ago

Hi! Absolutely, I understand that. I really think this project is very cool and I'd like to see it even better :) I hope you don't see this as criticism, I really just want to offer some insight that might help. Sleep mode really does not help much, as the Arduino still uses a linear voltage regulator, so power savings will be minimal. But using the millis check, you could potentially free up the MCU to do other stuff as well during the waiting periods.

catchmartin commented 9 years ago

No no, please keep the feedback coming, it's very welcome! Yeah that's a good point, that we're gonna have to run it off power supply anyway, so we'd be much better freeing it up during waiting periods. I like that!

catchmartin commented 9 years ago

Done (126c47cebe8a2ec2aa0c8265d4ecca41ffdaa14c). Arduino sketch still a work in progress though.