Skip to content

Commit 239e70f

Browse files
committed
Anti-poisoning routine: longer run cycles; will not be triggered during night/away mode; and the daily trigger happens either at midnight or just before night mode if enabled
1 parent 3e76c41 commit 239e70f

File tree

2 files changed

+23
-20
lines changed

2 files changed

+23
-20
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ Later UNDBs (v8 with mods, or v9+) are equipped with controllable LEDs, as well
5252
| 5 | Digit fade | 0–20 (in hundredths of a second) |
5353
| 6 | 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) |
5454
| 7 | LED behavior | 0 = always off<br/>1 = always on<br/>2 = on, but follow night/away modes if enabled<br/>3 = off, but on when alarm/timer sounds</br>4 = off, but on with switched relay (if equipped)<br/>(Clocks with LED control only, UNDB v8+) |
55-
| 8 | Temperature format | 0 = Celsius<br/>1 = Fahrenheit<br/>(Clocks with temperature function enabled only) |
56-
| 9 | Anti-cathode poisoning | Briefly cycles all digits to prevent [cathode poisoning](http://www.tube-tester.com/sites/nixie/different/cathode%20poisoning/cathode-poisoning.htm)<br/>0 = once a day, at "Night ends at" time (or alarm time if applicable)<br/>1 = at midnight<br/>2 = at the top of every hour<br/>3 = at the top of every minute |
55+
| 8 | Anti-cathode poisoning | Briefly cycles all digits to prevent [cathode poisoning](http://www.tube-tester.com/sites/nixie/different/cathode%20poisoning/cathode-poisoning.htm)<br/>0 = once a day, either at midnight or at night mode start time (if enabled)<br/>1 = at the top of every hour<br/>2 = at the top of every minute<br/>(Will not trigger during night/away modes) |
56+
| 9 | Temperature format | 0 = Celsius<br/>1 = Fahrenheit<br/>(Clocks with temperature function enabled only) |
5757
| | **Alarm** | |
5858
| 10 | Alarm days | 0 = every day<br/>1 = work week only (per settings below)<br/>2 = weekend only |
5959
| 11 | Alarm signal | 0 = beeper<br/>1 = relay (if in switch mode, will stay on for 2 hours)<br/>(Clocks with both beeper and relay only) |

sixtube_lm/sixtube_lm.ino

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ Some are skipped when they wouldn't apply to a given clock's hardware config, se
6868
//but option locs should be maintained so EEPROM doesn't have to be reset after an upgrade.
6969
// General Alarm Timer Strike Night and away mode
7070
const byte optsNum[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,12,13, 20,21,22, 30,31,32, 40, 41, 42,43,44,45, 46, 47};
71-
const byte optsLoc[] = {16,17,18,19,20,22,26,45,46, 23,42,39,24, 25,43,40, 21,44,41, 27, 28, 30,32,33,34, 35, 37};
71+
const byte optsLoc[] = {16,17,18,19,20,22,26,46,45, 23,42,39,24, 25,43,40, 21,44,41, 27, 28, 30,32,33,34, 35, 37};
7272
const word optsDef[] = { 2, 1, 0, 0, 5, 0, 1, 0, 0, 0, 0,61, 9, 0, 0,61, 0, 0,61, 0,1320, 360, 0, 1, 5, 480,1020};
7373
const word optsMin[] = { 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,49, 0, 0, 0,49, 0, 0,49, 0, 0, 0, 0, 0, 0, 0, 0};
74-
const word optsMax[] = { 2, 5, 3, 1,20, 6, 4, 1, 3, 2, 1,88,60, 1, 1,88, 4, 1,88, 2,1439,1439, 2, 6, 6,1439,1439};
74+
const word optsMax[] = { 2, 5, 3, 1,20, 6, 4, 2, 1, 2, 1,88,60, 1, 1,88, 4, 1,88, 2,1439,1439, 2, 6, 6,1439,1439};
7575

7676
//RTC objects
7777
DS3231 ds3231; //an object to access the ds3231 specifically (temp, etc)
@@ -621,27 +621,30 @@ void checkRTC(bool force){
621621
fnSetPg = 0; fn = fnIsTime; signalStart(fnIsAlarm,1,0);
622622
} //end toddow check
623623
} //end alarm trigger
624-
//If cleaner is set to option value 0 (at night end time, or alarm time if night end is 0:00), run it at that time
625-
if(readEEPROM(46,false)==0 && tod.hour()*60+tod.minute()==(readEEPROM(30,true)==0?readEEPROM(0,true):readEEPROM(30,true))) {
626-
cleanRemain = 51; //five cycles. loop() will pick this up
627-
}
628624
}
629-
if(tod.second()==30 && fn==fnIsTime && fnSetPg==0 && unoffRemain==0) { //At bottom of minute, maybe show date - not when unoffing
625+
//At bottom of minute, see if we should show the date
626+
if(tod.second()==30 && fn==fnIsTime && fnSetPg==0 && unoffRemain==0) {
630627
if(readEEPROM(18,false)>=2) { fn = fnIsDate; inputLast = now; updateDisplay(); }
631628
if(readEEPROM(18,false)==3) { startScroll(); }
632629
}
633-
if(tod.second()==1) { //If cleaner is set to option value >0, run the cleaner at second :01 as applicable
634-
switch(readEEPROM(46,false)) {
635-
case 1: //at 00:00:01
636-
if(tod.hour()==0 && tod.minute()==0) cleanRemain = 51; //five cycles
630+
//Anti-poisoning routine triggering: start when applicable, and not at night, during setting, or after a button press (unoff)
631+
if(tod.second()<2 && displayDim==2 && fnSetPg==0 && unoffRemain==0) {
632+
switch(readEEPROM(46,false)) { //how often should the routine run?
633+
case 0: //every day
634+
if(readEEPROM(27,false)>0? //is night mode enabled?
635+
tod.second()==0 && tod.hour()*60+tod.minute()==readEEPROM(28,true): //if so, at start of night mode (at second :00 before dim is in effect)
636+
tod.second()==1 && tod.hour()*60+tod.minute()==0) //if not, at 00:00:01
637+
cleanRemain = 51; //run routine for five cycles
637638
break;
638-
case 2: //at :00:01
639-
if(tod.minute()==0) cleanRemain = 51; //five cycles
639+
case 1: //every hour
640+
if(tod.second()==1 && tod.minute()==0) //at min/sec :00:01
641+
cleanRemain = 51; //run routine for five cycles
640642
break;
641-
case 3: //at :01
642-
cleanRemain = 11; //one cycle
643+
case 2: //every minute
644+
if(tod.second()==1) //at second :01
645+
cleanRemain = 11; //run routine for one cycle
643646
break;
644-
default: break; //case 0 is handled at top of minute
647+
default: break;
645648
}
646649
}
647650

@@ -876,8 +879,8 @@ void updateDisplay(){
876879
//issue: moving from off alarm to next fn briefly shows alarm in full brightness. I think because of the display delays. TODO
877880
word todmins = tod.hour()*60+tod.minute();
878881
//In order of precedence:
879-
//temporary unoff
880-
if(unoffRemain > 0) displayDim = 2; //TODO can we fade between dim states?
882+
//temporary unoff, if off (not dim)
883+
if(unoffRemain>0 && displayDim==0) displayDim = 2; //TODO can we fade between dim states?
881884
//clock at work: away on weekends, all day
882885
else if( readEEPROM(32,false)==1 && !isDayInRange(readEEPROM(33,false),readEEPROM(34,false),toddow) ) displayDim = 0;
883886
//clock at home: away on weekdays, during office hours only

0 commit comments

Comments
 (0)