pass stepper to scenerunner()

This commit is contained in:
Ronald Schaten 2022-02-10 15:06:36 +01:00
parent 431494723d
commit df80dfe5c1
3 changed files with 7 additions and 3 deletions

View File

@ -62,7 +62,7 @@ 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(&lcd); Scenerunner scenerunner(&lcd, &stepper);
// === // ===
// Order of menu entries looks chaotic. It makes sense on screen. // Order of menu entries looks chaotic. It makes sense on screen.

View File

@ -1,10 +1,12 @@
#include "Arduino.h" #include "Arduino.h"
#include <LiquidCrystal.h> #include <LiquidCrystal.h>
#include <BasicStepperDriver.h>
#include "Scenerunner.h" #include "Scenerunner.h"
Scenerunner::Scenerunner(LiquidCrystal *lcd) { Scenerunner::Scenerunner(LiquidCrystal *lcd, BasicStepperDriver *stepper) {
_lcd = lcd; _lcd = lcd;
_stepper = stepper;
} }
void Scenerunner::nextAction(){ void Scenerunner::nextAction(){

View File

@ -3,6 +3,7 @@
#include "Arduino.h" #include "Arduino.h"
#include <LiquidCrystal.h> #include <LiquidCrystal.h>
#include <BasicStepperDriver.h>
class Scenerunner { class Scenerunner {
@ -18,11 +19,12 @@ class Scenerunner {
int nSteps = 10; int nSteps = 10;
float distance = 0.5; float distance = 0.5;
Scenerunner(LiquidCrystal *lcd); Scenerunner(LiquidCrystal *lcd, BasicStepperDriver *stepper);
void nextAction(); void nextAction();
private: private:
LiquidCrystal *_lcd; LiquidCrystal *_lcd;
BasicStepperDriver *_stepper;
enum RunStep { RUN_OFF, RUN_SETTLE, RUN_FOCUS, RUN_SHUTTER, RUN_RETURN }; enum RunStep { RUN_OFF, RUN_SETTLE, RUN_FOCUS, RUN_SHUTTER, RUN_RETURN };
RunStep runStep = RUN_OFF; RunStep runStep = RUN_OFF;