Small refactor to intval_2_1_serial
This commit is contained in:
parent
08fb6353db
commit
585e776e3e
|
@ -316,7 +316,6 @@ void Read_timed () {
|
||||||
if (!timed_paused) {
|
if (!timed_paused) {
|
||||||
if (timer - frame_start > timed_open
|
if (timer - frame_start > timed_open
|
||||||
&& timer - frame_start < timed_open + timed_delay) {
|
&& timer - frame_start < timed_open + timed_delay) {
|
||||||
timed_paused = true;
|
|
||||||
Pause_timed();
|
Pause_timed();
|
||||||
} else if (timer - frame_start > timed_open + timed_delay) {
|
} else if (timer - frame_start > timed_open + timed_delay) {
|
||||||
micro_position = digitalRead(PIN_MICRO);
|
micro_position = digitalRead(PIN_MICRO);
|
||||||
|
@ -325,19 +324,20 @@ void Read_timed () {
|
||||||
}
|
}
|
||||||
delay(2);//smooths out signal
|
delay(2);//smooths out signal
|
||||||
}
|
}
|
||||||
} if (timed_paused && timer - frame_start > timed_open + timed_delay) {
|
}
|
||||||
timed_paused = false;
|
if (timed_paused && timer - frame_start > timed_open + timed_delay) {
|
||||||
Start_timed();
|
Start_timed();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pause_timed () {
|
void Pause_timed () {
|
||||||
|
timed_paused = true;
|
||||||
analogWrite(PIN_MOTOR_FORWARD, 0);
|
analogWrite(PIN_MOTOR_FORWARD, 0);
|
||||||
analogWrite(PIN_MOTOR_BACKWARD, 0);
|
analogWrite(PIN_MOTOR_BACKWARD, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Start_timed () {
|
void Start_timed () {
|
||||||
|
timed_paused = false;
|
||||||
if (cam_dir) {
|
if (cam_dir) {
|
||||||
analogWrite(PIN_MOTOR_FORWARD, fwd_speed);
|
analogWrite(PIN_MOTOR_FORWARD, fwd_speed);
|
||||||
analogWrite(PIN_MOTOR_BACKWARD, 0);
|
analogWrite(PIN_MOTOR_BACKWARD, 0);
|
||||||
|
|
Loading…
Reference in New Issue