X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FInstrumentation%2Fheading_indicator.cxx;h=d95a1a0844488106d0b5cf42a3f49b905793cd98;hb=9d995907db00728da7eac9297ecbab93ed8a7400;hp=e4b0c2438ddc27ff91fa678d0d8f3f57d1b1e15c;hpb=9ab41ea15809c02ba46bf9e6911fbb1aa808b8b1;p=flightgear.git diff --git a/src/Instrumentation/heading_indicator.cxx b/src/Instrumentation/heading_indicator.cxx index e4b0c2438..d95a1a084 100644 --- a/src/Instrumentation/heading_indicator.cxx +++ b/src/Instrumentation/heading_indicator.cxx @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -17,7 +18,6 @@ #include
#include
- HeadingIndicator::HeadingIndicator ( SGPropertyNode *node ) : _name(node->getStringValue("name", "heading-indicator")), @@ -37,14 +37,25 @@ HeadingIndicator::init () branch = "/instrumentation/" + _name; SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true ); - _offset_node = node->getChild("offset-deg", 0, true); + if( NULL == (_offset_node = node->getChild("offset-deg", 0, false)) ) { + _offset_node = node->getChild("offset-deg", 0, true); + _offset_node->setDoubleValue( -fgGetDouble("/environment/magnetic-variation-deg") ); + } _heading_in_node = fgGetNode("/orientation/heading-deg", true); _suction_node = fgGetNode(_suction.c_str(), true); _heading_out_node = node->getChild("indicated-heading-deg", 0, true); _heading_bug_error_node = node->getChild("heading-bug-error-deg", 0, true); _heading_bug_node = node->getChild("heading-bug-deg", 0, true); + + reinit(); +} + +void +HeadingIndicator::reinit () +{ _last_heading_deg = (_heading_in_node->getDoubleValue() + _offset_node->getDoubleValue()); + _gyro.reinit(); } void