Skip to content

Commit e5e4cba

Browse files
committed
Merge branch 'dev/led'
* dev/led: millis() rollover fixes; reintroduce anti-poisoning options Fading LEDs via PWM; v8c mod (LED = pin 9) to fix tone() conflict with PWM on pin 11; reverse relay control polarity (since HIGH = open circuit = device off); switchPower via Alt rather than Adj; retire SelFn/AdjFn variables; rename night-off and day-off to night and away modes Retire mainSelFn, mainAdjFn, altSelFn. Their functions are baked-in now. Snooze cancel signal should use beeper when relay is switched; remove unused config lines v8a/b configs: rename to reflect PWM change; include version with sel/alt flipped v8 mod test: tell which button was released v8a and v8b isolated tests; mods to code for v8a and v8b (untested) Test sketch for modified v8.0 boards ibid three v8 configs, initInputs bugfix, remove unimplemented options External config files, option number changes, v8 config file set up for input mod testing Temp option + persistent display + write display to console, for testing ; further (untested) work on LED circuit switching (Unfinished, see stopping place) Support for LED control; use eeprom update instead of write # Conflicts: # README.md # sixtube_lm/sixtube_lm.ino
2 parents c01099f + 34b1cb2 commit e5e4cba

16 files changed

+1737
-238
lines changed

README.md

Lines changed: 52 additions & 33 deletions
Large diffs are not rendered by default.

sixtube_lm/configs/v5-4tube.h

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
const byte displaySize = 4; //number of tubes in display module. Small display adjustments are made for 4-tube clocks
2+
3+
// available clock functions, and unique IDs (between 0 and 200)
4+
const byte fnIsTime = 0;
5+
const byte fnIsDate = 1;
6+
const byte fnIsAlarm = 2;
7+
const byte fnIsTimer = 3;
8+
const byte fnIsDayCount = 4;
9+
const byte fnIsTemp = 5;
10+
const byte fnIsTubeTester = 6; //cycles all digits on all tubes 1/second, similar to anti-cathode-poisoning cleaner
11+
// functions enabled in this clock, in their display order. Only fnIsTime is required
12+
const byte fnsEnabled[] = {fnIsTime, fnIsDate, fnIsAlarm, fnIsTimer, fnIsDayCount}; //, fnIsTemp, fnIsTubeTester
13+
// To control which of these display persistently vs. switch back to Time after a few seconds, search "Temporary-display mode timeout"
14+
15+
// These are the UNDB v5 board connections to Arduino analog input pins.
16+
// S1/PL13 = Reset
17+
// S2/PL5 = A1
18+
// S3/PL6 = A0
19+
// S4/PL7 = A6
20+
// S5/PL8 = A3
21+
// S6/PL9 = A2
22+
// S7/PL14 = A7
23+
// A6-A7 are analog-only pins that aren't quite as responsive and require a physical pullup resistor (1K to +5V), and can't be used with rotary encoders because they don't support pin change interrupts.
24+
25+
// What input is associated with each control?
26+
const byte mainSel = A2; //main select button - must be equipped
27+
const byte mainAdjUp = A1; //main up/down buttons or rotary encoder - must be equipped
28+
const byte mainAdjDn = A0;
29+
const byte altSel = 0; //alt select button - if unequipped, set to 0
30+
31+
// What type of adj controls are equipped?
32+
// 1 = momentary buttons. 2 = quadrature rotary encoder.
33+
const byte mainAdjType = 2;
34+
35+
// In normal running mode, what do the controls do?
36+
// -1 = nothing/switch, -2 = cycle through functions, fn in fnsEnabled[] = go to that function
37+
// If using soft alarm/power switch per below, the control(s) set to -1 will do the switching.
38+
const char mainSelFn = -2;
39+
const char mainAdjFn = -1;
40+
const byte altSelFn = -1;
41+
42+
//What are the signal pin(s) connected to?
43+
const char piezoPin = 10;
44+
const char relayPin = -1; //don't change - not available until UNDB v8
45+
const byte relayMode = 0; //don't change - not available until UNDB v8
46+
const word signalDur = 180; //sec - when pulsed signal is going, pulses are sent once/sec for this period (e.g. 180 = 3min)
47+
const word switchDur = 7200; //sec - when alarm triggers switched relay, it's switched on for this period (e.g. 7200 = 2hr)
48+
const word piezoPulse = 500; //ms - used with piezo via tone()
49+
const word relayPulse = 200; //ms - used with pulsed relay
50+
51+
//Soft power switches
52+
const byte enableSoftAlarmSwitch = 1;
53+
// 1 = yes. Alarm can be switched on and off when clock is displaying the alarm time (fnIsAlarm).
54+
// 0 = no. Alarm will be permanently on. Use with switched relay if the appliance has its own switch on this relay circuit.
55+
const byte enableSoftPowerSwitch = 0; //don't change - not available until UNDB v8
56+
57+
//LED circuit control
58+
const char ledPin = -1; //don't change - not available until UNDB v8
59+
60+
//When display is dim/off, a press will light the tubes for how long?
61+
const byte unoffDur = 10; //sec
62+
63+
// How long (in ms) are the button hold durations?
64+
const word btnShortHold = 1000; //for setting the displayed feataure
65+
const word btnLongHold = 3000; //for for entering options menu
66+
const byte velThreshold = 150; //ms
67+
// When an adj up/down input (btn or rot) follows another in less than this time, value will change more (10 vs 1).
68+
// Recommend ~150 for rotaries. If you want to use this feature with buttons, extend to ~400.
69+
70+
// What is the "frame rate" of the tube cleaning and display scrolling? up to 65535 ms
71+
const word cleanSpeed = 200; //ms
72+
const word scrollSpeed = 100; //ms - e.g. scroll-in-and-out date at :30 - to give the illusion of a slow scroll that doesn't pause, use (timeoutTempFn*1000)/(displaySize+1) - e.g. 714 for displaySize=6 and timeoutTempFn=5
73+
74+
// What are the timeouts for setting and temporarily-displayed functions? up to 65535 sec
75+
const unsigned long timeoutSet = 120; //sec
76+
const unsigned long timeoutTempFn = 5; //sec
77+
78+
//This clock is 2x3 multiplexed: two tubes powered at a time.
79+
//The anode channel determines which two tubes are powered,
80+
//and the two SN74141 cathode driver chips determine which digits are lit.
81+
//4 pins out to each SN74141, representing a binary number with values [1,2,4,8]
82+
const char outA1 = 2;
83+
const char outA2 = 3;
84+
const char outA3 = 4;
85+
const char outA4 = 5;
86+
const char outB1 = 6;
87+
const char outB2 = 7;
88+
const char outB3 = 8;
89+
const char outB4 = 9;
90+
//3 pins out to anode channel switches
91+
const char anode1 = 11;
92+
const char anode2 = 12;
93+
const char anode3 = 13;

sixtube_lm/configs/v5-6tube-red.h

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
const byte displaySize = 6; //number of tubes in display module. Small display adjustments are made for 4-tube clocks
2+
3+
// available clock functions, and unique IDs (between 0 and 200)
4+
const byte fnIsTime = 0;
5+
const byte fnIsDate = 1;
6+
const byte fnIsAlarm = 2;
7+
const byte fnIsTimer = 3;
8+
const byte fnIsDayCount = 4;
9+
const byte fnIsTemp = 5;
10+
const byte fnIsTubeTester = 6; //cycles all digits on all tubes 1/second, similar to anti-cathode-poisoning cleaner
11+
// functions enabled in this clock, in their display order. Only fnIsTime is required
12+
const byte fnsEnabled[] = {fnIsTime, fnIsDate, fnIsAlarm, fnIsTimer, fnIsDayCount}; //, fnIsTemp, fnIsTubeTester
13+
// To control which of these display persistently vs. switch back to Time after a few seconds, search "Temporary-display mode timeout"
14+
15+
// These are the UNDB v5 board connections to Arduino analog input pins.
16+
// S1/PL13 = Reset
17+
// S2/PL5 = A1
18+
// S3/PL6 = A0
19+
// S4/PL7 = A6
20+
// S5/PL8 = A3
21+
// S6/PL9 = A2
22+
// S7/PL14 = A7
23+
// A6-A7 are analog-only pins that aren't quite as responsive and require a physical pullup resistor (1K to +5V), and can't be used with rotary encoders because they don't support pin change interrupts.
24+
25+
// What input is associated with each control?
26+
const byte mainSel = A1; //main select button - must be equipped
27+
const byte mainAdjUp = A6; //main up/down buttons or rotary encoder - must be equipped
28+
const byte mainAdjDn = A2;
29+
const byte altSel = 0; //alt select button - if unequipped, set to 0
30+
31+
// What type of adj controls are equipped?
32+
// 1 = momentary buttons. 2 = quadrature rotary encoder.
33+
const byte mainAdjType = 1;
34+
35+
// In normal running mode, what do the controls do?
36+
// -1 = nothing/switch, -2 = cycle through functions, fn in fnsEnabled[] = go to that function
37+
// If using soft alarm/power switch per below, the control(s) set to -1 will do the switching.
38+
const char mainSelFn = -2;
39+
const char mainAdjFn = -1;
40+
const byte altSelFn = -1;
41+
42+
//What are the signal pin(s) connected to?
43+
const char piezoPin = 10;
44+
const char relayPin = -1; //don't change - not available until UNDB v8
45+
const byte relayMode = 0; //don't change - not available until UNDB v8
46+
const word signalDur = 180; //sec - when pulsed signal is going, pulses are sent once/sec for this period (e.g. 180 = 3min)
47+
const word switchDur = 7200; //sec - when alarm triggers switched relay, it's switched on for this period (e.g. 7200 = 2hr)
48+
const word piezoPulse = 500; //ms - used with piezo via tone()
49+
const word relayPulse = 200; //ms - used with pulsed relay
50+
51+
//Soft power switches
52+
const byte enableSoftAlarmSwitch = 1;
53+
// 1 = yes. Alarm can be switched on and off when clock is displaying the alarm time (fnIsAlarm).
54+
// 0 = no. Alarm will be permanently on. Use with switched relay if the appliance has its own switch on this relay circuit.
55+
const byte enableSoftPowerSwitch = 0; //don't change - not available until UNDB v8
56+
57+
//LED circuit control
58+
const char ledPin = -1; //don't change - not available until UNDB v8
59+
60+
//When display is dim/off, a press will light the tubes for how long?
61+
const byte unoffDur = 10; //sec
62+
63+
// How long (in ms) are the button hold durations?
64+
const word btnShortHold = 1000; //for setting the displayed feataure
65+
const word btnLongHold = 3000; //for for entering options menu
66+
const byte velThreshold = 150; //ms
67+
// When an adj up/down input (btn or rot) follows another in less than this time, value will change more (10 vs 1).
68+
// Recommend ~150 for rotaries. If you want to use this feature with buttons, extend to ~400.
69+
70+
// What is the "frame rate" of the tube cleaning and display scrolling? up to 65535 ms
71+
const word cleanSpeed = 200; //ms
72+
const word scrollSpeed = 100; //ms - e.g. scroll-in-and-out date at :30 - to give the illusion of a slow scroll that doesn't pause, use (timeoutTempFn*1000)/(displaySize+1) - e.g. 714 for displaySize=6 and timeoutTempFn=5
73+
74+
// What are the timeouts for setting and temporarily-displayed functions? up to 65535 sec
75+
const unsigned long timeoutSet = 120; //sec
76+
const unsigned long timeoutTempFn = 5; //sec
77+
78+
//This clock is 2x3 multiplexed: two tubes powered at a time.
79+
//The anode channel determines which two tubes are powered,
80+
//and the two SN74141 cathode driver chips determine which digits are lit.
81+
//4 pins out to each SN74141, representing a binary number with values [1,2,4,8]
82+
const char outA1 = 2;
83+
const char outA2 = 3;
84+
const char outA3 = 4;
85+
const char outA4 = 5;
86+
const char outB1 = 6;
87+
const char outB2 = 7;
88+
const char outB3 = 8;
89+
const char outB4 = 9;
90+
//3 pins out to anode channel switches
91+
const char anode1 = 11;
92+
const char anode2 = 12;
93+
const char anode3 = 13;

sixtube_lm/configs/v5-6tube-rotary.h

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
const byte displaySize = 6; //number of tubes in display module. Small display adjustments are made for 4-tube clocks
2+
3+
// available clock functions, and unique IDs (between 0 and 200)
4+
const byte fnIsTime = 0;
5+
const byte fnIsDate = 1;
6+
const byte fnIsAlarm = 2;
7+
const byte fnIsTimer = 3;
8+
const byte fnIsDayCount = 4;
9+
const byte fnIsTemp = 5;
10+
const byte fnIsTubeTester = 6; //cycles all digits on all tubes 1/second, similar to anti-cathode-poisoning cleaner
11+
// functions enabled in this clock, in their display order. Only fnIsTime is required
12+
const byte fnsEnabled[] = {fnIsTime, fnIsDate, fnIsAlarm, fnIsTimer, fnIsDayCount}; //, fnIsTemp, fnIsTubeTester
13+
// To control which of these display persistently vs. switch back to Time after a few seconds, search "Temporary-display mode timeout"
14+
15+
// These are the UNDB v5 board connections to Arduino analog input pins.
16+
// S1/PL13 = Reset
17+
// S2/PL5 = A1
18+
// S3/PL6 = A0
19+
// S4/PL7 = A6
20+
// S5/PL8 = A3
21+
// S6/PL9 = A2
22+
// S7/PL14 = A7
23+
// A6-A7 are analog-only pins that aren't quite as responsive and require a physical pullup resistor (1K to +5V), and can't be used with rotary encoders because they don't support pin change interrupts.
24+
25+
// What input is associated with each control?
26+
const byte mainSel = A2; //main select button - must be equipped
27+
const byte mainAdjUp = A0; //main up/down buttons or rotary encoder - must be equipped
28+
const byte mainAdjDn = A1;
29+
const byte altSel = 0; //alt select button - if unequipped, set to 0
30+
31+
// What type of adj controls are equipped?
32+
// 1 = momentary buttons. 2 = quadrature rotary encoder.
33+
const byte mainAdjType = 2;
34+
35+
// In normal running mode, what do the controls do?
36+
// -1 = nothing/switch, -2 = cycle through functions, fn in fnsEnabled[] = go to that function
37+
// If using soft alarm/power switch per below, the control(s) set to -1 will do the switching.
38+
const char mainSelFn = -2;
39+
const char mainAdjFn = -1;
40+
const byte altSelFn = -1;
41+
42+
//What are the signal pin(s) connected to?
43+
const char piezoPin = 10;
44+
const char relayPin = -1; //don't change - not available until UNDB v8
45+
const byte relayMode = 0; //don't change - not available until UNDB v8
46+
const word signalDur = 180; //sec - when pulsed signal is going, pulses are sent once/sec for this period (e.g. 180 = 3min)
47+
const word switchDur = 7200; //sec - when alarm triggers switched relay, it's switched on for this period (e.g. 7200 = 2hr)
48+
const word piezoPulse = 500; //ms - used with piezo via tone()
49+
const word relayPulse = 200; //ms - used with pulsed relay
50+
51+
//Soft power switches
52+
const byte enableSoftAlarmSwitch = 1;
53+
// 1 = yes. Alarm can be switched on and off when clock is displaying the alarm time (fnIsAlarm).
54+
// 0 = no. Alarm will be permanently on. Use with switched relay if the appliance has its own switch on this relay circuit.
55+
const byte enableSoftPowerSwitch = 0; //don't change - not available until UNDB v8
56+
57+
//LED circuit control
58+
const char ledPin = -1; //don't change - not available until UNDB v8
59+
60+
//When display is dim/off, a press will light the tubes for how long?
61+
const byte unoffDur = 10; //sec
62+
63+
// How long (in ms) are the button hold durations?
64+
const word btnShortHold = 1000; //for setting the displayed feataure
65+
const word btnLongHold = 3000; //for for entering options menu
66+
const byte velThreshold = 150; //ms
67+
// When an adj up/down input (btn or rot) follows another in less than this time, value will change more (10 vs 1).
68+
// Recommend ~150 for rotaries. If you want to use this feature with buttons, extend to ~400.
69+
70+
// What is the "frame rate" of the tube cleaning and display scrolling? up to 65535 ms
71+
const word cleanSpeed = 200; //ms
72+
const word scrollSpeed = 100; //ms - e.g. scroll-in-and-out date at :30 - to give the illusion of a slow scroll that doesn't pause, use (timeoutTempFn*1000)/(displaySize+1) - e.g. 714 for displaySize=6 and timeoutTempFn=5
73+
74+
// What are the timeouts for setting and temporarily-displayed functions? up to 65535 sec
75+
const unsigned long timeoutSet = 120; //sec
76+
const unsigned long timeoutTempFn = 5; //sec
77+
78+
//This clock is 2x3 multiplexed: two tubes powered at a time.
79+
//The anode channel determines which two tubes are powered,
80+
//and the two SN74141 cathode driver chips determine which digits are lit.
81+
//4 pins out to each SN74141, representing a binary number with values [1,2,4,8]
82+
const char outA1 = 2;
83+
const char outA2 = 3;
84+
const char outA3 = 4;
85+
const char outA4 = 5;
86+
const char outB1 = 6;
87+
const char outB2 = 7;
88+
const char outB3 = 8;
89+
const char outB4 = 9;
90+
//3 pins out to anode channel switches
91+
const char anode1 = 11;
92+
const char anode2 = 12;
93+
const char anode3 = 13;

sixtube_lm/configs/v5-6tube.h

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
const byte displaySize = 6; //number of tubes in display module. Small display adjustments are made for 4-tube clocks
2+
3+
// available clock functions, and unique IDs (between 0 and 200)
4+
const byte fnIsTime = 0;
5+
const byte fnIsDate = 1;
6+
const byte fnIsAlarm = 2;
7+
const byte fnIsTimer = 3;
8+
const byte fnIsDayCount = 4;
9+
const byte fnIsTemp = 5;
10+
const byte fnIsTubeTester = 6; //cycles all digits on all tubes 1/second, similar to anti-cathode-poisoning cleaner
11+
// functions enabled in this clock, in their display order. Only fnIsTime is required
12+
const byte fnsEnabled[] = {fnIsTime, fnIsDate, fnIsAlarm, fnIsTimer, fnIsDayCount}; //, fnIsTemp, fnIsTubeTester
13+
// To control which of these display persistently vs. switch back to Time after a few seconds, search "Temporary-display mode timeout"
14+
15+
// These are the UNDB v5 board connections to Arduino analog input pins.
16+
// S1/PL13 = Reset
17+
// S2/PL5 = A1
18+
// S3/PL6 = A0
19+
// S4/PL7 = A6
20+
// S5/PL8 = A3
21+
// S6/PL9 = A2
22+
// S7/PL14 = A7
23+
// A6-A7 are analog-only pins that aren't quite as responsive and require a physical pullup resistor (1K to +5V), and can't be used with rotary encoders because they don't support pin change interrupts.
24+
25+
// What input is associated with each control?
26+
const byte mainSel = A2; //main select button - must be equipped
27+
const byte mainAdjUp = A1; //main up/down buttons or rotary encoder - must be equipped
28+
const byte mainAdjDn = A0;
29+
const byte altSel = 0; //alt select button - if unequipped, set to 0
30+
31+
// What type of adj controls are equipped?
32+
// 1 = momentary buttons. 2 = quadrature rotary encoder.
33+
const byte mainAdjType = 1;
34+
35+
// In normal running mode, what do the controls do?
36+
// -1 = nothing/switch, -2 = cycle through functions, fn in fnsEnabled[] = go to that function
37+
// If using soft alarm/power switch per below, the control(s) set to -1 will do the switching.
38+
const char mainSelFn = -2;
39+
const char mainAdjFn = -1;
40+
const byte altSelFn = -1;
41+
42+
//What are the signal pin(s) connected to?
43+
const char piezoPin = 10;
44+
const char relayPin = -1; //don't change - not available until UNDB v8
45+
const byte relayMode = 0; //don't change - not available until UNDB v8
46+
const word signalDur = 180; //sec - when pulsed signal is going, pulses are sent once/sec for this period (e.g. 180 = 3min)
47+
const word switchDur = 7200; //sec - when alarm triggers switched relay, it's switched on for this period (e.g. 7200 = 2hr)
48+
const word piezoPulse = 500; //ms - used with piezo via tone()
49+
const word relayPulse = 200; //ms - used with pulsed relay
50+
51+
//Soft power switches
52+
const byte enableSoftAlarmSwitch = 1;
53+
// 1 = yes. Alarm can be switched on and off when clock is displaying the alarm time (fnIsAlarm).
54+
// 0 = no. Alarm will be permanently on. Use with switched relay if the appliance has its own switch on this relay circuit.
55+
const byte enableSoftPowerSwitch = 0; //don't change - not available until UNDB v8
56+
57+
//LED circuit control
58+
const char ledPin = -1; //don't change - not available until UNDB v8
59+
60+
//When display is dim/off, a press will light the tubes for how long?
61+
const byte unoffDur = 10; //sec
62+
63+
// How long (in ms) are the button hold durations?
64+
const word btnShortHold = 1000; //for setting the displayed feataure
65+
const word btnLongHold = 3000; //for for entering options menu
66+
const byte velThreshold = 150; //ms
67+
// When an adj up/down input (btn or rot) follows another in less than this time, value will change more (10 vs 1).
68+
// Recommend ~150 for rotaries. If you want to use this feature with buttons, extend to ~400.
69+
70+
// What is the "frame rate" of the tube cleaning and display scrolling? up to 65535 ms
71+
const word cleanSpeed = 200; //ms
72+
const word scrollSpeed = 100; //ms - e.g. scroll-in-and-out date at :30 - to give the illusion of a slow scroll that doesn't pause, use (timeoutTempFn*1000)/(displaySize+1) - e.g. 714 for displaySize=6 and timeoutTempFn=5
73+
74+
// What are the timeouts for setting and temporarily-displayed functions? up to 65535 sec
75+
const unsigned long timeoutSet = 120; //sec
76+
const unsigned long timeoutTempFn = 5; //sec
77+
78+
//This clock is 2x3 multiplexed: two tubes powered at a time.
79+
//The anode channel determines which two tubes are powered,
80+
//and the two SN74141 cathode driver chips determine which digits are lit.
81+
//4 pins out to each SN74141, representing a binary number with values [1,2,4,8]
82+
const char outA1 = 2;
83+
const char outA2 = 3;
84+
const char outA3 = 4;
85+
const char outA4 = 5;
86+
const char outB1 = 6;
87+
const char outB2 = 7;
88+
const char outB3 = 8;
89+
const char outB4 = 9;
90+
//3 pins out to anode channel switches
91+
const char anode1 = 11;
92+
const char anode2 = 12;
93+
const char anode3 = 13;

0 commit comments

Comments
 (0)