move calling adjustRPM out of the loop

Signed-off-by: Stepan Usatyuk <usaatyuk@ustk.me>
This commit is contained in:
2019-05-29 17:14:01 +03:00
parent b079e48880
commit 28cd7f1b4f

View File

@@ -131,6 +131,9 @@ unsigned int ms = 0;
ISR(TIMER2_COMP_vect) { ISR(TIMER2_COMP_vect) {
ms++; ms++;
if (ms % adjustDelay == 0) {
adjustRPM();
}
if (ms % eggStepperDelay == 0) { if (ms % eggStepperDelay == 0) {
eggStepper.doStep(); eggStepper.doStep();
} }
@@ -147,10 +150,6 @@ void updateExecution() {
} }
void loop() { void loop() {
unsigned long ms = millis();
if (ms % adjustDelay < 2) {
adjustRPM();
}
if (newCommand) { if (newCommand) {
newCommand = false; newCommand = false;
execCommand(); execCommand();