darken LCD if configured to do so

This commit is contained in:
Ronald Schaten 2022-02-11 22:45:48 +01:00
parent 4952e012a6
commit f465359eeb
3 changed files with 9 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 };
State state = STATE_MENU;
Scenerunner scenerunner(&lcd, &stepper, PIN_CAMERA_FOCUS, PIN_CAMERA_SHUTTER);
Scenerunner scenerunner(&lcd, &stepper, PIN_CAMERA_FOCUS, PIN_CAMERA_SHUTTER, PIN_LCD_BL);
// ===
// Order of menu entries looks chaotic. It makes sense on screen.

View File

@ -4,11 +4,12 @@
#include "Scenerunner.h"
Scenerunner::Scenerunner(LiquidCrystal *lcd, BasicStepperDriver *stepper, int pin_focus, int pin_shutter) {
Scenerunner::Scenerunner(LiquidCrystal *lcd, BasicStepperDriver *stepper, int pin_focus, int pin_shutter, int pin_backlight) {
_lcd = lcd;
_stepper = stepper;
_pin_focus = pin_focus;
_pin_shutter = pin_shutter;
_pin_backlight = pin_backlight;
}
void Scenerunner::start() {
@ -51,6 +52,9 @@ void Scenerunner::_runHandler_focus() {
_lcd->print(step);
runStep = RUN_SHUTTER;
runStepStart = millis();
if (bDarkenLcd) {
digitalWrite(_pin_backlight, LOW);
}
digitalWrite(_pin_shutter, HIGH);
}
}
@ -63,6 +67,7 @@ void Scenerunner::_runHandler_shutter() {
if (millis() >= runStepStart + tShutter) {
digitalWrite(_pin_focus, LOW);
digitalWrite(_pin_shutter, LOW);
digitalWrite(_pin_backlight, HIGH);
if (step >= nSteps) {
_lcd->clear();
_lcd->print("Return to start");

View File

@ -19,7 +19,7 @@ class Scenerunner {
int nSteps = 10;
float distance = 0.5;
Scenerunner(LiquidCrystal *lcd, BasicStepperDriver *stepper, int pin_focus, int pin_shutter);
Scenerunner(LiquidCrystal *lcd, BasicStepperDriver *stepper, int pin_focus, int pin_shutter, int pin_backlight);
void start();
void nextAction();
@ -28,6 +28,7 @@ class Scenerunner {
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 };