From 83d2cda02939e450f858456915210625d634946d Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 2 Feb 2015 19:37:16 +0200 Subject: [PATCH] Add debug output for accessory switching in ArduControl --- source/libr2c2/arducontrol.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/libr2c2/arducontrol.cpp b/source/libr2c2/arducontrol.cpp index 0065c4d..8e28ea6 100644 --- a/source/libr2c2/arducontrol.cpp +++ b/source/libr2c2/arducontrol.cpp @@ -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))) -- 2.45.2