X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Farducontrol.cpp;h=1bb48d47f88eac60a301fc32720abccf33c83809;hb=f2de56825be33196785c82a1418056f9e7a34461;hp=4b89efac1ac57bb013548727fe71ec191c68f6ae;hpb=57628dfb3e1874ab73c0c3df02043a4f57feb4b1;p=r2c2.git diff --git a/source/libr2c2/arducontrol.cpp b/source/libr2c2/arducontrol.cpp index 4b89efa..1bb48d4 100644 --- a/source/libr2c2/arducontrol.cpp +++ b/source/libr2c2/arducontrol.cpp @@ -404,7 +404,7 @@ void ArduControl::tick() } } - while(!active_accessory && !accessory_queue.empty()) + while(power && !active_accessory && !accessory_queue.empty()) { Accessory &acc = *accessory_queue.front(); @@ -456,6 +456,8 @@ void ArduControl::tick() void ArduControl::flush() { + while(!command_queue.empty() || !accessory_queue.empty()) + tick(); } void ArduControl::save_state() const @@ -657,6 +659,12 @@ bool ArduControl::Queue::pop(T &item) return true; } +template +bool ArduControl::Queue::empty() const +{ + return items.empty(); +} + ArduControl::RefreshTask::RefreshTask(): next(cycle.end()),