completion text and time since finish + temp
This commit is contained in:
parent
505db01de1
commit
8ec2f57e15
@ -29,7 +29,7 @@ struct Profile {
|
||||
|
||||
// Profiles definition
|
||||
Profile profiles[] = {
|
||||
{"Test", {{49, 1}, {51, 1}, {55, 1}, {45, 1}}, 4},
|
||||
{"Test", {{49, 1}, {51, 1}}, 2},
|
||||
{"Пшеница", {{47, 40}, {55, 40}, {65, 20}, {72, 20}, {85, 20}}, 5},
|
||||
{"Veggies Sous Vide", {{85, 120}}, 1},
|
||||
{"Фитаза/Протеаза", {{47, 120}, {53, 120}, {65, 150}, {72, 60}, {90, 105}, {50, 60}}, 6},
|
||||
@ -50,6 +50,8 @@ unsigned long totalStartTime;
|
||||
unsigned long ssrLastSwitchTime;
|
||||
unsigned long totalElapsedTime;
|
||||
unsigned long totalProcessTime;
|
||||
unsigned long finishTime = 0;
|
||||
bool isComplete = false;
|
||||
const int ssrSwitchInterval = 1000; // SSR switching interval in milliseconds
|
||||
|
||||
// Buffer for formatted time strings
|
||||
@ -95,32 +97,46 @@ void loop() {
|
||||
}
|
||||
|
||||
// Check if the phase duration is complete
|
||||
if ((unsigned long)((currentTime - phaseStartTime) / 1000) >= (unsigned long)activeProfile.phases[currentPhase].duration * 60) {
|
||||
if (!isComplete && (unsigned long)((currentTime - phaseStartTime) / 1000) >= (unsigned long)activeProfile.phases[currentPhase].duration * 60) {
|
||||
currentPhase++;
|
||||
if (currentPhase >= activeProfile.numPhases) {
|
||||
oled.clear();
|
||||
oled.print("Complete");
|
||||
isComplete = true;
|
||||
finishTime = currentTime;
|
||||
Setpoint = 45; // Set target temperature to 45°C
|
||||
digitalWrite(ssrPin, LOW); // Turn off the heater
|
||||
return; // Stop further execution
|
||||
}
|
||||
} else {
|
||||
phaseStartTime = currentTime; // Reset the start time for the new phase
|
||||
Setpoint = activeProfile.phases[currentPhase].temperature;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Display all phases and highlight the current one
|
||||
printPhases(currentPhase, currentTime - phaseStartTime);
|
||||
printPhases(currentPhase, currentTime - phaseStartTime, currentTime);
|
||||
|
||||
oled.update();
|
||||
|
||||
delay(1000); // Update every second
|
||||
}
|
||||
|
||||
void printPhases(int currentPhase, unsigned long phaseElapsedTime) {
|
||||
void printPhases(int currentPhase, unsigned long phaseElapsedTime, unsigned long currentTime) {
|
||||
oled.clear();
|
||||
|
||||
if (isComplete) {
|
||||
// Show completion time and current temperature instead of the title
|
||||
oled.setCursor(0, 0);
|
||||
oled.invertText(true);
|
||||
oled.print("Done! ");
|
||||
formatTime((currentTime - finishTime) / 1000, timeBuffer); // Time since completion
|
||||
oled.print(timeBuffer);
|
||||
oled.print(" ");
|
||||
oled.print((int)Input);
|
||||
oled.print("c");
|
||||
oled.invertText(false);
|
||||
} else {
|
||||
oled.setCursor(0, 0);
|
||||
oled.print(activeProfile.name);
|
||||
}
|
||||
|
||||
// Display the totals and current state on the OLED
|
||||
oled.setCursor(18, 1);
|
||||
formatTime(totalElapsedTime, timeBuffer);
|
||||
@ -130,7 +146,7 @@ void printPhases(int currentPhase, unsigned long phaseElapsedTime) {
|
||||
oled.print(timeBuffer);
|
||||
|
||||
for (int i = 0; i < activeProfile.numPhases; i++) {
|
||||
if (i == currentPhase) {
|
||||
if (i == currentPhase && !isComplete) {
|
||||
oled.invertText(true); // Invert text for the current phase
|
||||
|
||||
oled.setCursor(0, i + 2); // Set cursor to the row corresponding to the phase
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user