This commit is contained in:
Ronald Schaten 2022-02-10 18:33:33 +01:00
parent 3b674d75ab
commit 69a47940ce
2 changed files with 60 additions and 24 deletions

View File

@ -19,43 +19,72 @@ void Scenerunner::start() {
runStepStart = millis(); runStepStart = millis();
} }
void Scenerunner::nextAction() { void Scenerunner::_runHandler_off() {
_lcd->setCursor(0, 1); _lcd->setCursor(0, 1);
_lcd->print("rS: OFF ");
}
void Scenerunner::_runHandler_settle() {
_lcd->setCursor(0, 1);
_lcd->print("rS: SETTLE ");
if (millis() >= runStepStart + tSettle) {
runStep = RUN_FOCUS;
runStepStart = millis();
}
}
void Scenerunner::_runHandler_focus() {
_lcd->setCursor(0, 1);
_lcd->print("rS: FOCUS ");
if (millis() >= runStepStart + tFocus) {
runStep = RUN_SHUTTER;
runStepStart = millis();
}
}
void Scenerunner::_runHandler_shutter() {
_lcd->setCursor(0, 1);
_lcd->print("rS: SHUTTER ");
if (millis() >= runStepStart + tShutter) {
runStep = RUN_MOVE;
runStepStart = millis();
}
}
void Scenerunner::_runHandler_move() {
_lcd->setCursor(0, 1);
_lcd->print("rS: MOVE ");
if (millis() >= runStepStart + 1234) {
// dummy wait time
runStep = RUN_SETTLE;
runStepStart = millis();
}
}
void Scenerunner::_runHandler_return() {
_lcd->setCursor(0, 1);
_lcd->print("rS: RETURN ");
}
void Scenerunner::nextAction() {
switch (runStep) { switch (runStep) {
case RUN_OFF: case RUN_OFF:
_lcd->print("rS: OFF "); _runHandler_off();
break; break;
case RUN_SETTLE: case RUN_SETTLE:
_lcd->print("rS: SETTLE "); _runHandler_settle();
if (millis() >= runStepStart + tSettle) {
runStep = RUN_FOCUS;
runStepStart = millis();
}
break; break;
case RUN_FOCUS: case RUN_FOCUS:
_lcd->print("rS: FOCUS "); _runHandler_focus();
if (millis() >= runStepStart + tFocus) {
runStep = RUN_SHUTTER;
runStepStart = millis();
}
break; break;
case RUN_SHUTTER: case RUN_SHUTTER:
_lcd->print("rS: SHUTTER "); _runHandler_shutter();
if (millis() >= runStepStart + tShutter) {
runStep = RUN_MOVE;
runStepStart = millis();
}
break; break;
case RUN_MOVE: case RUN_MOVE:
_lcd->print("rS: MOVE "); _runHandler_move();
if (millis() >= runStepStart + 1234) {
// dummy wait time
runStep = RUN_SETTLE;
runStepStart = millis();
}
break; break;
case RUN_RETURN: case RUN_RETURN:
_lcd->print("rS: RETURN "); _runHandler_return();
break; break;
} }
} }

View File

@ -34,6 +34,13 @@ class Scenerunner {
RunStep runStep = RUN_OFF; RunStep runStep = RUN_OFF;
unsigned long int runStepStart; unsigned long int runStepStart;
void _runHandler_off();
void _runHandler_settle();
void _runHandler_focus();
void _runHandler_shutter();
void _runHandler_move();
void _runHandler_return();
}; };
#endif #endif