unsigned bit = mask&~(mask-1);
for(active_index=0; (bit>>active_index)>1; ++active_index) ;
acc.state.set((acc.state&~bit)|(acc.target&bit));
+ if(debug>=1)
+ IO::print("Setting accessory %d bit %d, state=%d\n", acc.address, active_index, acc.state.pending);
PendingCommand cmd(acc, Accessory::ACTIVATE, active_index);
command_queue.push(cmd);
active_accessory = &acc;
acc.uncertain &= ~bit;
else if(acc.kind==Accessory::TURNOUT && monitor.get_peak()<0.5f)
{
+ if(debug>=1)
+ IO::print("Peak current only %.2f A\n", monitor.get_peak());
signal_turnout_failed.emit(acc.address);
acc.state.rollback();
if(acc.valid_states&(1<<(acc.target^bit)))