You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: arduino-nixie/arduino-nixie.ino
+51-42Lines changed: 51 additions & 42 deletions
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@
7
7
////////// Hardware configuration //////////
8
8
//Include the config file that matches your hardware setup. If needed, duplicate an existing one.
9
9
10
-
#include"configs/v8-6tube.h"
10
+
#include"configs/v9-6tube.h"
11
11
12
12
////////// Software version //////////
13
13
const byte vMajor = 1;
@@ -73,7 +73,7 @@ Some are skipped when they wouldn't apply to a given clock's hardware config, se
73
73
42 Alarm signal, 0=beeper, 1=relay - skipped when no relay (start=0) or no piezo (start=0)
74
74
43 Timer signal - skipped when no relay (start=0) or no piezo (start=1)
75
75
44 Strike signal - skipped when no pulse relay (start=0) or no piezo (start=1)
76
-
45 Temperature format - skipped when fnIsTemp is not in fnsEnabled TODO also useful for weather display
76
+
45 Temperature format - skipped when !enableTemp TODO also useful for weather display
77
77
46 Anti-cathode poisoning
78
78
47 Alarm beeper pattern - skipped when no piezo
79
79
48 Timer beeper pattern - skipped when no piezo
@@ -105,9 +105,16 @@ unsigned long inputLast2 = 0; //Second-to-last of above
105
105
//TODO the math between these two may fail very rarely due to millis() rolling over while setting. Need to find a fix. I think it only applies to the rotary encoder though.
106
106
int inputLastTODMins = 0; //time of day, in minutes past midnight, when button was pressed. Used in paginated functions so they all reflect the same TOD.
107
107
108
+
// Functions and pages
109
+
// Unique IDs - see also fnScroll
110
+
const byte fnIsTime = 0; //time of day
111
+
const byte fnIsDate = 1; //date, with optional day counter and sunrise/sunset pages
112
+
const byte fnIsAlarm = 2; //alarm time
113
+
const byte fnIsTimer = 3; //countdown timer and chronograph
114
+
const byte fnIsTemp = 4; //temperature per DS3231 – will likely read high
115
+
const byte fnIsTest = 5; //simply cycles all tubes
108
116
const byte fnOpts = 201; //fn values from here to 255 correspond to options in the options menu
109
-
byte fn = fnIsTime; //currently displayed fn per fnsEnabled in config
110
-
byte fnsOn = 0; //which fns are enabled per fnsEnabled in config - one bit per fn unique ID - this limits the available fn unique IDs to 0–7; otherwise it could be 0–200 – if you need more than 7, change from a byte to a bigger data type
117
+
byte fn = 0; //currently displayed fn per above
111
118
byte fnPg = 0; //allows a function to have multiple pages
112
119
byte fnSetPg = 0; //whether this function is currently being set, and which option/page it's on
113
120
int fnSetVal; //the value currently being set, if any
@@ -169,35 +176,22 @@ void setup(){
169
176
writeEEPROM(21,0,false); //turn off strike
170
177
writeEEPROM(50,0,false); //turn off fibonacci mode
//Switch to the next (up) or previous (down) enabled function. This determines the order.
607
+
//We'll use switch blocks *without* breaks to cascade to the next enabled function
608
+
if(dir) { // up
609
+
switch(fn) {
610
+
case fnIsTime: if(enableDate) { fn = fnIsDate; break; }
611
+
case fnIsDate: if(enableAlarm) { fn = fnIsAlarm; break; }
612
+
case fnIsAlarm: if(enableTimer) { fn = fnIsTimer; break; }
613
+
case fnIsTimer: if(enableTemp) { fn = fnIsTemp; break; }
614
+
case fnIsTemp: if(enableTest) { fn = fnIsTest; break; }
615
+
case fnIsTest: default: fn = fnIsTime; break;
616
+
}
617
+
} else { // down
618
+
switch(fn) {
619
+
case fnIsTime: if(enableTest) { fn = fnIsTest; break; }
620
+
case fnIsTest: if(enableTemp) { fn = fnIsTemp; break; }
621
+
case fnIsTemp: if(enableTimer) { fn = fnIsTimer; break; }
622
+
case fnIsTimer: if(enableAlarm) { fn = fnIsAlarm; break; }
623
+
case fnIsAlarm: if(enableDate) { fn = fnIsDate; break; }
624
+
case fnIsDate: default: fn = fnIsTime; break;
625
+
}
626
+
}
617
627
}
618
628
voidfnOptScroll(byte dir){
619
629
//0=down, 1=up
@@ -632,18 +642,18 @@ void fnOptScroll(byte dir){
632
642
|| ((ledPin<0) && (optLoc==26)) //no led pin: no led control
633
643
|| ((ledPin<0) && (optLoc==26)) //no led pin: no led control
634
644
//Functions disabled
635
-
|| (!((fnsOn>>fnIsDate)&1) && (optLoc==17||optLoc==18||optLoc==10||optLoc==12||optLoc==14)) //date fn disabled in config: skip date and geography options
0 commit comments