@@ -197,7 +197,7 @@ void checkBtn(byte btn){
197
197
unsigned long now = millis ();
198
198
// If the button has just been pressed, and no other buttons are in use...
199
199
if (btnCur==0 && bnow==LOW) {
200
- btnCur = btn; btnCurHeld = 0 ; inputLast2 = inputLast; inputLast = millis () ;
200
+ btnCur = btn; btnCurHeld = 0 ; inputLast2 = inputLast; inputLast = now ;
201
201
ctrlEvt (btn,1 ); // hey, the button has been pressed
202
202
}
203
203
// If the button is being held...
@@ -816,7 +816,7 @@ void updateDisplay(){
816
816
817
817
if (cleanRemain) { // cleaning tubes
818
818
displayDim = 2 ;
819
- byte digit = (11 -cleanRemain)%10 ;
819
+ byte digit = 10 -((cleanRemain- 1 )% 10 ); // (11-cleanRemain)%10;
820
820
editDisplay (digit,0 ,0 ,true ,false );
821
821
editDisplay (digit,1 ,1 ,true ,false );
822
822
editDisplay (digit,2 ,2 ,true ,false );
@@ -1036,14 +1036,14 @@ void initOutputs() {
1036
1036
}
1037
1037
1038
1038
void cycleDisplay (){
1039
- unsigned long mils = millis ();
1039
+ unsigned long now = millis ();
1040
1040
1041
1041
// Other display code decides whether we should dim per function or time of day
1042
1042
bool dim = (displayDim==1 ?1 :0 );
1043
1043
// But if we're setting, decide here to dim for every other 500ms since we started setting
1044
1044
if (fnSetPg>0 ) {
1045
- if (setStartLast==0 ) setStartLast = mils ;
1046
- dim = 1 -(((unsigned long )(mils -setStartLast)/500 )%2 );
1045
+ if (setStartLast==0 ) setStartLast = now ;
1046
+ dim = 1 -(((unsigned long )(now -setStartLast)/500 )%2 );
1047
1047
} else {
1048
1048
if (setStartLast>0 ) setStartLast=0 ;
1049
1049
}
@@ -1056,7 +1056,7 @@ void cycleDisplay(){
1056
1056
}
1057
1057
else { // fading enabled
1058
1058
if (fadeStartLast==0 ) { // not fading - time to fade?
1059
- for (byte i=0 ; i<6 ; i++) if (displayNext[i] != displayLast[i]) { fadeStartLast = mils ; break ; }
1059
+ for (byte i=0 ; i<6 ; i++) if (displayNext[i] != displayLast[i]) { fadeStartLast = now ; break ; }
1060
1060
}
1061
1061
if (fadeStartLast!=0 ) { // currently fading
1062
1062
// let the next digit steal some display time from the last digit
@@ -1065,8 +1065,8 @@ void cycleDisplay(){
1065
1065
// at 10ms, next = ((10*(6-1))/20)+1 = 3; last = (6-nextDur) = 3; ...
1066
1066
// at 20ms, next = ((20*(6-1))/20)+1 = 6; next = total, so fade is over!
1067
1067
// TODO facilitate longer fades by writing a tweening function that smooths the frames, i.e. 111121222 - or use delayMicroseconds as below
1068
- // TODO does this have more problems with the mils rollover issue?
1069
- fadeNextDur = (((unsigned long )(mils -fadeStartLast)*(fadeDur-1 ))/(readEEPROM (20 ,false )*10 ))+1 ;
1068
+ // TODO does this have more problems with the millis rollover issue?
1069
+ fadeNextDur = (((unsigned long )(now -fadeStartLast)*(fadeDur-1 ))/(readEEPROM (20 ,false )*10 ))+1 ;
1070
1070
if (fadeNextDur >= fadeLastDur) { // fade is over
1071
1071
fadeStartLast = 0 ;
1072
1072
fadeNextDur = 0 ;
0 commit comments