Skip to content

Commit 66eb215

Browse files
committed
switch mainSel to A6; readme update
1 parent 1116da4 commit 66eb215

File tree

2 files changed

+46
-39
lines changed

2 files changed

+46
-39
lines changed

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,20 @@ _These instructions are for a clock equipped with a single knob/button (rotary e
7878
| --- | --- |
7979
| 1. Time format | 12- or 24-hour (time display only; setting is always done in 24h) |
8080
| 2. Date display | 1 = month/date/weekday<br/>2 = date/month/weekday |
81-
| 3. Display date during time? | 0 = never<br/>1 = date instead of seconds<br/>2 = full date (as above) each minute at :30 seconds |
81+
| 3. Display date during time? | 0 = never<br/>1 = date instead of seconds<br/>2 = full date (as above) every minute at :30 seconds |
8282
| 4. Leading zero in hour, date, and month? | 0 = no<br/>1 = yes |
8383
| 5. Transition fade | 0–50 (in hundredths of a second) |
84-
| 6. Digit cycle (prevents [cathode poisoning](http://www.tube-tester.com/sites/nixie/different/cathode%20poisoning/cathode-poisoning.htm) | 0 = before midnight and/or before day-off<br/>1 = each hour at :01 minute |
84+
| 6. Digit cycle (prevents [cathode poisoning](http://www.tube-tester.com/sites/nixie/different/cathode%20poisoning/cathode-poisoning.htm)) | 0 = before midnight and/or before day-off<br/>1 = every hour before :01 minute |
8585
| 7. Auto DST | Add 1h for daylight saving time between these dates (at 2am):<br/>0 = off<br/>1 = second Sunday in March to first Sunday in November (US/CA)<br/>2 = last Sunday in March to last Sunday in October (UK/EU)<br/>3 = first Sunday in April to last Sunday in October (MX)<br/>4 = last Sunday in September to first Sunday in April (NZ)<br/>5 = first Sunday in October to first Sunday in April (AU)<br/>6 = third Sunday in October to third Sunday in February (BZ) |
86-
| 8. Hourly strike | 0 = off<br/>1 = beep<br/>2 = pips<br/>3 = strike<br/>4 = ship's bell<br/>(Clocks without radio/timer control only. Will not sound during day-off or night-off.) |
87-
| 9. Snooze duration | 0–60 minutes. 0 disables snooze. |
88-
| 10. Fine regulation | Adjusts clock's timekeeping in tenths of a second per week. 500 is "normal." (e.g.: 503 causes clock to run 0.3s faster per week.) |
89-
| | *Night-off mode* – Dim or shut off the tubes daily. |
90-
| 11. Night-off mode | 0 = normal (no change)<br/>1 = dim tubes at night<br/>2 = shut off tubes at night |
91-
| 12. Night starts at | Time of day |
92-
| 13. Night ends at | Time of day. Set to 99:99 to use the alarm time. |
93-
| 14. Day-off mode | To save tube life, shut off tubes during the day when you're not around.<br/>0 = normal (no change)<br/>1 = office mode (shut off all day on weekends)<br/>2 = home mode (shut off during office hours) |
94-
| 15. First day of work week | 0–6 (Sunday–Saturday) |
95-
| 16. Last day of work week | 0–6 (Sunday–Saturday) |
96-
| 17. Work starts at | Time of day |
97-
| 18. Work ends at | Time of day |
86+
| 8. Hourly strike | 0 = off<br/>1 = double beep<br/>2 = pips<br/>3 = strike the hour<br/>4 = ship's bell<br/>(Clocks without radio/timer control only. Will not sound during day-off or night-off.) |
87+
| 9. Alarm sound | 0 = double beeps at alarm time<br/>1 = 20-minute progressive beeps<br/>(Clocks without radio/timer control only.)
88+
| 10. Snooze duration | 0–60 minutes. 0 disables snooze. |
89+
| 11. Fine regulation | Adjusts clock's timekeeping in tenths of a second per week. 500 is "normal." (e.g.: 503 causes clock to run 0.3s faster per week.) |
90+
| 12. Night-off | 0 = normal (tubes fully on at night)<br/>1 = dim tubes at night<br/>2 = shut off tubes at night |
91+
| 13. Night starts at | Time of day |
92+
| 14. Night ends at | Time of day. Set to 99:99 to use the alarm time. |
93+
| 15. Day-off | To save tube life, shut off tubes during the day when you're not around.<br/>0 = normal (no day-off)<br/>1 = clock at work (shut off all day on weekends)<br/>2 = clock at home (shut off during work hours) |
94+
| 16. First day of work week | 0–6 (Sunday–Saturday) |
95+
| 17. Last day of work week | 0–6 (Sunday–Saturday) |
96+
| 18. Work starts at | Time of day |
97+
| 19. Work ends at | Time of day |

sixtube_lm.ino

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@
2020
// S7/PL14 = A7
2121

2222
// What input is associated with each control?
23-
const byte mainSel = A3; //main select button - must be equipped //TODO test this with A6
23+
const byte mainSel = A6; //main select button - must be equipped //TODO test this with A6
2424
const byte mainAdj[2] = {A1,A0}; //main up/down buttons or rotary encoder - must be equipped
2525
const byte altSel = 0; //alt select button - if unequipped, set to 0
2626
const byte altAdj[2] = {A3,A2}; //alt up/down buttons or rotary encoder - if unequipped, need not define this
2727

2828
// What type of adj controls are equipped?
2929
// 1 = momentary buttons. 2 = quadrature rotary encoder.
3030
const byte mainAdjType = 1;
31-
const byte altAdjType = 0; //if unquipped, set to 0
31+
const byte altAdjType = 1; //if unquipped, set to 0
3232

3333
// In normal running mode, what do the controls do?
34-
// 255 = nothing, 254 = cycle through functions, 0-3 = go to specific function (see clockFn)
34+
// 255 = nothing, 254 = cycle through functions, 0-3 = go to specific function (see fn)
3535
const byte mainSelFn = 255; //1; //date
3636
const byte mainAdjFn = 254;
3737
const byte altSelFn = 255; //3; //timer //if equipped
@@ -50,16 +50,16 @@ const byte alarmRadio = 0;
5050
const byte alarmDur = 3;
5151

5252
// How long (in ms) are the button hold durations?
53-
const int btnShortHold = 2000; //for setting the displayed feataure
54-
const int btnLongHold = 5000; //for for entering SETUP menu
53+
const int btnShortHold = 1000; //for setting the displayed feataure
54+
const int btnLongHold = 3000; //for for entering SETUP menu
5555

5656

5757
////////// Major global vars/consts //////////
58-
byte clockFnCt = 4;
59-
byte clockFn = 0; //currently displayed function: 0=time, 1=date, 2=alarm, 3=timer, 255=SETUP menu
60-
byte clockFnSet = 0; //whether this function is currently being set, and which option/page it's on
58+
byte fnCt = 4;
59+
byte fn = 0; //currently displayed function: 0=time, 1=date, 2=alarm, 3=timer, 255=SETUP menu
60+
byte fnSet = 0; //whether this function is currently being set, and which option/page it's on
6161
byte setupOptsCt = 3; //1-index
62-
byte setupOpts[4] = {0,0,1,1}; //see ctrlEvt() switch(clockFnSet) for what these are/do
62+
byte setupOpts[4] = {0,0,1,1}; //see ctrlEvt() switch(fnSet) for what these are/do
6363

6464
byte displayNext[6] = {15,15,15,15,15,15}; //Blank tubes at start. When display should change, put it here
6565
int btnPresses = 0;
@@ -183,29 +183,29 @@ void ctrlEvt(byte ctrl, byte evt){
183183
//Handle button (for now) events.
184184
//In some cases, when reacting to evt 1/2/3, we may want to call btnStop()
185185
//so following events 2/3/0 don't cause unintended behavior.
186-
if(clockFn==255) { //SETUP menu
186+
if(fn==255) { //SETUP menu
187187
if(ctrl==mainSel) {
188188
if(evt==1) { //mainSel press
189-
if(clockFnSet==setupOptsCt) { //that was the last one – exit
189+
if(fnSet==setupOptsCt) { //that was the last one – exit
190190
log("SETUP: Exiting after last option\n");
191191
btnStop();
192-
clockFn=0; clockFnSet=0; updateDisplay(); return; //exit setup
192+
fn=0; fnSet=0; updateDisplay(); return; //exit setup
193193
} else {
194194
log("SETUP: Proceeding to next option\n");
195-
clockFnSet++; updateDisplay(); return; //advance to next option
195+
fnSet++; updateDisplay(); return; //advance to next option
196196
}
197197
}
198198
if(evt==2) { //mainSel short hold
199199
log("SETUP: Exiting per mainSel short hold\n");
200200
btnStop(); //no more events from this press
201-
clockFn=0; clockFnSet=0; updateDisplay(); return; //exit setup
201+
fn=0; fnSet=0; updateDisplay(); return; //exit setup
202202
}
203203
} //end mainSel
204204
if((ctrl==mainAdj[0] || ctrl==mainAdj[1]) && evt==1){ //mainAdj press
205205
log("SETUP: "); log(String(ctrl)); log(" pressed\n");
206206
btnStop(); //no more events from this press
207207
int delta = (ctrl==mainAdj[0]?1:-1);
208-
switch(clockFnSet){ //This is where we set the ranges for each option
208+
switch(fnSet){ //This is where we set the ranges for each option
209209
//setupOpts[0] exists but is just a pad to make it 1-index for programming convenience
210210
case 1: changeInRangeAr(setupOpts, 1, delta, 0, 1); break; //dim no/yes. Default: 0
211211
case 2: changeInRangeAr(setupOpts, 2, delta, 1, 7); break;
@@ -218,12 +218,19 @@ void ctrlEvt(byte ctrl, byte evt){
218218
if(ctrl==mainSel && evt==3) { //mainSel long hold: enter SETUP
219219
btnStop(); //silence, you
220220
log("Entering SETUP per mainSel long hold\n");
221-
clockFn=255; clockFnSet=1; updateDisplay(); return;
221+
fn=255; fnSet=1; updateDisplay(); return;
222222
} else {
223-
if(clockFnSet) { //function setting
224-
//press: go to next option or save and exit clockFnSet
223+
if(fnSet) { //function setting
224+
//press: go to next option or save and exit fnSet
225+
switch(fn){
226+
case 0: //time
227+
case 1: //date
228+
case 2: //alarm
229+
case 3: //timer
230+
default: break;
231+
}
225232
} else { //normal function running
226-
//short hold: enter clockFnSet
233+
//short hold: enter fnSet
227234
//press: increment counter
228235
if(ctrl==mainSel && evt==1) {btnPresses++; log("Incrementing counter to "); log(String(btnPresses)); log("\n"); updateDisplay(); return; }
229236
}
@@ -247,11 +254,11 @@ byte changeInRange(byte curVal, int delta, byte minVal, byte maxVal){
247254
void updateDisplay(){
248255
//Only run as often as the data behind the display changes (clock tick, setting change, etc.)
249256
//This function takes that data and uses it to edit displayNext[] for cycleDisplay() to pick up
250-
switch(clockFn){ //which function are we displaying?
257+
switch(fn){ //which function are we displaying?
251258
case 255: //SETUP menu
252-
log("Per SETUP, updating display to key="); log(String(clockFnSet)); log(", val="); log(String(setupOpts[clockFnSet])); log("\n");
253-
editDisplay(clockFnSet, 4, 5, false); //current option key, displayed on little tubes (4-5)
254-
editDisplay(setupOpts[clockFnSet], 0, 3, false); //current option value, on big tubes (0-3)
259+
log("Per SETUP, updating display to key="); log(String(fnSet)); log(", val="); log(String(setupOpts[fnSet])); log("\n");
260+
editDisplay(fnSet, 4, 5, false); //current option key, displayed on little tubes (4-5)
261+
editDisplay(setupOpts[fnSet], 0, 3, false); //current option value, on big tubes (0-3)
255262
case 1: //date
256263
break;
257264
case 2: //alarm
@@ -264,7 +271,7 @@ void updateDisplay(){
264271
editDisplay(btnPresses, 0, 3, true); //big tubes: counter – pad with leading zeros
265272
blankDisplay(4,5); //small tubes blank
266273
break;
267-
} //end switch clockFn
274+
} //end switch fn
268275
} //end updateDisplay()
269276
void editDisplay(int n, byte posStart, byte posEnd, bool leadingZeros){
270277
//Splits n into digits, sets them into displayNext in places posSt-posEnd (inclusive), with or without leading zeros
@@ -321,7 +328,7 @@ unsigned long setStartLast = 0; //to control flashing
321328

322329
void cycleDisplay(){
323330
bool dim = (setupOpts[1]>0?true:false); //Under normal circumstances, dim constantly if the time is right
324-
if(clockFnSet>0) { //but if we're setting, dim for every other 500ms since we started setting
331+
if(fnSet>0) { //but if we're setting, dim for every other 500ms since we started setting
325332
if(setStartLast==0) setStartLast = millis();
326333
dim = 1-(((millis()-setStartLast)/500)%2);
327334
} else {

0 commit comments

Comments
 (0)