diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-08-25 16:51:50 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-08-25 16:51:50 +0200 |
commit | 57e406307efc7149d2b7ed7de0ba9c253cfce1d4 (patch) | |
tree | f43e6536885c67f131ef20c9bfc7e6a03f05ed5e /ext-falcon-bms-linear-acc | |
parent | c0d67c71b42e3d2ffd292977f1f3f0b0e32cf04c (diff) |
ext/bms: fix clang analyzer tripping up
It's probably enum outside `int' range.
Diffstat (limited to 'ext-falcon-bms-linear-acc')
-rw-r--r-- | ext-falcon-bms-linear-acc/FlightData.h | 504 |
1 files changed, 249 insertions, 255 deletions
diff --git a/ext-falcon-bms-linear-acc/FlightData.h b/ext-falcon-bms-linear-acc/FlightData.h index 10183917..3f3ccc7a 100644 --- a/ext-falcon-bms-linear-acc/FlightData.h +++ b/ext-falcon-bms-linear-acc/FlightData.h @@ -1,6 +1,4 @@ -#ifndef _FLIGHT_DATA_H -#define _FLIGHT_DATA_H - +#pragma once #define FLIGHTDATA_VERSION 117 // changelog: @@ -14,26 +12,25 @@ // 117: added ATF_Not_Engaged to LightBits3 // *** "FalconSharedMemoryArea" *** -class FlightData +struct FlightData { -public: - // GENERAL NOTE FOR ALL LIGHTBITS: - // - // The lightbits contain status about whether a lamp is activated or deactivated. A *blinking* lamp - // is always activated, even if it is in the "off" phase of the blinking! To check whether an activated - // lamp is blinking or just "on", use the BlinkBits in FlightData2. A blinkbit does NOT alternate on/off - // either, it will just state *if* a lamp is blinking. This construct might seem strange at 1st sight, - // but only like this it can be guaranteed that even low-freq shared mem readers will pick up the info - // about blinking lamps correctly. Obviously, it is up to the external program to implement the actual - // blinking logic/freq etc. - // - // Summary: - // a) The LightBit says "lamp is active (LightBit 1) or inactive (LightBit 0)". - // b) The BlinkBit says "if the lamp is active (see LightBit 1), is it steady (BlinkBit 0) - // or is it blinking (BlinkBit 1)" - // c) If a lamp has no BlinkBit, it is always assumed to be steady if active (LightBit 1). - - enum LightBits + // GENERAL NOTE FOR ALL LIGHTBITS: + // + // The lightbits contain status about whether a lamp is activated or deactivated. A *blinking* lamp + // is always activated, even if it is in the "off" phase of the blinking! To check whether an activated + // lamp is blinking or just "on", use the BlinkBits in FlightData2. A blinkbit does NOT alternate on/off + // either, it will just state *if* a lamp is blinking. This construct might seem strange at 1st sight, + // but only like this it can be guaranteed that even low-freq shared mem readers will pick up the info + // about blinking lamps correctly. Obviously, it is up to the external program to implement the actual + // blinking logic/freq etc. + // + // Summary: + // a) The LightBit says "lamp is active (LightBit 1) or inactive (LightBit 0)". + // b) The BlinkBit says "if the lamp is active (see LightBit 1), is it steady (BlinkBit 0) + // or is it blinking (BlinkBit 1)" + // c) If a lamp has no BlinkBit, it is always assumed to be steady if active (LightBit 1). + + enum LightBits : unsigned { MasterCaution = 0x1, // Left eyebrow @@ -82,7 +79,7 @@ public: AllLampBitsOn = 0xBFFFFFEF }; - enum LightBits2 + enum LightBits2 : unsigned { // Threat Warning Prime HandOff = 0x1, @@ -92,13 +89,13 @@ public: Unk = 0x10, TgtSep = 0x20, - // EWS - Go = 0x40, // On and operating normally - NoGo = 0x80, // On but malfunction present - Degr = 0x100, // Status message: AUTO DEGR - Rdy = 0x200, // Status message: DISPENSE RDY - ChaffLo = 0x400, // Bingo chaff quantity reached - FlareLo = 0x800, // Bingo flare quantity reached + // EWS + Go = 0x40, // On and operating normally + NoGo = 0x80, // On but malfunction present + Degr = 0x100, // Status message: AUTO DEGR + Rdy = 0x200, // Status message: DISPENSE RDY + ChaffLo = 0x400, // Bingo chaff quantity reached + FlareLo = 0x800, // Bingo flare quantity reached // Aux Threat Warning AuxSrch = 0x1000, @@ -132,11 +129,11 @@ public: // Used with the MAL/IND light code to light up "everything" // please update this if you add/change bits! - AllLampBits2On = 0xFFFFF03F, - AllLampBits2OnExceptCarapace = AllLampBits2On ^ HandOff ^ Launch ^ PriMode ^ Naval ^ Unk ^ TgtSep ^ AuxSrch ^ AuxAct ^ AuxLow ^ AuxPwr + AllLampBits2On = 0xFFFFF03F, + AllLampBits2OnExceptCarapace = AllLampBits2On ^ HandOff ^ Launch ^ PriMode ^ Naval ^ Unk ^ TgtSep ^ AuxSrch ^ AuxAct ^ AuxLow ^ AuxPwr }; - enum LightBits3 + enum LightBits3 : unsigned { // Elec panel FlcsPmg = 0x1, @@ -156,48 +153,48 @@ public: Elec_Fault = 0x400, Lef_Fault = 0x800, - OnGround = 0x1000, // weight-on-wheels + OnGround = 0x1000, // weight-on-wheels FlcsBitRun = 0x2000, // FLT CONTROL panel RUN light (used to be Multi-engine fire light) FlcsBitFail = 0x4000, // FLT CONTROL panel FAIL light (used to be Lock light Cue; non-F-16) DbuWarn = 0x8000, // Right eyebrow DBU ON cell; was Shoot light cue; non-F16 NoseGearDown = 0x10000, // Landing gear panel; on means down and locked LeftGearDown = 0x20000, // Landing gear panel; on means down and locked RightGearDown = 0x40000, // Landing gear panel; on means down and locked - ParkBrakeOn = 0x100000, // Parking brake engaged; NOTE: not a lamp bit + ParkBrakeOn = 0x100000, // Parking brake engaged; NOTE: not a lamp bit Power_Off = 0x200000, // Set if there is no electrical power. NB: not a lamp bit - // Caution panel - cadc = 0x400000, - - // Left Aux console - SpeedBrake = 0x800000, // True if speed brake is in anything other than stowed position + // Caution panel + cadc = 0x400000, + + // Left Aux console + SpeedBrake = 0x800000, // True if speed brake is in anything other than stowed position // Threat Warning Prime - additional bits - SysTest = 0x1000000, + SysTest = 0x1000000, + + // Master Caution WILL come up (actual lightBit has 3sec delay like in RL), + // usable for cockpit builders with RL equipment which has a delay on its own. + // Will be set to false again as soon as the MasterCaution bit is set. + MCAnnounced = 0x2000000, - // Master Caution WILL come up (actual lightBit has 3sec delay like in RL), - // usable for cockpit builders with RL equipment which has a delay on its own. - // Will be set to false again as soon as the MasterCaution bit is set. - MCAnnounced = 0x2000000, + //MLGWOW is only for AFM , it means WOW switches on MLG are triggered => FLCS switches to WOWPitchRockGain + MLGWOW = 0x4000000, + NLGWOW = 0x8000000, - //MLGWOW is only for AFM , it means WOW switches on MLG are triggered => FLCS switches to WOWPitchRockGain - MLGWOW = 0x4000000, - NLGWOW = 0x8000000, + ATF_Not_Engaged = 0x10000000, - ATF_Not_Engaged = 0x10000000, - - // Free bits in LightBits3 - //0x20000000, - //0x40000000, - //0x80000000, + // Free bits in LightBits3 + //0x20000000, + //0x40000000, + //0x80000000, - // Used with the MAL/IND light code to light up "everything" + // Used with the MAL/IND light code to light up "everything" // please update this if you add/change bits! - AllLampBits3On = 0x1147EFFF, - AllLampBits3OnExceptCarapace = AllLampBits3On ^ SysTest + AllLampBits3On = 0x1147EFFF, + AllLampBits3OnExceptCarapace = AllLampBits3On ^ SysTest }; - enum HsiBits + enum HsiBits : unsigned { ToTrue = 0x01, // HSI_FLAG_TO_TRUE == 1, TO IlsWarning = 0x02, // HSI_FLAG_ILS_WARN @@ -213,20 +210,20 @@ public: VVI = 0x800, // VVI OFF Flag AOA = 0x1000, // AOA OFF Flag AVTR = 0x2000, // AVTR Light - OuterMarker = 0x4000, // MARKER beacon light for outer marker - MiddleMarker = 0x8000, // MARKER beacon light for middle marker - FromTrue = 0x10000, // HSI_FLAG_TO_TRUE == 2, FROM + OuterMarker = 0x4000, // MARKER beacon light for outer marker + MiddleMarker = 0x8000, // MARKER beacon light for middle marker + FromTrue = 0x10000, // HSI_FLAG_TO_TRUE == 2, FROM - Flying = 0x80000000, // true if player is attached to an aircraft (i.e. not in UI state). NOTE: Not a lamp bit + Flying = 0x80000000, // true if player is attached to an aircraft (i.e. not in UI state). NOTE: Not a lamp bit - // Used with the MAL/IND light code to light up "everything" + // Used with the MAL/IND light code to light up "everything" // please update this is you add/change bits! AllLampHsiBitsOn = 0xE000 }; // These are outputs from the sim - // Note: some two-engine values removed in this version for compatibility - // reasons. + // Note: some two-engine values removed in this version for compatibility + // reasons. float x; // Ownship North (Ft) float y; // Ownship East (Ft) float z; // Ownship Down (Ft) --- NOTE: use FlightData2 AAUZ for barometric altitude! @@ -245,24 +242,24 @@ public: float gs; // Ownship Normal Gs float windOffset; // Wind delta to FPM (Radians) float nozzlePos; // Ownship engine nozzle percent open (0-100) - //float nozzlePos2; // MOVED TO FlightData2! Ownship engine nozzle2 percent open (0-100) + //float nozzlePos2; // MOVED TO FlightData2! Ownship engine nozzle2 percent open (0-100) float internalFuel; // Ownship internal fuel (Lbs) float externalFuel; // Ownship external fuel (Lbs) float fuelFlow; // Ownship fuel flow (Lbs/Hour) float rpm; // Ownship engine rpm (Percent 0-103) - //float rpm2; // MOVED TO FlightData2! Ownship engine rpm2 (Percent 0-103) + //float rpm2; // MOVED TO FlightData2! Ownship engine rpm2 (Percent 0-103) float ftit; // Ownship Forward Turbine Inlet Temp (Degrees C) - //float ftit2; // MOVED TO FlightData2! Ownship Forward Turbine Inlet Temp2 (Degrees C) + //float ftit2; // MOVED TO FlightData2! Ownship Forward Turbine Inlet Temp2 (Degrees C) float gearPos; // Ownship Gear position 0 = up, 1 = down; float speedBrake; // Ownship speed brake position 0 = closed, 1 = 60 Degrees open float epuFuel; // Ownship EPU fuel (Percent 0-100) float oilPressure; // Ownship Oil Pressure (Percent 0-100) - //float oilPressure2; // MOVED TO FlightData2! Ownship Oil Pressure2 (Percent 0-100) + //float oilPressure2; // MOVED TO FlightData2! Ownship Oil Pressure2 (Percent 0-100) unsigned int lightBits; // Cockpit Indicator Lights, one bit per bulb. See enum // These are inputs. Use them carefully - // NB: these do not work when TrackIR device is enabled - // NB2: launch falcon with the '-head' command line parameter to activate ! + // NB: these do not work when TrackIR device is enabled + // NB2: launch falcon with the '-head' command line parameter to activate ! float headPitch; // Head pitch offset from design eye (radians) float headRoll; // Head roll offset from design eye (radians) float headYaw; // Head yaw offset from design eye (radians) @@ -329,26 +326,26 @@ public: unsigned long missileLaunch[40]; unsigned long selected[40]; float lethality[40]; - unsigned long newDetection[40]; + unsigned long newDetection[40]; //fuel values float fwd, aft, total; void SetLightBit (unsigned int newBit) {lightBits |= newBit;}; - void ClearLightBit(unsigned int newBit) { lightBits &= ~newBit; }; - bool IsSet(unsigned int newBit) { return ((lightBits & newBit) ? true : false); }; + void ClearLightBit(unsigned int newBit) { lightBits &= ~newBit; }; + bool IsSet(unsigned int newBit) { return ((lightBits & newBit) != 0); }; - void SetLightBit2(unsigned int newBit) { lightBits2 |= newBit; }; - void ClearLightBit2(unsigned int newBit) { lightBits2 &= ~newBit; }; - bool IsSet2(unsigned int newBit) { return ((lightBits2 & newBit) ? true : false); }; + void SetLightBit2(unsigned int newBit) { lightBits2 |= newBit; }; + void ClearLightBit2(unsigned int newBit) { lightBits2 &= ~newBit; }; + bool IsSet2(unsigned int newBit) { return ((lightBits2 & newBit) != 0); }; - void SetLightBit3(unsigned int newBit) { lightBits3 |= newBit; }; - void ClearLightBit3(unsigned int newBit) { lightBits3 &= ~newBit; }; - bool IsSet3(unsigned int newBit) { return ((lightBits3 & newBit) ? true : false); }; + void SetLightBit3(unsigned int newBit) { lightBits3 |= newBit; }; + void ClearLightBit3(unsigned int newBit) { lightBits3 &= ~newBit; }; + bool IsSet3(unsigned int newBit) { return ((lightBits3 & newBit) != 0); }; - void SetHsiBit(unsigned int newBit) { hsiBits |= newBit; }; - void ClearHsiBit(unsigned int newBit) { hsiBits &= ~newBit; }; - bool IsSetHsi(unsigned int newBit) { return ((hsiBits & newBit) ? true : false); }; + void SetHsiBit(unsigned int newBit) { hsiBits |= newBit; }; + void ClearHsiBit(unsigned int newBit) { hsiBits &= ~newBit; }; + bool IsSetHsi(unsigned int newBit) { return ((hsiBits & newBit) != 0); }; int VersionNum; // Version of FlightData mem area @@ -366,19 +363,18 @@ public: #define OSB_STRING_LENGTH 8 // currently strings appear to be max 7 printing chars -typedef struct { - char line1[OSB_STRING_LENGTH]; - char line2[OSB_STRING_LENGTH]; - bool inverted; -} OsbLabel; +struct OsbLabel { + char line1[OSB_STRING_LENGTH]; + char line2[OSB_STRING_LENGTH]; + bool inverted; +}; // *** "FalconSharedOsbMemoryArea" *** -class OSBData +struct OSBData { -public: - OsbLabel leftMFD[20]; - OsbLabel rightMFD[20]; + OsbLabel leftMFD[20]; + OsbLabel rightMFD[20]; }; @@ -400,178 +396,176 @@ public: #define MAX_CALLSIGNS 32 // *** "FalconSharedMemoryArea2" *** -class FlightData2 +struct FlightData2 { -public: - - // TACAN - enum TacanSources - { - UFC = 0, - AUX = 1, - NUMBER_OF_SOURCES = 2, - }; - enum TacanBits - { - band = 0x01, // true in this bit position if band is X - mode = 0x02, // true in this bit position if domain is air to air - }; - - // ALTIMETER - enum AltBits - { - CalType = 0x01, // true if calibration in inches of Mercury (Hg), false if in hectoPascal (hPa) - PneuFlag = 0x02, // true if PNEU flag is visible - }; - - // POWER - enum PowerBits - { - BusPowerBattery = 0x01, // true if at least the battery bus is powered - BusPowerEmergency = 0x02, // true if at least the emergency bus is powered - BusPowerEssential = 0x04, // true if at least the essential bus is powered - BusPowerNonEssential = 0x08, // true if at least the non-essential bus is powered - MainGenerator = 0x10, // true if the main generator is online - StandbyGenerator = 0x20, // true if the standby generator is online - JetFuelStarter = 0x40, // true if JFS is running, can be used for magswitch - }; - - // BLINKING LIGHTS - only indicating *IF* a lamp is blinking, not implementing the actual on/off/blinking pattern logic! - enum BlinkBits - { - // currently working - OuterMarker = 0x01, // defined in HsiBits - slow flashing for outer marker - MiddleMarker = 0x02, // defined in HsiBits - fast flashing for middle marker - PROBEHEAT = 0x04, // defined in LightBits2 - probeheat system is tested - AuxSrch = 0x08, // defined in LightBits2 - search function in NOT activated and a search radar is painting ownship - Launch = 0x10, // defined in LightBits2 - missile is fired at ownship - PriMode = 0x20, // defined in LightBits2 - priority mode is enabled but more than 5 threat emitters are detected - Unk = 0x40, // defined in LightBits2 - unknown is not active but EWS detects unknown radar - - // not working yet, defined for future use - Elec_Fault = 0x80, // defined in LightBits3 - non-resetting fault - OXY_BROW = 0x100, // defined in LightBits - monitor fault during Obogs - EPUOn = 0x200, // defined in LightBits3 - abnormal EPU operation - JFSOn_Slow = 0x400, // defined in LightBits3 - slow blinking: non-critical failure - JFSOn_Fast = 0x800, // defined in LightBits3 - fast blinking: critical failure - }; - - // CMDS mode state - enum CmdsModes - { - CmdsOFF = 0, - CmdsSTBY = 1, - CmdsMAN = 2, - CmdsSEMI = 3, - CmdsAUTO = 4, - CmdsBYP = 5, - }; - - // HSI/eHSI mode state - enum NavModes - { - ILS_TACAN = 0, - TACAN = 1, - NAV = 2, - ILS_NAV = 3, - }; - - // human pilot state - enum FlyStates - { - IN_UI = 0, // UI - in the UI - LOADING = 1, // UI>3D - loading the sim data - WAITING = 2, // UI>3D - waiting for other players - FLYING = 3, // 3D - flying - DEAD = 4, // 3D>Dead - dead, waiting to respawn - UNKNOWN = 5, // ??? - }; - - // VERSION 1 - float nozzlePos2; // Ownship engine nozzle2 percent open (0-100) - float rpm2; // Ownship engine rpm2 (Percent 0-103) - float ftit2; // Ownship Forward Turbine Inlet Temp2 (Degrees C) - float oilPressure2; // Ownship Oil Pressure2 (Percent 0-100) - unsigned char navMode; // current mode selected for HSI/eHSI, see NavModes enum for details - float AAUZ; // Ownship barometric altitude given by AAU (depends on calibration) - char tacanInfo[NUMBER_OF_SOURCES]; // Tacan band/mode settings for UFC and AUX COMM - - // VERSION 2 / 7 - int AltCalReading; // barometric altitude calibration (depends on CalType) - unsigned int altBits; // various altimeter bits, see AltBits enum for details - unsigned int powerBits; // Ownship power bus / generator states, see PowerBits enum for details - unsigned int blinkBits; // Cockpit indicator lights blink status, see BlinkBits enum for details - // NOTE: these bits indicate only *if* a lamp is blinking, in addition to the - // existing on/off bits. It's up to the external program to implement the - // *actual* blinking. - int cmdsMode; // Ownship CMDS mode state, see CmdsModes enum for details - int BupUhfPreset; // BUP UHF channel preset - - // VERSION 3 - int BupUhfFreq; // BUP UHF channel frequency - float cabinAlt; // Ownship cabin altitude - float hydPressureA; // Ownship Hydraulic Pressure A - float hydPressureB; // Ownship Hydraulic Pressure B - int currentTime; // Current time in seconds (max 60 * 60 * 24) - short vehicleACD; // Ownship ACD index number, i.e. which aircraft type are we flying. - int VersionNum; // Version of FlightData2 mem area - - // VERSION 4 - float fuelFlow2; // Ownship fuel flow2 (Lbs/Hour) - - // VERSION 5 / 8 - char RwrInfo[RWRINFO_SIZE]; // New RWR Info - float lefPos; // Ownship LEF position - float tefPos; // Ownship TEF position - - // VERSION 6 - float vtolPos; // Ownship VTOL exhaust angle - - // VERSION 9 - char pilotsOnline; // Number of pilots in an MP session - char pilotsCallsign[MAX_CALLSIGNS][CALLSIGN_LEN]; // List of pilots callsign connected to an MP session - char pilotsStatus[MAX_CALLSIGNS]; // Status of the MP pilots, see enum FlyStates - - // TACAN - // setters for internal use only - void SetUfcTacanToAA(bool t) { if (t) { tacanInfo[UFC] |= mode; } else { tacanInfo[UFC] &= ~mode; } } - void SetAuxTacanToAA(bool t) { if (t) { tacanInfo[AUX] |= mode; } else { tacanInfo[AUX] &= ~mode; } } - void SetUfcTacanToX(bool t) { if (t) { tacanInfo[UFC] |= band; } else { tacanInfo[UFC] &= ~band; } } - void SetAuxTacanToX(bool t) { if (t) { tacanInfo[AUX] |= band; } else { tacanInfo[AUX] &= ~band; } } - - // getters for external reader programs - bool UfcTacanIsAA(void) {return ((tacanInfo[UFC] & mode) ? true : false); } - bool AuxTacanIsAA(void) {return ((tacanInfo[AUX] & mode) ? true : false); } - bool UfcTacanIsX(void) {return ((tacanInfo[UFC] & band) ? true : false); } - bool AuxTacanIsX(void) {return ((tacanInfo[AUX] & band) ? true : false); } - - // ALTIMETER - void SetAltBit(unsigned int newBit) { altBits |= newBit; }; - void ClearAltBit(unsigned int newBit) { altBits &= ~newBit; }; - bool IsSetAlt(unsigned int newBit) { return ((altBits & newBit) ? true : false); }; - - // POWER - void SetPowerBit(unsigned int newBit) { powerBits |= newBit; }; - void ClearPowerBit(unsigned int newBit) { powerBits &= ~newBit; }; - bool IsSetPower(unsigned int newBit) { return ((powerBits & newBit) ? true : false); }; + // TACAN + enum TacanSources : unsigned + { + UFC = 0, + AUX = 1, + NUMBER_OF_SOURCES = 2, + }; + enum TacanBits : unsigned + { + band = 0x01, // true in this bit position if band is X + mode = 0x02, // true in this bit position if domain is air to air + }; + + // ALTIMETER + enum AltBits : unsigned + { + CalType = 0x01, // true if calibration in inches of Mercury (Hg), false if in hectoPascal (hPa) + PneuFlag = 0x02, // true if PNEU flag is visible + }; + + // POWER + enum PowerBits : unsigned + { + BusPowerBattery = 0x01, // true if at least the battery bus is powered + BusPowerEmergency = 0x02, // true if at least the emergency bus is powered + BusPowerEssential = 0x04, // true if at least the essential bus is powered + BusPowerNonEssential = 0x08, // true if at least the non-essential bus is powered + MainGenerator = 0x10, // true if the main generator is online + StandbyGenerator = 0x20, // true if the standby generator is online + JetFuelStarter = 0x40, // true if JFS is running, can be used for magswitch + }; + + // BLINKING LIGHTS - only indicating *IF* a lamp is blinking, not implementing the actual on/off/blinking pattern logic! + enum BlinkBits : unsigned + { + // currently working + OuterMarker = 0x01, // defined in HsiBits - slow flashing for outer marker + MiddleMarker = 0x02, // defined in HsiBits - fast flashing for middle marker + PROBEHEAT = 0x04, // defined in LightBits2 - probeheat system is tested + AuxSrch = 0x08, // defined in LightBits2 - search function in NOT activated and a search radar is painting ownship + Launch = 0x10, // defined in LightBits2 - missile is fired at ownship + PriMode = 0x20, // defined in LightBits2 - priority mode is enabled but more than 5 threat emitters are detected + Unk = 0x40, // defined in LightBits2 - unknown is not active but EWS detects unknown radar + + // not working yet, defined for future use + Elec_Fault = 0x80, // defined in LightBits3 - non-resetting fault + OXY_BROW = 0x100, // defined in LightBits - monitor fault during Obogs + EPUOn = 0x200, // defined in LightBits3 - abnormal EPU operation + JFSOn_Slow = 0x400, // defined in LightBits3 - slow blinking: non-critical failure + JFSOn_Fast = 0x800, // defined in LightBits3 - fast blinking: critical failure + }; + + // CMDS mode state + enum CmdsModes : unsigned + { + CmdsOFF = 0, + CmdsSTBY = 1, + CmdsMAN = 2, + CmdsSEMI = 3, + CmdsAUTO = 4, + CmdsBYP = 5, + }; + + // HSI/eHSI mode state + enum NavModes : unsigned + { + ILS_TACAN = 0, + TACAN = 1, + NAV = 2, + ILS_NAV = 3, + }; + + // human pilot state + enum FlyStates : unsigned + { + IN_UI = 0, // UI - in the UI + LOADING = 1, // UI>3D - loading the sim data + WAITING = 2, // UI>3D - waiting for other players + FLYING = 3, // 3D - flying + DEAD = 4, // 3D>Dead - dead, waiting to respawn + UNKNOWN = 5, // ??? + }; + + // VERSION 1 + float nozzlePos2; // Ownship engine nozzle2 percent open (0-100) + float rpm2; // Ownship engine rpm2 (Percent 0-103) + float ftit2; // Ownship Forward Turbine Inlet Temp2 (Degrees C) + float oilPressure2; // Ownship Oil Pressure2 (Percent 0-100) + unsigned char navMode; // current mode selected for HSI/eHSI, see NavModes enum for details + float AAUZ; // Ownship barometric altitude given by AAU (depends on calibration) + char tacanInfo[NUMBER_OF_SOURCES]; // Tacan band/mode settings for UFC and AUX COMM + + // VERSION 2 / 7 + int AltCalReading; // barometric altitude calibration (depends on CalType) + unsigned int altBits; // various altimeter bits, see AltBits enum for details + unsigned int powerBits; // Ownship power bus / generator states, see PowerBits enum for details + unsigned int blinkBits; // Cockpit indicator lights blink status, see BlinkBits enum for details + // NOTE: these bits indicate only *if* a lamp is blinking, in addition to the + // existing on/off bits. It's up to the external program to implement the + // *actual* blinking. + int cmdsMode; // Ownship CMDS mode state, see CmdsModes enum for details + int BupUhfPreset; // BUP UHF channel preset + + // VERSION 3 + int BupUhfFreq; // BUP UHF channel frequency + float cabinAlt; // Ownship cabin altitude + float hydPressureA; // Ownship Hydraulic Pressure A + float hydPressureB; // Ownship Hydraulic Pressure B + int currentTime; // Current time in seconds (max 60 * 60 * 24) + short vehicleACD; // Ownship ACD index number, i.e. which aircraft type are we flying. + int VersionNum; // Version of FlightData2 mem area + + // VERSION 4 + float fuelFlow2; // Ownship fuel flow2 (Lbs/Hour) + + // VERSION 5 / 8 + char RwrInfo[RWRINFO_SIZE]; // New RWR Info + float lefPos; // Ownship LEF position + float tefPos; // Ownship TEF position + + // VERSION 6 + float vtolPos; // Ownship VTOL exhaust angle + + // VERSION 9 + char pilotsOnline; // Number of pilots in an MP session + char pilotsCallsign[MAX_CALLSIGNS][CALLSIGN_LEN]; // List of pilots callsign connected to an MP session + char pilotsStatus[MAX_CALLSIGNS]; // Status of the MP pilots, see enum FlyStates + + // TACAN + // setters for internal use only + void SetUfcTacanToAA(bool t) { if (t) { tacanInfo[UFC] |= mode; } else { tacanInfo[UFC] &= ~mode; } } + void SetAuxTacanToAA(bool t) { if (t) { tacanInfo[AUX] |= mode; } else { tacanInfo[AUX] &= ~mode; } } + void SetUfcTacanToX(bool t) { if (t) { tacanInfo[UFC] |= band; } else { tacanInfo[UFC] &= ~band; } } + void SetAuxTacanToX(bool t) { if (t) { tacanInfo[AUX] |= band; } else { tacanInfo[AUX] &= ~band; } } + + // getters for external reader programs + bool UfcTacanIsAA(void) {return ((tacanInfo[UFC] & mode) != 0); } + bool AuxTacanIsAA(void) {return ((tacanInfo[AUX] & mode) != 0); } + bool UfcTacanIsX(void) {return ((tacanInfo[UFC] & band) != 0); } + bool AuxTacanIsX(void) {return ((tacanInfo[AUX] & band) != 0); } + + // ALTIMETER + void SetAltBit(unsigned int newBit) { altBits |= newBit; }; + void ClearAltBit(unsigned int newBit) { altBits &= ~newBit; }; + bool IsSetAlt(unsigned int newBit) { return ((altBits & newBit) != 0); }; + + // POWER + void SetPowerBit(unsigned int newBit) { powerBits |= newBit; }; + void ClearPowerBit(unsigned int newBit) { powerBits &= ~newBit; }; + bool IsSetPower(unsigned int newBit) { return ((powerBits & newBit) != 0); }; // BLINKING LIGHTS - void SetBlinkBit(unsigned int newBit) { blinkBits |= newBit; }; - void ClearBlinkBit(unsigned int newBit) { blinkBits &= ~newBit; }; - bool IsSetBlink(unsigned int newBit) { return ((blinkBits & newBit) ? true : false); }; + void SetBlinkBit(unsigned int newBit) { blinkBits |= newBit; }; + void ClearBlinkBit(unsigned int newBit) { blinkBits &= ~newBit; }; + bool IsSetBlink(unsigned int newBit) { return ((blinkBits & newBit) != 0); }; - // CMDS mode state - void SetCmdsMode(int newMode) {cmdsMode = newMode;}; - int GetCmdsMode(void) {return cmdsMode;}; + // CMDS mode state + void SetCmdsMode(int newMode) {cmdsMode = newMode;}; + int GetCmdsMode(void) {return cmdsMode;}; - // HSI/eHSI mode state - void SetNavMode(int newMode) {navMode = newMode;}; - int GetNavMode(void) {return navMode;}; + // HSI/eHSI mode state + void SetNavMode(int newMode) {navMode = newMode;}; + int GetNavMode(void) {return navMode;}; }; +#if 0 extern OSBData cockpitOSBData; // "FalconSharedOsbMemoryArea" extern FlightData cockpitFlightData; // "FalconSharedMemoryArea" extern FlightData2 cockpitFlightData2; // "FalconSharedMemoryArea2" - #endif |