X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FInstrumentation%2Fturn_indicator.cxx;h=973b4054aad99d6f46df5edf915ace15cf5f8536;hb=61812ef4b88f5aa74e9cc0630c84d6fc6b4a51cd;hp=f04c33369d080600975f2901f092710f3313d168;hpb=e7ef4f4772fab30b67e1569553453bebbd0440ff;p=flightgear.git diff --git a/src/Instrumentation/turn_indicator.cxx b/src/Instrumentation/turn_indicator.cxx index f04c33369..973b4054a 100644 --- a/src/Instrumentation/turn_indicator.cxx +++ b/src/Instrumentation/turn_indicator.cxx @@ -4,8 +4,8 @@ // This file is in the Public Domain and comes with no warranty. #include -#include STL_IOSTREAM -#include STL_STRING +#include +#include #include #include "turn_indicator.hxx" @@ -20,29 +20,8 @@ TurnIndicator::TurnIndicator ( SGPropertyNode *node) : _last_rate(0), - name("turn-indicator"), - num(0) -{ - int i; - for ( i = 0; i < node->nChildren(); ++i ) { - SGPropertyNode *child = node->getChild(i); - string cname = child->getName(); - string cval = child->getStringValue(); - if ( cname == "name" ) { - name = cval; - } else if ( cname == "number" ) { - num = child->getIntValue(); - } else { - SG_LOG( SG_INSTR, SG_WARN, "Error in turn-indicator config logic" ); - if ( name.length() ) { - SG_LOG( SG_INSTR, SG_WARN, "Section = " << name ); - } - } - } -} - -TurnIndicator::TurnIndicator () : - _last_rate(0) + _name(node->getStringValue("name", "turn-indicator")), + _num(node->getIntValue("number", 0)) { } @@ -54,9 +33,9 @@ void TurnIndicator::init () { string branch; - branch = "/instrumentation/" + name; + branch = "/instrumentation/" + _name; - SGPropertyNode *node = fgGetNode(branch.c_str(), num, true ); + SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true ); _roll_rate_node = fgGetNode("/orientation/roll-rate-degps", true); _yaw_rate_node = fgGetNode("/orientation/yaw-rate-degps", true); _electric_current_node = @@ -69,8 +48,8 @@ TurnIndicator::bind () { std::ostringstream temp; string branch; - temp << num; - branch = "/instrumentation/" + name + "[" + temp.str() + "]"; + temp << _num; + branch = "/instrumentation/" + _name + "[" + temp.str() + "]"; fgTie((branch + "/serviceable").c_str(), &_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable); @@ -83,8 +62,8 @@ TurnIndicator::unbind () { std::ostringstream temp; string branch; - temp << num; - branch = "/instrumentation/" + name + "[" + temp.str() + "]"; + temp << _num; + branch = "/instrumentation/" + _name + "[" + temp.str() + "]"; fgUntie((branch + "/serviceable").c_str()); fgUntie((branch + "/serviceable").c_str()); @@ -94,7 +73,7 @@ void TurnIndicator::update (double dt) { // Get the spin from the gyro - double power = _electric_current_node->getDoubleValue() / 24.0; + double power = _electric_current_node->getDoubleValue() / 12.0; _gyro.set_power_norm(power); _gyro.update(dt); double spin = _gyro.get_spin_norm();