From: Mikko Rasa Date: Sun, 5 Apr 2015 08:50:44 +0000 (+0300) Subject: Improve accessory turn-off logic in arducontrol driver X-Git-Url: http://git.tdb.fi/?p=r2c2.git;a=commitdiff_plain;h=bb7e754473aea2083c406b94060b9982c66f7473 Improve accessory turn-off logic in arducontrol driver In some cases the limit switch won't trigger properly, so we can't rely on the current dropping to determine success. --- diff --git a/source/libr2c2/arducontrol.cpp b/source/libr2c2/arducontrol.cpp index 8aced3b..3fc9f57 100644 --- a/source/libr2c2/arducontrol.cpp +++ b/source/libr2c2/arducontrol.cpp @@ -503,9 +503,11 @@ void ArduControl::tick() if(active_accessory && off_timeout) { - bool success = (monitor.get_peak()>0.35f && monitor.get_current()0.0f; + bool success = monitor.get_peak()>0.42f; + bool complete = (success && monitor.get_current()off_timeout || success) + if((t>off_timeout && got_peak) || complete) { Accessory &acc = *active_accessory;