connect camera, trivial shutter test in run menu

This commit is contained in:
Ronald Schaten 2022-02-07 18:02:25 +01:00
parent a49c234a8c
commit 7b31c7d0ec

View File

@ -36,8 +36,9 @@
// stepper motor
#define PIN_STEPPER_DIR A1
#define PIN_STEPPER_STEP A2
// on-board led
#define PIN_LED 13
// camera
#define PIN_CAMERA_FOCUS A3
#define PIN_CAMERA_SHUTTER A4
// motor configuration
#define STEPPER_STEPS 200
@ -84,6 +85,15 @@ result enter_jog() {
return proceed;
}
result enter_run() {
Serial.println("enter_run()");
lcd_print(0, "Running...");
lcd_print(1, "[sel] to exit");
digitalWrite(PIN_CAMERA_SHUTTER, HIGH);
state = STATE_RUN;
return proceed;
}
int tSettle = 100;
int tFocus = 500;
int tShutter = 500;
@ -120,7 +130,7 @@ MENU(scene, "Scene", doNothing, anyEvent, wrapStyle
MENU(mainMenu, "PhotoStepper", doNothing, noEvent, wrapStyle
,OP("Jog", enter_jog, enterEvent)
,OP("Run", doNothing, noEvent)
,OP("Run", enter_run, enterEvent)
,SUBMENU(scene)
,SUBMENU(configuration)
);
@ -212,7 +222,15 @@ void ButtonHandler_run(const ButtonParam& param) {
Serial.print("ButtonHandler_run(");
Serial.print(param.button);
Serial.print(") - ");
Serial.println("TODO");
switch (param.state) {
default:
Serial.println();
state = STATE_MENU;
mainMenu.dirty = true;
nav.doOutput();
break;
}
digitalWrite(PIN_CAMERA_SHUTTER, LOW);
}
void setup() {
@ -224,6 +242,12 @@ void setup() {
pinMode(PIN_LCD_BL, OUTPUT);
digitalWrite(PIN_LCD_BL, HIGH);
// setup camera connection
pinMode(PIN_CAMERA_FOCUS, OUTPUT);
digitalWrite(PIN_CAMERA_FOCUS, LOW);
pinMode(PIN_CAMERA_SHUTTER, OUTPUT);
digitalWrite(PIN_CAMERA_SHUTTER, LOW);
stepper.begin(STEPPER_RPM, STEPPER_MICROSTEPS);
stepper.setSpeedProfile(stepper.LINEAR_SPEED, STEPPER_ACCEL, STEPPER_DECEL);