Skip to content

Commit 466ac51

Browse files
committed
Different timer/chrono controls per mainAdjType
1 parent 94a4a83 commit 466ac51

File tree

2 files changed

+38
-19
lines changed

2 files changed

+38
-19
lines changed

README.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,29 @@ The alarm is always shown in 24h format so you can tell AM from PM.
4747

4848
This feature can count down (timer) or up (chrono) to 100 hours. When idle, it displays `0` (or `000000` if you have leading zeros enabled).
4949

50-
* To start and stop, use **Up/Down**. While at `0`, **Up** will start the chrono.
51-
* While the chrono is running, **Up** will briefly display a lap time.
52-
* To set the timer, hold **Select** while at `0`. You can set it to the nearest minute, up to 100 hours. For convenience, it will recall the last set time. As soon as you press **Select** to finish setting, it will begin to count down.
53-
* While the timer is running, press **Up** to choose what the timer should do when it runs out:
50+
* To start and stop, use **Up**. While at `0`, this will start the chrono.
51+
* While the chrono is running, **Down** will briefly display a lap time.
52+
* To set the timer, hold **Select** while at `0`. It will prompt for hours/minutes first, then seconds. For convenience, it will recall the last-used time.
53+
* While the timer is running, **Down** will cycle through the runout options (what the timer will do when it runs out – clocks with beeper only):
5454
* 1 beep: simply stop, with a long signal (default)
5555
* 2 beeps: restart, with a short signal (makes a great interval timer!)
5656
* 3 beeps: start the chrono, with a long signal
5757
* 4 beeps: start the chrono, with a short signal
58-
* If your clock has a [switched relay](#hardware-configuration) and the timer/chrono is set to use it (in the [options menu](#options-menu)), it will switch on while the timer/chrono is running, like the “sleep” function on a clock radio. In this case, the runout options above are not available.
59-
* To reset to `0`, hold **Select**.
58+
* To reset to `0`, use **Down** while the timer/chrono is stopped, or hold **Select**.
6059
* When the timer signal sounds, press **Select** to silence it.
6160
* You can switch displays while the timer/chrono is running, and it will continue to run in the background. If you switch displays while it is stopped, it will reset. It will also reset if it is stopped for an hour, if it reaches 100 hours, or if power is lost.
6261

62+
Some variations may apply, depending on your [hardware configuration](#hardware-configuration):
63+
64+
* If your clock has a switched relay and the timer/chrono is set to use it (in the [options menu](#options-menu)), it will switch on while the timer/chrono is running, like the “sleep” function on a clock radio.
65+
* If your clock does not have a beeper, the runout options are not available.
66+
* If your clock uses a rotary encoder for **Up/Down** rather than buttons, the controls are slightly different:
67+
* To start, use **Up**.
68+
* While the chrono is running, **Up** will briefly display a lap time.
69+
* While the timer is running, **Up** will cycle through the runout options.
70+
* To stop, use **Down**.
71+
* To reset, hold **Select**.
72+
6373
### The Alt button
6474

6575
If your clock has an **Alt** button, it will do one of two things (depending on your [hardware configuration](#hardware-configuration)):

arduino-nixie/arduino-nixie.ino

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -365,21 +365,30 @@ void ctrlEvt(byte ctrl, byte evt){
365365
else if(ctrl==mainAdjUp || ctrl==mainAdjDn) {
366366
if(fn==fnIsAlarm) switchAlarm(ctrl==mainAdjUp?1:0); //switch alarm
367367
if(fn==fnIsTimer){
368-
if(ctrl==mainAdjUp){ //"start button"
369-
if(timerState&1){ //running
370-
if((timerState>>1)&1){ //counting up
371-
timerLap();
372-
} else { //counting down
373-
timerRunoutToggle();
374-
}
375-
} else { //stopped: start
368+
if(ctrl==mainAdjUp){
369+
if(!(timerState&1)){ //stopped
376370
timerStart();
371+
} else { //running
372+
if(mainAdjType==2) { //rotary encoder
373+
if((timerState>>1)&1) timerLap(); //chrono: lap
374+
else timerRunoutToggle(); //timer: runout option
375+
} else { //button
376+
timerStop();
377+
}
377378
}
378-
} else { //"stop button"
379-
if(timerState&1){ //running
380-
timerStop();
381-
} else { //stopped
382-
//timerClear(); //I think it is a little too easy to clear the timer when this is enabled
379+
} else { //mainAdjDown
380+
if(!(timerState&1)){ //stopped
381+
if(mainAdjType!=2) { //button only
382+
timerClear();
383+
updateDisplay();
384+
}
385+
} else { //running
386+
if(mainAdjType==2) { //rotary encoder
387+
timerStop();
388+
} else { //button
389+
if((timerState>>1)&1) timerLap(); //chrono: lap
390+
else timerRunoutToggle(); //timer: runout option
391+
}
383392
}
384393
}
385394
} //end if fnIsTimer

0 commit comments

Comments
 (0)