Commit 6af6de62 authored by João Lino's avatar João Lino

added debug to xCountTheTime to fix clockIgnore.

parent 2013d9d1
......@@ -92,6 +92,11 @@ template <class T> void debugPrintVar( char *name, const T& value ) {
Serial.print(value);
Serial.println("]");
}
void debugPrintFunction( char *name ) {
Serial.print("++++++++++++++++++++++++ ");
Serial.print(name);
Serial.println("++++++++++++++++++++++++");
}
// ######################### VARIABLES #########################
// ++++++++++++++++++++++++ State Machine ++++++++++++++++++++++++
......@@ -893,19 +898,26 @@ void MainMenu_Back() {
}
void xCountTheTime( int temperatureRange ) {
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,
if(!(basePT100.getCurrentTemperature() > (cookTemperature - temperatureRange) && basePT100.getCurrentTemperature() < (cookTemperature + temperatureRange))) {
clockIgnore += millis() - clockStartTime - clockCounter;
clockIgnore += now - clockStartTime - clockCounter;
#ifdef DEBUG
Serial.print("[clockIgnore:");
Serial.print(clockIgnore);
Serial.println("]");
debugPrintVar("clockIgnore", clockIgnore);
#endif
}
// Calculate the remaining time on the clock
clockCounter = cookTime - ((millis() - clockStartTime - clockIgnore) / 1000);
clockCounter = cookTime - (now - clockStartTime - clockIgnore);
#ifdef DEBUG
debugPrintVar("clockCounter", clockCounter);
#endif
}
bool isTimeLeft() {
......
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