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();
}
void Scenerunner::nextAction() {
void Scenerunner::_runHandler_off() {
_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) {
case RUN_OFF:
_lcd->print("rS: OFF ");
_runHandler_off();
break;
case RUN_SETTLE:
_lcd->print("rS: SETTLE ");
if (millis() >= runStepStart + tSettle) {
runStep = RUN_FOCUS;
runStepStart = millis();
}
_runHandler_settle();
break;
case RUN_FOCUS:
_lcd->print("rS: FOCUS ");
if (millis() >= runStepStart + tFocus) {
runStep = RUN_SHUTTER;
runStepStart = millis();
}
_runHandler_focus();
break;
case RUN_SHUTTER:
_lcd->print("rS: SHUTTER ");
if (millis() >= runStepStart + tShutter) {
runStep = RUN_MOVE;
runStepStart = millis();
}
_runHandler_shutter();
break;
case RUN_MOVE:
_lcd->print("rS: MOVE ");
if (millis() >= runStepStart + 1234) {
// dummy wait time
runStep = RUN_SETTLE;
runStepStart = millis();
}
_runHandler_move();
break;
case RUN_RETURN:
_lcd->print("rS: RETURN ");
_runHandler_return();
break;
}
}

View File

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