X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Farducontrol.cpp;h=3d2d39b1a0b2aca8c13e8018a21f189ecbd975cd;hb=b746099bd0ed4aac2484b5125135d2c21c3c4082;hp=6d74f3719587e45a4a9ec2549cff1ab3b34e7a54;hpb=437ad8b3b19d2ba396551efa66723366364b1ad3;p=r2c2.git diff --git a/source/libr2c2/arducontrol.cpp b/source/libr2c2/arducontrol.cpp index 6d74f37..3d2d39b 100644 --- a/source/libr2c2/arducontrol.cpp +++ b/source/libr2c2/arducontrol.cpp @@ -401,6 +401,7 @@ void ArduControl::tick() unsigned lowest_bit = changes&~(changes-1); unsigned i; for(i=0; (lowest_bit>>i)>1; ++i) ; + active_index = i; acc.state.set(acc.state^lowest_bit); PendingCommand cmd(acc, Accessory::ACTIVATE, i); command_queue.push(cmd); @@ -415,7 +416,7 @@ void ArduControl::tick() if(t>off_timeout) { off_timeout = Time::TimeStamp(); - PendingCommand cmd(*active_accessory, Accessory::DEACTIVATE); + PendingCommand cmd(*active_accessory, Accessory::DEACTIVATE, active_index); command_queue.push(cmd); } }