Finalize bulb feature. Better protect against multiple camera functions
This commit is contained in:
parent
b31d194f62
commit
f250861344
|
|
@ -190,7 +190,6 @@ void Intval2::Close () {
|
|||
open = false;
|
||||
closed = false;
|
||||
close_start = millis();
|
||||
frame_start = millis();
|
||||
|
||||
if (!closed) {
|
||||
MotorStart();
|
||||
|
|
@ -204,6 +203,9 @@ void Intval2::ClosingStop () {
|
|||
closing = false;
|
||||
closed = true;
|
||||
close_avg = round(((timer - close_start) + close_avg) / 2);
|
||||
if (bulb) {
|
||||
timed_exposure_avg = round( ((timer - frame_start) + timed_exposure_avg) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
void Intval2::MotorStart () {
|
||||
|
|
@ -272,6 +274,7 @@ void Intval2::Button (uint8_t index) {
|
|||
// not pressed
|
||||
button_time = millis() - button_times[index]; //time?
|
||||
ButtonEnd(index, button_time);
|
||||
button_last[index] = millis();
|
||||
}
|
||||
}
|
||||
button_states[index] = val;
|
||||
|
|
@ -283,7 +286,7 @@ void Intval2::ButtonStart (uint8_t index) {
|
|||
BulbStart();
|
||||
}
|
||||
} else if (index == SPEED) {
|
||||
if (millis() - button_times[index] < 1000) {
|
||||
if (millis() - button_last[index] < 1000) {
|
||||
bulb = true;
|
||||
Output(OUTPUT_ONE, OUTPUT_LONG);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -62,8 +62,17 @@ class Intval2 {
|
|||
//BUTTON VAR
|
||||
volatile uint8_t button_states[4] = {1, 1, 1, 1};
|
||||
volatile unsigned long button_times[4] = {0, 0, 0, 0};
|
||||
volatile unsigned long button_last[4] = {0, 0, 0, 0};
|
||||
volatile unsigned long button_time = 0;
|
||||
|
||||
//OUTPUT VAR
|
||||
volatile boolean output = false;
|
||||
volatile boolean output_blink = false;
|
||||
volatile uint16_t output_ms = 0;
|
||||
volatile unsigned long output_time = 0;
|
||||
volatile uint8_t output_count = 0;
|
||||
volatile uint8_t output_i = 0;
|
||||
|
||||
//TIME VAR
|
||||
volatile unsigned long timer;
|
||||
volatile unsigned long frame_start = 0;
|
||||
|
|
@ -80,8 +89,6 @@ class Intval2 {
|
|||
volatile unsigned long exposure = 0;
|
||||
volatile unsigned long avg = 600;
|
||||
|
||||
|
||||
|
||||
void PinsInit();
|
||||
void ButtonsInit();
|
||||
void Button (uint8_t index);
|
||||
|
|
|
|||
Loading…
Reference in New Issue