From: Mikko Rasa Date: Wed, 24 Nov 2010 07:01:47 +0000 (+0000) Subject: Emit signals from loco status command only when all data has been gathered X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=f4e02a59008181013e57cdf2a8cf1695e89b24bb;p=r2c2.git Emit signals from loco status command only when all data has been gathered Force Driver's reverse bit to sync with Train --- diff --git a/source/libr2c2/intellibox.cpp b/source/libr2c2/intellibox.cpp index 84d576b..4e6bb76 100644 --- a/source/libr2c2/intellibox.cpp +++ b/source/libr2c2/intellibox.cpp @@ -622,24 +622,22 @@ void Intellibox::process_reply(const Time::TimeStamp &t) unsigned speed = (data[0]<=1 ? 0 : data[0]*2/19+1); bool reverse = !(data[1]&0x20); - if(speed!=loco.speed || reverse!=loco.reverse) - { - loco.speed = speed; - loco.reverse = reverse; - signal_loco_speed.emit(addr, loco.speed, loco.reverse); - } + bool speed_changed = (speed!=loco.speed || reverse!=loco.reverse); + + loco.speed = speed; + loco.reverse = reverse; unsigned funcs = (data[1]&0xF)<<1; if(data[1]&0x10) funcs |= 1; - if(funcs!=loco.funcs) - { - unsigned changed = loco.funcs^funcs; - loco.funcs = funcs; - for(unsigned i=0; i<5; ++i) - if(changed&(1<