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