implement run skeleton
This commit is contained in:
parent
886f72f03a
commit
3b674d75ab
@ -82,6 +82,7 @@ result enter_jog() {
|
||||
result enter_run() {
|
||||
Serial.println("enter_run()");
|
||||
state = STATE_RUN;
|
||||
scenerunner.start();
|
||||
return proceed;
|
||||
}
|
||||
|
||||
|
@ -11,10 +11,51 @@ Scenerunner::Scenerunner(LiquidCrystal *lcd, BasicStepperDriver *stepper, int pi
|
||||
_pin_shutter = pin_shutter;
|
||||
}
|
||||
|
||||
void Scenerunner::nextAction(){
|
||||
// TODO: implement actions
|
||||
void Scenerunner::start() {
|
||||
_lcd->clear();
|
||||
_lcd->print("Running...");
|
||||
_lcd->setCursor(0, 1);
|
||||
_lcd->print("[sel] to exit");
|
||||
steps_left = nSteps;
|
||||
runStep = RUN_SETTLE;
|
||||
runStepStart = millis();
|
||||
}
|
||||
|
||||
void Scenerunner::nextAction() {
|
||||
_lcd->setCursor(0, 1);
|
||||
switch (runStep) {
|
||||
case RUN_OFF:
|
||||
_lcd->print("rS: OFF ");
|
||||
break;
|
||||
case RUN_SETTLE:
|
||||
_lcd->print("rS: SETTLE ");
|
||||
if (millis() >= runStepStart + tSettle) {
|
||||
runStep = RUN_FOCUS;
|
||||
runStepStart = millis();
|
||||
}
|
||||
break;
|
||||
case RUN_FOCUS:
|
||||
_lcd->print("rS: FOCUS ");
|
||||
if (millis() >= runStepStart + tFocus) {
|
||||
runStep = RUN_SHUTTER;
|
||||
runStepStart = millis();
|
||||
}
|
||||
break;
|
||||
case RUN_SHUTTER:
|
||||
_lcd->print("rS: SHUTTER ");
|
||||
if (millis() >= runStepStart + tShutter) {
|
||||
runStep = RUN_MOVE;
|
||||
runStepStart = millis();
|
||||
}
|
||||
break;
|
||||
case RUN_MOVE:
|
||||
_lcd->print("rS: MOVE ");
|
||||
if (millis() >= runStepStart + 1234) {
|
||||
// dummy wait time
|
||||
runStep = RUN_SETTLE;
|
||||
runStepStart = millis();
|
||||
}
|
||||
break;
|
||||
case RUN_RETURN:
|
||||
_lcd->print("rS: RETURN ");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -9,9 +9,9 @@ class Scenerunner {
|
||||
|
||||
public:
|
||||
// configuration values
|
||||
int tSettle = 100;
|
||||
int tFocus = 500;
|
||||
int tShutter = 500;
|
||||
int tSettle = 1000;
|
||||
int tFocus = 1000;
|
||||
int tShutter = 1000;
|
||||
bool bReturn = true;
|
||||
bool bDarkenLcd = true;
|
||||
|
||||
@ -20,6 +20,7 @@ class Scenerunner {
|
||||
float distance = 0.5;
|
||||
|
||||
Scenerunner(LiquidCrystal *lcd, BasicStepperDriver *stepper, int pin_focus, int pin_shutter);
|
||||
void start();
|
||||
void nextAction();
|
||||
|
||||
private:
|
||||
@ -27,8 +28,11 @@ class Scenerunner {
|
||||
BasicStepperDriver *_stepper;
|
||||
int _pin_focus;
|
||||
int _pin_shutter;
|
||||
enum RunStep { RUN_OFF, RUN_SETTLE, RUN_FOCUS, RUN_SHUTTER, RUN_RETURN };
|
||||
|
||||
int steps_left;
|
||||
enum RunStep { RUN_OFF, RUN_SETTLE, RUN_FOCUS, RUN_SHUTTER, RUN_MOVE, RUN_RETURN };
|
||||
RunStep runStep = RUN_OFF;
|
||||
unsigned long int runStepStart;
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user