improve output, count steps
This commit is contained in:
parent
69a47940ce
commit
780262155a
@ -12,9 +12,10 @@ Scenerunner::Scenerunner(LiquidCrystal *lcd, BasicStepperDriver *stepper, int pi
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Scenerunner::start() {
|
void Scenerunner::start() {
|
||||||
|
step = 1;
|
||||||
_lcd->clear();
|
_lcd->clear();
|
||||||
_lcd->print("Running...");
|
_lcd->print("Step ");
|
||||||
steps_left = nSteps;
|
_lcd->print(step);
|
||||||
runStep = RUN_SETTLE;
|
runStep = RUN_SETTLE;
|
||||||
runStepStart = millis();
|
runStepStart = millis();
|
||||||
}
|
}
|
||||||
@ -26,8 +27,13 @@ void Scenerunner::_runHandler_off() {
|
|||||||
|
|
||||||
void Scenerunner::_runHandler_settle() {
|
void Scenerunner::_runHandler_settle() {
|
||||||
_lcd->setCursor(0, 1);
|
_lcd->setCursor(0, 1);
|
||||||
_lcd->print("rS: SETTLE ");
|
_lcd->print("Settling ");
|
||||||
|
_lcd->print(tSettle);
|
||||||
|
_lcd->print("ms");
|
||||||
if (millis() >= runStepStart + tSettle) {
|
if (millis() >= runStepStart + tSettle) {
|
||||||
|
_lcd->clear();
|
||||||
|
_lcd->print("Step ");
|
||||||
|
_lcd->print(step);
|
||||||
runStep = RUN_FOCUS;
|
runStep = RUN_FOCUS;
|
||||||
runStepStart = millis();
|
runStepStart = millis();
|
||||||
}
|
}
|
||||||
@ -35,8 +41,13 @@ void Scenerunner::_runHandler_settle() {
|
|||||||
|
|
||||||
void Scenerunner::_runHandler_focus() {
|
void Scenerunner::_runHandler_focus() {
|
||||||
_lcd->setCursor(0, 1);
|
_lcd->setCursor(0, 1);
|
||||||
_lcd->print("rS: FOCUS ");
|
_lcd->print("Focusing ");
|
||||||
|
_lcd->print(tFocus);
|
||||||
|
_lcd->print("ms");
|
||||||
if (millis() >= runStepStart + tFocus) {
|
if (millis() >= runStepStart + tFocus) {
|
||||||
|
_lcd->clear();
|
||||||
|
_lcd->print("Step ");
|
||||||
|
_lcd->print(step);
|
||||||
runStep = RUN_SHUTTER;
|
runStep = RUN_SHUTTER;
|
||||||
runStepStart = millis();
|
runStepStart = millis();
|
||||||
}
|
}
|
||||||
@ -44,18 +55,36 @@ void Scenerunner::_runHandler_focus() {
|
|||||||
|
|
||||||
void Scenerunner::_runHandler_shutter() {
|
void Scenerunner::_runHandler_shutter() {
|
||||||
_lcd->setCursor(0, 1);
|
_lcd->setCursor(0, 1);
|
||||||
_lcd->print("rS: SHUTTER ");
|
_lcd->print("Shutter ");
|
||||||
|
_lcd->print(tShutter);
|
||||||
|
_lcd->print("ms");
|
||||||
if (millis() >= runStepStart + tShutter) {
|
if (millis() >= runStepStart + tShutter) {
|
||||||
|
if (step >= nSteps) {
|
||||||
|
_lcd->clear();
|
||||||
|
_lcd->print("Return to start");
|
||||||
|
runStep = RUN_RETURN;
|
||||||
|
runStepStart = millis();
|
||||||
|
} else {
|
||||||
|
step++;
|
||||||
|
_lcd->clear();
|
||||||
|
_lcd->print("Step ");
|
||||||
|
_lcd->print(step);
|
||||||
runStep = RUN_MOVE;
|
runStep = RUN_MOVE;
|
||||||
runStepStart = millis();
|
runStepStart = millis();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scenerunner::_runHandler_move() {
|
void Scenerunner::_runHandler_move() {
|
||||||
_lcd->setCursor(0, 1);
|
_lcd->setCursor(0, 1);
|
||||||
_lcd->print("rS: MOVE ");
|
_lcd->print("Moving ");
|
||||||
|
_lcd->print(distance);
|
||||||
|
_lcd->print("mm");
|
||||||
if (millis() >= runStepStart + 1234) {
|
if (millis() >= runStepStart + 1234) {
|
||||||
// dummy wait time
|
// dummy wait time
|
||||||
|
_lcd->clear();
|
||||||
|
_lcd->print("Step ");
|
||||||
|
_lcd->print(step);
|
||||||
runStep = RUN_SETTLE;
|
runStep = RUN_SETTLE;
|
||||||
runStepStart = millis();
|
runStepStart = millis();
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ class Scenerunner {
|
|||||||
int _pin_focus;
|
int _pin_focus;
|
||||||
int _pin_shutter;
|
int _pin_shutter;
|
||||||
|
|
||||||
int steps_left;
|
int step;
|
||||||
enum RunStep { RUN_OFF, RUN_SETTLE, RUN_FOCUS, RUN_SHUTTER, RUN_MOVE, RUN_RETURN };
|
enum RunStep { RUN_OFF, RUN_SETTLE, RUN_FOCUS, RUN_SHUTTER, RUN_MOVE, RUN_RETURN };
|
||||||
RunStep runStep = RUN_OFF;
|
RunStep runStep = RUN_OFF;
|
||||||
unsigned long int runStepStart;
|
unsigned long int runStepStart;
|
||||||
|
Loading…
Reference in New Issue
Block a user