From 585e776e3ea99b4c0b9b65467fe1b415f6e0c0f0 Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 4 Jul 2016 23:11:02 -0400 Subject: [PATCH] Small refactor to intval_2_1_serial --- ino/intval2_1_serial/intval2_1_serial.ino | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ino/intval2_1_serial/intval2_1_serial.ino b/ino/intval2_1_serial/intval2_1_serial.ino index d8dda9b..76a8697 100644 --- a/ino/intval2_1_serial/intval2_1_serial.ino +++ b/ino/intval2_1_serial/intval2_1_serial.ino @@ -316,7 +316,6 @@ void Read_timed () { if (!timed_paused) { if (timer - frame_start > timed_open && timer - frame_start < timed_open + timed_delay) { - timed_paused = true; Pause_timed(); } else if (timer - frame_start > timed_open + timed_delay) { micro_position = digitalRead(PIN_MICRO); @@ -325,19 +324,20 @@ void Read_timed () { } 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(); } - } void Pause_timed () { + timed_paused = true; analogWrite(PIN_MOTOR_FORWARD, 0); analogWrite(PIN_MOTOR_BACKWARD, 0); } void Start_timed () { + timed_paused = false; if (cam_dir) { analogWrite(PIN_MOTOR_FORWARD, fwd_speed); analogWrite(PIN_MOTOR_BACKWARD, 0);