1
0
Fork 0

Heading Indicator DG: Same behaviour as introduced to turn-indicator: use previous default power path unless <new-default-power-path> is set to 1, then follow the common naming scheme. Also set spin property again (was broken by my previous changes)

This commit is contained in:
Benedikt Wolf 2023-04-28 08:22:35 +02:00 committed by James Turner
parent aa2e31b35d
commit a0dcc81c4e
4 changed files with 21 additions and 1 deletions

View file

@ -29,7 +29,9 @@ HeadingIndicatorDG::HeadingIndicatorDG ( SGPropertyNode *node ) :
_last_heading_deg(0),
_last_indicated_heading_dg(0)
{
_powerSupplyPath = "/systems/electrical/outputs/DG[" + std::to_string( node->getIntValue("number", 0) ) + "]";
if( !node->getBoolValue("new-default-power-path", 0) ){
setDefaultPowerSupplyPath("/systems/electrical/outputs/DG");
}
readConfig(node, "heading-indicator-dg");
}
@ -53,6 +55,7 @@ HeadingIndicatorDG::init ()
_nav1_error_node = node->getChild("nav1-course-error-deg", 0, true);
_heading_out_node = node->getChild("indicated-heading-deg", 0, true);
_align_node = node->getChild("align-deg", 0, true);
_spin_node = node->getChild("spin", 0, true);
initServicePowerProperties(node);
@ -85,6 +88,8 @@ HeadingIndicatorDG::update (double dt)
double spin = _gyro.get_spin_norm();
double heading = _heading_in_node->getDoubleValue();
double offset = _offset_node->getDoubleValue();
_spin_node->setDoubleValue( spin );
// calculate scaling factor
double factor = POW6(spin);

View file

@ -31,6 +31,17 @@
* Output properties:
*
* /instrumentation/"name"/indicated-heading-deg
*
*
* Configuration:
*
* name
* number
* new-default-power-path: use /systems/electrical/outputs/"name"[ number ] instead of
* /systems/electrical/outputs/DG as the default power
* supply path (not used when power-supply is set)
* power-supply
* minimum-supply-volts
*/
class HeadingIndicatorDG : public AbstractInstrument
{
@ -64,4 +75,5 @@ private:
SGPropertyNode_ptr _yaw_rate_node;
SGPropertyNode_ptr _heading_bug_error_node;
SGPropertyNode_ptr _g_node;
SGPropertyNode_ptr _spin_node;
};

View file

@ -54,6 +54,7 @@ HeadingIndicatorFG::init ()
_nav1_error_node = node->getChild("nav1-course-error-deg", 0, true);
_heading_out_node = node->getChild("indicated-heading-deg", 0, true);
_off_node = node->getChild("off-flag", 0, true);
_spin_node = node->getChild("spin", 0, true);
initServicePowerProperties(node);
@ -75,6 +76,7 @@ HeadingIndicatorFG::update (double dt)
_gyro.set_power_norm(isServiceableAndPowered());
_gyro.update(dt);
double spin = _gyro.get_spin_norm();
_spin_node->setDoubleValue( spin );
if ( isServiceableAndPowered() && spin >= 0.25) {
_off_node->setBoolValue(false);

View file

@ -64,4 +64,5 @@ private:
SGPropertyNode_ptr _error_node;
SGPropertyNode_ptr _nav1_error_node;
SGPropertyNode_ptr _off_node;
SGPropertyNode_ptr _spin_node;
};