Anthony,

I propose to do the debounce on the button itself. The basic idea is to 
delay turning the zone on for 2 seconds. If the button is pushed again, 
then the code cancels the previous timer and start a new one. When the 
time expires, it launches the current zone.

An additional benefit is that you will not activate all the valves all 
the time.

Pascal.

On 10/26/2013 09:00 AM, Anthony Webb wrote:
>
> In server.js:
>
> >
> >       // if we are currently running something
> >       if(running.seconds){
> >           if(running.remaining == 1) running.remaining = 0;
> >           var runtime = running.seconds-running.remaining;
> >  -        // dont log stuff that wasnt running for at least a minute
>
> On the PCB there is a single button that can be used to manually cycle 
> through all the zones. Use case for this is a gardener who fixed a 
> zone and needs to turn it on to verify that it is working. Since it is 
> a single button, they press the button to sequentially cycle through 
> the zones. This runtime is there to debounce those button presses and 
> make sure that if say the user is trying to manually turn on zone 7 
> that we dont have 1 second runtimes in the log for zones 1-6.
>
> Perhaps the debounce should happen in a different spot?
>
> —
> Reply to this email directly or view it on GitHub 
> <https://github.com/anthonywebb/sprinkler/pull/4/files#r7234177>.
>