added class for scene runner

This commit is contained in:
Ronald Schaten 2022-02-10 00:45:08 +01:00
parent 7b31c7d0ec
commit c78aae8aed
3 changed files with 50 additions and 16 deletions

View File

@ -17,6 +17,7 @@
#include <menu.h> #include <menu.h>
#include <menuIO/liquidCrystalOut.h> #include <menuIO/liquidCrystalOut.h>
#include <menuIO/serialIO.h> #include <menuIO/serialIO.h>
#include "Scenerunner.h"
// analog keypad // analog keypad
#define PIN_BUTTON A0 #define PIN_BUTTON A0
@ -61,6 +62,8 @@ BasicStepperDriver stepper(STEPPER_STEPS, PIN_STEPPER_DIR, PIN_STEPPER_STEP);
enum State { STATE_MENU, STATE_JOG, STATE_RUN }; enum State { STATE_MENU, STATE_JOG, STATE_RUN };
State state = STATE_MENU; State state = STATE_MENU;
Scenerunner scenerunner;
void lcd_print(int line, String string) { void lcd_print(int line, String string) {
Serial.print("lcd_print("); Serial.print("lcd_print(");
Serial.print(line); Serial.print(line);
@ -94,38 +97,29 @@ result enter_run() {
return proceed; return proceed;
} }
int tSettle = 100; TOGGLE(scenerunner.bReturn, setReturn, "Return: ", doNothing, noEvent, wrapStyle
int tFocus = 500;
int tShutter = 500;
bool bReturn = true;
bool bDarkenLcd = true;
TOGGLE(bReturn, setReturn, "Return: ", doNothing, noEvent, wrapStyle
,VALUE("On", true, doNothing, noEvent) ,VALUE("On", true, doNothing, noEvent)
,VALUE("Off", false, doNothing, noEvent) ,VALUE("Off", false, doNothing, noEvent)
); );
TOGGLE(bDarkenLcd, setLcdBlackout, "DarkenLCD: ", doNothing, noEvent, wrapStyle TOGGLE(scenerunner.bDarkenLcd, setLcdBlackout, "DarkenLCD: ", doNothing, noEvent, wrapStyle
,VALUE("On", true, doNothing, noEvent) ,VALUE("On", true, doNothing, noEvent)
,VALUE("Off", false, doNothing, noEvent) ,VALUE("Off", false, doNothing, noEvent)
); );
MENU(configuration, "Configuration", doNothing, anyEvent, wrapStyle MENU(configuration, "Configuration", doNothing, anyEvent, wrapStyle
,FIELD(tSettle, "tSettle", "ms", 0, 2000, 100, 10, doNothing, noEvent, wrapStyle) ,FIELD(scenerunner.tSettle, "tSettle", "ms", 0, 2000, 100, 10, doNothing, noEvent, wrapStyle)
,EXIT("<Back") ,EXIT("<Back")
,SUBMENU(setLcdBlackout) ,SUBMENU(setLcdBlackout)
,SUBMENU(setReturn) ,SUBMENU(setReturn)
,FIELD(tShutter, "tShutter", "ms", 0, 2000, 100, 10, doNothing, noEvent, wrapStyle) ,FIELD(scenerunner.tShutter, "tShutter", "ms", 0, 2000, 100, 10, doNothing, noEvent, wrapStyle)
,FIELD(tFocus, "tFocus", "ms", 0, 2000, 100, 10, doNothing, noEvent, wrapStyle) ,FIELD(scenerunner.tFocus, "tFocus", "ms", 0, 2000, 100, 10, doNothing, noEvent, wrapStyle)
); );
int nSteps = 10;
float distance = 0.5;
MENU(scene, "Scene", doNothing, anyEvent, wrapStyle MENU(scene, "Scene", doNothing, anyEvent, wrapStyle
,FIELD(nSteps, "nSteps", "steps", 0, 100, 10, 1, doNothing, noEvent, wrapStyle) ,FIELD(scenerunner.nSteps, "nSteps", "steps", 0, 100, 10, 1, doNothing, noEvent, wrapStyle)
,EXIT("<Back") ,EXIT("<Back")
,FIELD(distance, "distance", "mm", 0.1, 10, 1, 0.1, doNothing, noEvent, wrapStyle) ,FIELD(scenerunner.distance, "distance", "mm", 0.1, 10, 1, 0.1, doNothing, noEvent, wrapStyle)
); );
MENU(mainMenu, "PhotoStepper", doNothing, noEvent, wrapStyle MENU(mainMenu, "PhotoStepper", doNothing, noEvent, wrapStyle
@ -271,4 +265,5 @@ void loop() {
break; break;
} }
stepper.nextAction(); stepper.nextAction();
scenerunner.nextAction();
} }

View File

@ -0,0 +1,10 @@
#include "Arduino.h"
#include "Scenerunner.h"
Scenerunner::Scenerunner() {
// TODO: initialize
}
void Scenerunner::nextAction(){
// TODO: implement actions
}

View File

@ -0,0 +1,29 @@
#ifndef Scenerunner_h
#define Scenerunner_h
#include "Arduino.h"
class Scenerunner {
public:
// configuration values
int tSettle = 100;
int tFocus = 500;
int tShutter = 500;
bool bReturn = true;
bool bDarkenLcd = true;
// scene values
int nSteps = 10;
float distance = 0.5;
Scenerunner();
void nextAction();
private:
enum RunStep { RUN_OFF, RUN_SETTLE, RUN_FOCUS, RUN_SHUTTER, RUN_RETURN };
RunStep runStep = RUN_OFF;
};
#endif