X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FInstrumentation%2Fturn_indicator.cxx;h=124186c1fec5537385a8d1559ead506238749f20;hb=f620af29cdc18ab7924055092e8f75cbe37aae2c;hp=26b3c8f690fd8fef3ee14964c96b4d59284a64c2;hpb=f614545fc5a6f0fb12a05344d9ee41b2a49cc04a;p=flightgear.git diff --git a/src/Instrumentation/turn_indicator.cxx b/src/Instrumentation/turn_indicator.cxx index 26b3c8f69..124186c1f 100644 --- a/src/Instrumentation/turn_indicator.cxx +++ b/src/Instrumentation/turn_indicator.cxx @@ -3,6 +3,11 @@ // // This file is in the Public Domain and comes with no warranty. +#include +#include STL_IOSTREAM +#include STL_STRING +#include + #include "turn_indicator.hxx" #include
#include
@@ -28,9 +33,9 @@ TurnIndicator::TurnIndicator ( SGPropertyNode *node) : } else if ( cname == "number" ) { num = child->getIntValue(); } else { - SG_LOG( SG_AUTOPILOT, SG_WARN, "Error in turn-indicator config logic" ); + SG_LOG( SG_INSTR, SG_WARN, "Error in turn-indicator config logic" ); if ( name.length() ) { - SG_LOG( SG_AUTOPILOT, SG_WARN, "Section = " << name ); + SG_LOG( SG_INSTR, SG_WARN, "Section = " << name ); } } } @@ -57,38 +62,40 @@ TurnIndicator::init () _electric_current_node = fgGetNode("/systems/electrical/outputs/turn-coordinator", true); _rate_out_node = node->getChild("indicated-turn-rate", 0, true); - - //_serviceable_node->setBoolValue(true); - } void TurnIndicator::bind () { + std::ostringstream temp; string branch; - branch = "/instrumentation/" + name + "/serviceable"; - fgTie(branch.c_str(), + temp << num; + branch = "/instrumentation/" + name + "[" + temp.str() + "]"; + + fgTie((branch + "/serviceable").c_str(), &_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable); - branch = "/instrumentation/" + name + "/spin"; - fgTie(branch.c_str(), + fgTie((branch + "/spin").c_str(), &_gyro, &Gyro::get_spin_norm, &Gyro::set_spin_norm); } void TurnIndicator::unbind () { + std::ostringstream temp; string branch; - branch = "/instrumentation/" + name + "/serviceable"; - fgUntie(branch.c_str()); - branch = "/instrumentation/" + name + "/spin"; - fgUntie(branch.c_str()); + temp << num; + branch = "/instrumentation/" + name + "[" + temp.str() + "]"; + + fgUntie((branch + "/serviceable").c_str()); + fgUntie((branch + "/serviceable").c_str()); } void TurnIndicator::update (double dt) { // Get the spin from the gyro - _gyro.set_power_norm(_electric_current_node->getDoubleValue()/60.0); + double power = _electric_current_node->getDoubleValue() / 12.0; + _gyro.set_power_norm(power); _gyro.update(dt); double spin = _gyro.get_spin_norm();