Hello everyone,
I am continuing with my Arduino dishwasher code. I have solved most of the bugs and implemented the resume cycle after power off function. Now I have to ask for help once again.
Why is it that, if I uncomment this part of the code in the file programFunctions.h, I can't select the program anymore? It's as if progIndex stayed stuck on 2 and it doesn't allow me to change it. Could anyone help me? I can't avoid using this function as it works very well for time counting, thanks
if (currentCycleState == cycleArray[progIndex].endPhase) {//se ti trovi nella fase finale del ciclo
timeToDisplay = timeArray[cycleArray[progIndex].endPhase];//mostri il tempo della fase finale
} else {
long elapsedStageTime = millis() - stageStartTime;//calcoli da quanto tempo è iniziata la fase
timeToDisplay = 0;
if (elapsedStageTime <= timeArray[currentCycleState]) { // se il tempo trascorso è minore della durata della fase in corso
for (byte i = currentCycleState + 1; i <= cycleArray[progIndex].endPhase; i++) { // sommi i tempi delle fasi successive
timeToDisplay += timeArray[i];
}
timeToDisplay += timeArray[currentCycleState]; // aggiungi il tempo della fase corrente
timeToDisplay -= elapsedStageTime; // diminuisci del tempo già trascorso nella fase corrente
} else { // altrimenti se il tempo trascorso è maggiore della durata della fase mostri il tempo delle fasi successive
for (byte i = currentCycleState + 1; i <= cycleArray[progIndex].endPhase; i++) { // sommi i tempi delle fasi successive
timeToDisplay += timeArray[i];
}
}
}
if (timeToDisplay / K >= 100) {
display.setCursor(0, 1);
} else if (timeToDisplay / K >= 10) {
display.setCursor(0, 2);
} else if (timeToDisplay / K < 10) {
display.setCursor(0, 3);
}
if (timeToDisplay == 99 && clearDone == false) {
display.clear();
clearDone = true;
} else if (timeToDisplay == 9 && clearDone == false) {
display.clear();
clearDone = true;
}
if (timeToDisplay == 98) {
clearDone = false;
}
display.setColonOn(false);
Serial.println(timeToDisplay / K);
display.print(timeToDisplay / K);
Arduino_Dishwasher_7SEG.zip (16.0 KB)