Skip to content

Commit 2ccae7e

Browse files
committed
network: settings: time/date, alarm, fn/display bugfixes
1 parent 85b48bf commit 2ccae7e

File tree

3 files changed

+125
-58
lines changed

3 files changed

+125
-58
lines changed

arduino-nixie/arduino-nixie.ino

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ bool isDSTByHour(int y, byte m, byte d, byte h, bool setFlag); //used by network
150150
void calcSun(); //used by rtc
151151
void ctrlEvt(byte ctrl, byte evt); //used by input
152152
void updateDisplay(); //used by network
153+
void goToFn(byte thefn); //used by network
153154

154155
//These cpp files contain code that is conditionally included
155156
//based on the available hardware and settings in the config file.
@@ -618,6 +619,9 @@ void fnOptScroll(byte dir){
618619
fnOptScroll(dir);
619620
}
620621
}
622+
void goToFn(byte thefn){ //A shortcut that also sets inputLast per human activity
623+
fn = thefn; inputLast = millis(); inputLastTODMins = rtcGetHour()*60+rtcGetMinute();
624+
}
621625

622626
void switchAlarm(byte dir){
623627
//0=down, 1=up, 2=toggle
@@ -833,7 +837,7 @@ void checkRTC(bool force){
833837
}
834838
//At bottom of minute, see if we should show the date
835839
if(rtcGetSecond()==30 && fn==fnIsTime && fnSetPg==0 && unoffRemain==0 && versionRemain==0) { /*cleanRemain==0 && scrollRemain==0 && */
836-
if(readEEPROM(18,false)>=2) { fn = fnIsDate; inputLast = now; inputLastTODMins = rtcGetHour()*60+rtcGetMinute(); fnPg = 254; updateDisplay(); }
840+
if(readEEPROM(18,false)>=2) { goToFn(fnIsDate); fnPg = 254; updateDisplay(); }
837841
//if(readEEPROM(18,false)==3) { startScroll(); }
838842
}
839843
//Anti-poisoning routine triggering: start when applicable, and not at night, during setting, or after a button press (unoff)
@@ -1346,6 +1350,7 @@ void updateDisplay(){
13461350
break; //end fnIsDate
13471351
//fnIsDayCount removed in favor of paginated calendar
13481352
case fnIsAlarm: //alarm
1353+
displayDim = (readEEPROM(2,false)?2:1); //status bright/dim
13491354
word almTime; almTime = readEEPROM(0,true);
13501355
editDisplay(almTime/60, 0, 1, readEEPROM(19,false), true); //hours with leading zero
13511356
editDisplay(almTime%60, 2, 3, true, true);
@@ -1355,7 +1360,6 @@ void updateDisplay(){
13551360
editDisplay(readEEPROM(2,false),4,4,false,true);
13561361
blankDisplay(5,5,true);
13571362
}
1358-
displayDim = (readEEPROM(2,false)?2:1); //status bright/dim
13591363
break;
13601364
case fnIsTimer: //timer - display time
13611365
unsigned long td; td = (!(timerState&1)? timerTime: //If stopped, use stored duration

arduino-nixie/dispMAX7219.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ void cycleDisplay(){
8383
if((unsigned long)(now-displayBlinkStart)>=500){ displayBlinkStart = 0; sendToMAX7219(0,5); }
8484
}
8585
//Other display code decides whether we should dim per function or time of day
86-
bool dim = (displayDim==1?1:0);
86+
bool dim = (displayDim==1?1:0); //2 should also 0
8787
//But if we're setting, decide here to dim for every other 500ms since we started setting
8888
if(fnSetPg>0) {
8989
if(setStartLast==0) setStartLast = now;
@@ -114,10 +114,12 @@ void editDisplay(word n, byte posStart, byte posEnd, bool leadingZeros, bool fad
114114
}
115115
displayNext[posEnd-i] = (i==0&&n==0 ? 0 : (n>=place ? (n/place)%10 : (leadingZeros?0:15)));
116116
}
117+
cycleDisplay(); //fixes brightness
117118
sendToMAX7219(posStart,posEnd);
118119
}
119120
void blankDisplay(byte posStart, byte posEnd, byte fade){
120121
for(byte i=posStart; i<=posEnd; i++) { displayNext[i]=15; }
122+
cycleDisplay(); //fixes brightness
121123
sendToMAX7219(posStart,posEnd);
122124
}
123125

0 commit comments

Comments
 (0)