1
0
Fork 0

Turn Indicator:

* revert to old default power supply path (/systems/electrical/outputs/turn-coordinator instead of .../turn-indicator) for compatibility reasons
* fix property instrumentation/turn-indicator/spin not being updated
This commit is contained in:
Benedikt Wolf 2023-04-24 08:00:54 +02:00 committed by James Turner
parent 76097ce93c
commit aa2e31b35d
2 changed files with 29 additions and 3 deletions

View file

@ -26,6 +26,9 @@ using std::string;
TurnIndicator::TurnIndicator ( SGPropertyNode *node) : TurnIndicator::TurnIndicator ( SGPropertyNode *node) :
_last_rate(0) _last_rate(0)
{ {
if( !node->getBoolValue("new-default-power-path", 0) ){
setDefaultPowerSupplyPath("/systems/electrical/outputs/turn-coordinator");
}
readConfig(node, "turn-indicator"); readConfig(node, "turn-indicator");
} }
@ -42,6 +45,7 @@ TurnIndicator::init ()
_roll_rate_node = fgGetNode("/orientation/roll-rate-degps", true); _roll_rate_node = fgGetNode("/orientation/roll-rate-degps", true);
_yaw_rate_node = fgGetNode("/orientation/yaw-rate-degps", true); _yaw_rate_node = fgGetNode("/orientation/yaw-rate-degps", true);
_rate_out_node = node->getChild("indicated-turn-rate", 0, true); _rate_out_node = node->getChild("indicated-turn-rate", 0, true);
_spin_node = node->getChild("spin", 0, true);
initServicePowerProperties(node); initServicePowerProperties(node);
@ -62,6 +66,7 @@ TurnIndicator::update (double dt)
_gyro.set_power_norm(isServiceableAndPowered()); _gyro.set_power_norm(isServiceableAndPowered());
_gyro.update(dt); _gyro.update(dt);
double spin = _gyro.get_spin_norm(); double spin = _gyro.get_spin_norm();
_spin_node->setDoubleValue( spin );
// Calculate the indicated rate // Calculate the indicated rate
double factor = 1.0 - ((1.0 - spin) * (1.0 - spin) * (1.0 - spin)); double factor = 1.0 - ((1.0 - spin) * (1.0 - spin) * (1.0 - spin));

View file

@ -32,11 +32,33 @@
* /instrumentation/"name"/spin * /instrumentation/"name"/spin
* /orientation/roll-rate-degps * /orientation/roll-rate-degps
* /orientation/yaw-rate-degps * /orientation/yaw-rate-degps
* /systems/electrical/outputs/turn-coordinator * /systems/electrical/outputs/turn-coordinator (see below)
* *
* Output properties: * Output properties:
* *
* /instrumentation/"name"/indicated-turn-rate * /instrumentation/"name"/indicated-turn-rate
*
* Configuration:
*
* name
* number
* new-default-power-path: use /systems/electrical/outputs/turn-indicator[ number ] instead of
* /systems/electrical/outputs/turn-coordinator as the default power
* supply path (not used when power-supply is set)
* power-supply
* minimum-supply-volts
*
* Notes on the power supply path:
*
* For backwards compatibility reasons, the default power path is
* /systems/electrical/outputs/turn-coordinator, unless new-default-power-path is set to 1,
* in which case the new default path /systems/electrical/outputs/turn-indicator[ number ]
* is used. As the new path is more logical and consistent with instrument naming, newly
* developed and actively maintained aircraft should switch their electrical system to write
* to /systems/electrical/outputs/turn-indicator[ number ] and set new-default-power-path.
* The legacy default path will eventually be phased out.
* The power path can always be set manually by using the power-supply config tag.
*
*/ */
class TurnIndicator : public AbstractInstrument class TurnIndicator : public AbstractInstrument
{ {
@ -45,10 +67,8 @@ public:
virtual ~TurnIndicator (); virtual ~TurnIndicator ();
// Subsystem API. // Subsystem API.
//void bind() override;
void init() override; void init() override;
void reinit() override; void reinit() override;
//void unbind() override;
void update(double dt) override; void update(double dt) override;
// Subsystem identification. // Subsystem identification.
@ -61,4 +81,5 @@ private:
SGPropertyNode_ptr _roll_rate_node; SGPropertyNode_ptr _roll_rate_node;
SGPropertyNode_ptr _yaw_rate_node; SGPropertyNode_ptr _yaw_rate_node;
SGPropertyNode_ptr _rate_out_node; SGPropertyNode_ptr _rate_out_node;
SGPropertyNode_ptr _spin_node;
}; };