#ifndef Scenerunner_h
#define Scenerunner_h

#include "Arduino.h" 
#include <LiquidCrystal.h>
#include <BasicStepperDriver.h>

class Scenerunner {

  public:
    // configuration values
    int tSettle = 1000;
    int tFocus = 1000;
    int tShutter = 1000;
    bool bReturn = true;
    bool bDarkenLcd = false;

    // scene values
    int nSteps = 10;
    float distance = 0.5;

    Scenerunner(LiquidCrystal *lcd, BasicStepperDriver *stepper, int pin_focus, int pin_shutter, int pin_backlight);
    void start();
    bool isBusy();
    void nextAction();

  private:
    LiquidCrystal *_lcd;
    BasicStepperDriver *_stepper;
    int _pin_focus;
    int _pin_shutter;
    int _pin_backlight;

    int step;
    enum RunStep { RUN_OFF, RUN_SETTLE, RUN_FOCUS, RUN_SHUTTER, RUN_MOVE, RUN_RETURN };
    RunStep runStep = RUN_OFF;
    unsigned long int runStepStart;

    void _runHandler_off();
    void _runHandler_settle();
    void _runHandler_focus();
    void _runHandler_shutter();
    void _runHandler_move();
    void _runHandler_return();

};

#endif
