X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Farducontrol.cpp;h=3fc9f577e9cc5106d170f8a4ad586ea24fd8d2fe;hb=d0881a98a6240758ac1aeceaa9443d718ab1ad5c;hp=7b5fc108f09bf0864776c67b0a9ce7f717edd4c7;hpb=b85fa11e45805cd71383577642030d8d01f43447;p=r2c2.git diff --git a/source/libr2c2/arducontrol.cpp b/source/libr2c2/arducontrol.cpp index 7b5fc10..3fc9f57 100644 --- a/source/libr2c2/arducontrol.cpp +++ b/source/libr2c2/arducontrol.cpp @@ -208,7 +208,7 @@ void ArduControl::set_loco_function(unsigned id, unsigned func, bool state) throw invalid_argument("ArduControl::set_loco_function"); unsigned mask = 1<0 || loco.proto!=MM) { @@ -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;