Commit 137dd9b6 authored by João Lino's avatar João Lino

fixed time counting, for counting time in each stage.

parent db94319c
...@@ -467,8 +467,8 @@ void displayStatus() { ...@@ -467,8 +467,8 @@ void displayStatus() {
lcd.print(cookTemperature); lcd.print(cookTemperature);
// Calculate the numbers on the timer clock // Calculate the numbers on the timer clock
int minutes = (clockCounter - clockIgnore) / 60; int minutes = clockCounter / 60;
int seconds = (clockCounter - clockIgnore) - minutes * 60; int seconds = clockCounter - minutes * 60;
// Position the cursor at the begining of where the timer goes onto the screen // Position the cursor at the begining of where the timer goes onto the screen
lcd.setCursor (10, 1); lcd.setCursor (10, 1);
...@@ -900,34 +900,28 @@ void MainMenu_Back() { ...@@ -900,34 +900,28 @@ void MainMenu_Back() {
void xCountTheTime( int temperatureRange ) { void xCountTheTime( int temperatureRange ) {
unsigned long now = millis(); unsigned long now = millis();
#ifdef DEBUG
debugPrintFunction("xCountTheTime");
debugPrintVar("millis()", now);
debugPrintVar("clockStartTime", clockStartTime);
#endif
// Check if the machine is in the right temperature range, for the current mode, // Check if the machine is in the right temperature range, for the current mode,
if(!(basePT100.getCurrentTemperature() > (cookTemperature - temperatureRange) && basePT100.getCurrentTemperature() < (cookTemperature + temperatureRange))) { if(!(basePT100.getCurrentTemperature() > (cookTemperature - temperatureRange) && basePT100.getCurrentTemperature() < (cookTemperature + temperatureRange))) {
clockIgnore += now - clockStartTime - clockIgnore; clockIgnore += now - clockStartTime - clockIgnore;
#ifdef DEBUG
debugPrintVar("clockIgnore", clockIgnore);
#endif
} }
// Calculate the remaining time on the clock // Calculate the remaining time on the clock
clockCounter = cookTime - (now - clockStartTime - clockIgnore); clockCounter = cookTime - (now - clockStartTime - clockIgnore);
#ifdef DEBUG #ifdef DEBUG
debugPrintVar("clockCounter", clockCounter); debugPrintFunction("xCountTheTime");
debugPrintVar("millis()", now);
debugPrintVar("clockStartTime", clockStartTime);
debugPrintVar("clockIgnore", clockIgnore);
debugPrintVar("clockCounter", clockCounter);
#endif #endif
} }
bool isTimeLeft() { bool isTimeLeft() {
if( clockCounter >= cookTime ) { if( clockCounter > 0 ) {
return false; return true;
} }
return true; return false;
} }
double ulWattToWindowTime( double ulAppliedWatts ) { double ulWattToWindowTime( double ulAppliedWatts ) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment