Commit 498caa00 authored by Tim Soderstrom's avatar Tim Soderstrom

Fixed timing issues!

parent 7325f311
......@@ -134,7 +134,7 @@ PID pid(&currentTemperature, &pidOutput, &targetTemperature, KP, KI, KD, DIRECT)
******************************/
// Dev Processes (These can eventually be in the EEPROM)
const byte processCount = 1;
const byte processCount = 2;
// Dev Processes
const DevProcess process[] =
{
......@@ -151,7 +151,21 @@ const DevProcess process[] =
{"Fix", 180, WHITE},
{"Rinse", 60, WHITE}
}
},
{
"Test",
75,
10,
41.1,
5,
{
{"Develop", 600, RED},
{"Stop", 60, YELLOW},
{"Bleach", 180, VIOLET},
{"Fix", 180, WHITE},
{"Rinse", 60, WHITE}
}
}
};
DevProcess currentProcess;
......
......@@ -51,7 +51,8 @@ void processStep(DevStep step, byte motorSpeed, byte motorDirectionInterval, int
lcd.setBacklight(step.color);
lcd.print(step.name);
previousMillis = millis();
while(timeRemainingMS >= 0)
{
currentMillis = millis();
......@@ -75,7 +76,13 @@ void processStep(DevStep step, byte motorSpeed, byte motorDirectionInterval, int
++tempUpdateCycle;
updateDisplay(int(timeRemainingMS / SECONDS_MS), currentTemperature);
timeRemainingMS -= SECONDS_MS;
previousMillis = millis();
/* This is clever - it takes time to do all the stuff above and this could
* cause drifting. So instead we update the previousMillis by 1000 (1 second)
* See: https://forum.arduino.cc/index.php?topic=587214.0
* Of note, the Timer library FTW?
*/
previousMillis += SECONDS_MS;
//previousMillis = millis();
}
}
}
......
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