| 1 | /* |
| 2 | * SPDX-FileName: turn_indicator.hxx |
| 3 | * SPDX-FileComment: an electric-powered turn indicator. |
| 4 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 5 | * SPDX-FileContributor: Written by David Megginson, started 2002. |
| 6 | */ |
| 7 | |
| 8 | |
| 9 | #pragma once |
| 10 | |
| 11 | #include <Instrumentation/AbstractInstrument.hxx> |
| 12 | |
| 13 | #include "gyro.hxx" |
| 14 | |
| 15 | |
| 16 | /** |
| 17 | * Model |
| 18 | * |
| 19 | * This class does not model the slip/skid ball; that is properly |
| 20 | * a separate instrument. |
| 21 | * |
| 22 | * Input properties: |
| 23 | * |
| 24 | * /instrumentation/"name"/serviceable |
| 25 | * /instrumentation/"name"/spin |
| 26 | * /orientation/roll-rate-degps |
| 27 | * /orientation/yaw-rate-degps |
| 28 | * /systems/electrical/outputs/turn-coordinator (see below) |
| 29 | * |
| 30 | * Output properties: |
| 31 | * |
| 32 | * /instrumentation/"name"/indicated-turn-rate |
| 33 | * |
| 34 | * Configuration: |
| 35 | * |
| 36 | * name |
| 37 | * number |
| 38 | * new-default-power-path: use /systems/electrical/outputs/turn-indicator[ number ] instead of |
| 39 | * /systems/electrical/outputs/turn-coordinator as the default power |
| 40 | * supply path (not used when power-supply is set) |
| 41 | * power-supply |
| 42 | * minimum-supply-volts |
| 43 | * gyro-spin-up-sec If given, seconds to spin up until power-norm (from 0->100%) |
| 44 | * gyro-spin-down-sec If given, seconds the gyro will loose spin without power (from 100%->0) |
| 45 | * |
| 46 | * Notes on the power supply path: |
| 47 | * |
| 48 | * For backwards compatibility reasons, the default power path is |
| 49 | * /systems/electrical/outputs/turn-coordinator, unless new-default-power-path is set to 1, |
| 50 | * in which case the new default path /systems/electrical/outputs/turn-indicator[ number ] |
| 51 | * is used. As the new path is more logical and consistent with instrument naming, newly |
| 52 | * developed and actively maintained aircraft should switch their electrical system to write |
| 53 | * to /systems/electrical/outputs/turn-indicator[ number ] and set new-default-power-path. |
| 54 | * The legacy default path will eventually be phased out. |
| 55 | * The power path can always be set manually by using the power-supply config tag. |
| 56 | * |
| 57 | */ |
| 58 | class TurnIndicator : public AbstractInstrument |
| 59 | { |
| 60 | public: |
| 61 | TurnIndicator ( SGPropertyNode *node ); |
| 62 | virtual ~TurnIndicator (); |
| 63 | |
| 64 | // Subsystem API. |
| 65 | void init() override; |
| 66 | void reinit() override; |
| 67 | void update(double dt) override; |
| 68 | |
| 69 | // Subsystem identification. |
| 70 | static const char* staticSubsystemClassId() { return "turn-indicator"; } |
| 71 | |
| 72 | private: |
| 73 | Gyro _gyro; |
| 74 | double _last_rate; |
| 75 | double _gyro_spin_up, _gyro_spin_down; |
| 76 | |
| 77 | SGPropertyNode_ptr _roll_rate_node; |
| 78 | SGPropertyNode_ptr _yaw_rate_node; |
| 79 | SGPropertyNode_ptr _rate_out_node; |
| 80 | SGPropertyNode_ptr _spin_node, _gyro_spin_up_node, _gyro_spin_down_node; |
| 81 | }; |