From 137dd9b68d600cf7c74fc7e0039c41fcc7db56cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Lino?= Date: Wed, 12 Aug 2015 19:24:56 +0100 Subject: [PATCH] fixed time counting, for counting time in each stage. --- brew.ino | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/brew.ino b/brew.ino index c4d8622..74c0282 100644 --- a/brew.ino +++ b/brew.ino @@ -467,8 +467,8 @@ void displayStatus() { lcd.print(cookTemperature); // Calculate the numbers on the timer clock - int minutes = (clockCounter - clockIgnore) / 60; - int seconds = (clockCounter - clockIgnore) - minutes * 60; + int minutes = clockCounter / 60; + int seconds = clockCounter - minutes * 60; // Position the cursor at the begining of where the timer goes onto the screen lcd.setCursor (10, 1); @@ -900,34 +900,28 @@ 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 += now - clockStartTime - clockIgnore; - -#ifdef DEBUG - debugPrintVar("clockIgnore", clockIgnore); -#endif } // Calculate the remaining time on the clock clockCounter = cookTime - (now - clockStartTime - clockIgnore); #ifdef DEBUG - debugPrintVar("clockCounter", clockCounter); + debugPrintFunction("xCountTheTime"); + debugPrintVar("millis()", now); + debugPrintVar("clockStartTime", clockStartTime); + debugPrintVar("clockIgnore", clockIgnore); + debugPrintVar("clockCounter", clockCounter); #endif } bool isTimeLeft() { - if( clockCounter >= cookTime ) { - return false; + if( clockCounter > 0 ) { + return true; } - return true; + return false; } double ulWattToWindowTime( double ulAppliedWatts ) { -- 2.24.1