]> git.tdb.fi Git - r2c2.git/commitdiff
Add debug output for accessory switching in ArduControl
authorMikko Rasa <tdb@tdb.fi>
Mon, 2 Feb 2015 17:37:16 +0000 (19:37 +0200)
committerMikko Rasa <tdb@tdb.fi>
Mon, 2 Feb 2015 17:37:16 +0000 (19:37 +0200)
source/libr2c2/arducontrol.cpp

index 0065c4dd5c5f534ce170d50ace90b851fce5e612..8e28ea66c9ce275142c0dbb9f59f42001e0acfd5 100644 (file)
@@ -296,6 +296,8 @@ void ArduControl::activate_accessory_by_mask(Accessory &acc, unsigned mask)
        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;
@@ -469,6 +471,8 @@ void ArduControl::tick()
                                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)))