1
0
mirror of synced 2024-11-22 10:03:51 +00:00

Added: Tail hook, autopilot, anti-ice switch functions

This commit is contained in:
Mark van Renswoude 2013-01-20 21:15:05 +00:00
parent 208da55c23
commit 3dd944e41b
3 changed files with 64 additions and 10 deletions

View File

@ -81,8 +81,8 @@
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define> <DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''"> <PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
<VerInfo_MinorVer>4</VerInfo_MinorVer> <VerInfo_MinorVer>5</VerInfo_MinorVer>
<VerInfo_Keys>CompanyName=X²Software;FileDescription=G940 LED Control;FileVersion=0.4.0.0;InternalName=;LegalCopyright=© 2011 X²Software;LegalTrademarks=;OriginalFilename=G940LEDControl.exe;ProductName=G940 LED Control;ProductVersion=0.4;Comments=</VerInfo_Keys> <VerInfo_Keys>CompanyName=X²Software;FileDescription=G940 LED Control;FileVersion=0.5.0.0;InternalName=;LegalCopyright=© 2011 X²Software;LegalTrademarks=;OriginalFilename=G940LEDControl.exe;ProductName=G940 LED Control;ProductVersion=0.5;Comments=</VerInfo_Keys>
<VerInfo_Locale>1033</VerInfo_Locale> <VerInfo_Locale>1033</VerInfo_Locale>
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File> <Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
</PropertyGroup> </PropertyGroup>

Binary file not shown.

View File

@ -36,6 +36,15 @@ const
FUNCTION_FSX_AUTOPILOT = FUNCTION_PROVIDER_OFFSET + 16; FUNCTION_FSX_AUTOPILOT = FUNCTION_PROVIDER_OFFSET + 16;
FUNCTION_FSX_FUELPUMP = FUNCTION_PROVIDER_OFFSET + 17; FUNCTION_FSX_FUELPUMP = FUNCTION_PROVIDER_OFFSET + 17;
FUNCTION_FSX_TAILHOOK = FUNCTION_PROVIDER_OFFSET + 18;
FUNCTION_FSX_AUTOPILOT_AMBER = FUNCTION_PROVIDER_OFFSET + 19;
FUNCTION_FSX_AUTOPILOT_HEADING = FUNCTION_PROVIDER_OFFSET + 20;
FUNCTION_FSX_AUTOPILOT_APPROACH = FUNCTION_PROVIDER_OFFSET + 21;
FUNCTION_FSX_AUTOPILOT_BACKCOURSE = FUNCTION_PROVIDER_OFFSET + 22;
FUNCTION_FSX_AUTOPILOT_ALTITUDE = FUNCTION_PROVIDER_OFFSET + 23;
FUNCTION_FSX_AUTOPILOT_NAV = FUNCTION_PROVIDER_OFFSET + 24;
type type
TFSXLEDStateProvider = class(TLEDStateProvider) TFSXLEDStateProvider = class(TLEDStateProvider)
@ -130,11 +139,17 @@ begin
AConsumer.SetCategory('Dynamic'); AConsumer.SetCategory('Dynamic');
AConsumer.AddFunction(FUNCTION_FSX_CARBHEAT, 'Anti-ice');
AConsumer.AddFunction(FUNCTION_FSX_AUTOPILOT, 'Auto pilot (main)'); AConsumer.AddFunction(FUNCTION_FSX_AUTOPILOT, 'Auto pilot (main)');
AConsumer.AddFunction(FUNCTION_FSX_AUTOPILOT_AMBER, 'Auto pilot (main - off / amber)');
AConsumer.AddFunction(FUNCTION_FSX_AUTOPILOT_ALTITUDE, 'Auto pilot - Altitude');
AConsumer.AddFunction(FUNCTION_FSX_AUTOPILOT_APPROACH, 'Auto pilot - Approach');
AConsumer.AddFunction(FUNCTION_FSX_AUTOPILOT_BACKCOURSE, 'Auto pilot - Backcourse');
AConsumer.AddFunction(FUNCTION_FSX_AUTOPILOT_HEADING, 'Auto pilot - Heading');
AConsumer.AddFunction(FUNCTION_FSX_AUTOPILOT_NAV, 'Auto pilot - Nav');
AConsumer.AddFunction(FUNCTION_FSX_AVIONICSMASTER, 'Avionics master switch'); AConsumer.AddFunction(FUNCTION_FSX_AVIONICSMASTER, 'Avionics master switch');
AConsumer.AddFunction(FUNCTION_FSX_BATTERYMASTER, 'Battery master switch'); AConsumer.AddFunction(FUNCTION_FSX_BATTERYMASTER, 'Battery master switch');
AConsumer.AddFunction(FUNCTION_FSX_BEACONLIGHTS, 'Beacon lights'); AConsumer.AddFunction(FUNCTION_FSX_BEACONLIGHTS, 'Beacon lights');
// AConsumer.AddFunction(FUNCTION_FSX_CARBHEAT, 'Carburator heat / anti-ice');
AConsumer.AddFunction(FUNCTION_FSX_ENGINE, 'Engine'); AConsumer.AddFunction(FUNCTION_FSX_ENGINE, 'Engine');
AConsumer.AddFunction(FUNCTION_FSX_EXITDOOR, 'Exit door'); AConsumer.AddFunction(FUNCTION_FSX_EXITDOOR, 'Exit door');
AConsumer.AddFunction(FUNCTION_FSX_FLAPS, 'Flaps'); AConsumer.AddFunction(FUNCTION_FSX_FLAPS, 'Flaps');
@ -147,6 +162,7 @@ begin
AConsumer.AddFunction(FUNCTION_FSX_PRESSURIZATIONDUMPSWITCH, 'Pressurization dump switch'); AConsumer.AddFunction(FUNCTION_FSX_PRESSURIZATIONDUMPSWITCH, 'Pressurization dump switch');
AConsumer.AddFunction(FUNCTION_FSX_SPOILERS, 'Spoilers (air brake)'); AConsumer.AddFunction(FUNCTION_FSX_SPOILERS, 'Spoilers (air brake)');
AConsumer.AddFunction(FUNCTION_FSX_STROBELIGHTS, 'Strobe lights'); AConsumer.AddFunction(FUNCTION_FSX_STROBELIGHTS, 'Strobe lights');
AConsumer.AddFunction(FUNCTION_FSX_TAILHOOK, 'Tail hook');
end; end;
@ -278,9 +294,11 @@ begin
end; end;
{ Exit door } { Exit door }
if Consumer.FunctionMap.HasFunction(FUNCTION_FSX_EXITDOOR) then if Consumer.FunctionMap.HasFunction(FUNCTION_FSX_EXITDOOR) or
Consumer.FunctionMap.HasFunction(FUNCTION_FSX_TAILHOOK) then
begin begin
AddVariable(DEFINITION_EXITDOOR, 'CANOPY OPEN', FSX_UNIT_PERCENT, SIMCONNECT_DATAType_FLOAT64); AddVariable(DEFINITION_EXITDOOR, 'CANOPY OPEN', FSX_UNIT_PERCENT, SIMCONNECT_DATAType_FLOAT64);
AddVariable(DEFINITION_EXITDOOR, 'TAILHOOK POSITION', FSX_UNIT_PERCENT, SIMCONNECT_DATAType_FLOAT64);
AddDefinition(DEFINITION_EXITDOOR); AddDefinition(DEFINITION_EXITDOOR);
end; end;
@ -297,16 +315,24 @@ begin
{ Master switches } { Master switches }
if Consumer.FunctionMap.HasFunction([FUNCTION_FSX_BATTERYMASTER, FUNCTION_FSX_AVIONICSMASTER, if Consumer.FunctionMap.HasFunction([FUNCTION_FSX_BATTERYMASTER, FUNCTION_FSX_AVIONICSMASTER,
FUNCTION_FSX_PRESSURIZATIONDUMPSWITCH, FUNCTION_FSX_CARBHEAT, FUNCTION_FSX_PRESSURIZATIONDUMPSWITCH, FUNCTION_FSX_CARBHEAT,
FUNCTION_FSX_AUTOPILOT, FUNCTION_FSX_FUELPUMP]) then FUNCTION_FSX_AUTOPILOT, FUNCTION_FSX_FUELPUMP,
FUNCTION_FSX_AUTOPILOT_AMBER, FUNCTION_FSX_AUTOPILOT_HEADING,
FUNCTION_FSX_AUTOPILOT_APPROACH, FUNCTION_FSX_AUTOPILOT_BACKCOURSE,
FUNCTION_FSX_AUTOPILOT_ALTITUDE, FUNCTION_FSX_AUTOPILOT_NAV]) then
begin begin
AddVariable(DEFINITION_SWITCHES, 'AVIONICS MASTER SWITCH', FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32); AddVariable(DEFINITION_SWITCHES, 'AVIONICS MASTER SWITCH', FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32);
AddVariable(DEFINITION_SWITCHES, 'ELECTRICAL MASTER BATTERY', FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32); AddVariable(DEFINITION_SWITCHES, 'ELECTRICAL MASTER BATTERY', FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32);
AddVariable(DEFINITION_SWITCHES, 'PRESSURIZATION DUMP SWITCH', FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32); AddVariable(DEFINITION_SWITCHES, 'PRESSURIZATION DUMP SWITCH', FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32);
// AddVariable(DEFINITION_SWITCHES, 'CARB HEAT AVAILABLE', FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32); // AddVariable(DEFINITION_SWITCHES, 'CARB HEAT AVAILABLE', FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32);
// AddVariable(DEFINITION_SWITCHES, 'PANEL ANTI ICE SWITCH', FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32); AddVariable(DEFINITION_SWITCHES, 'PANEL ANTI ICE SWITCH', FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32);
AddVariable(DEFINITION_SWITCHES, 'AUTOPILOT AVAILABLE', FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32); AddVariable(DEFINITION_SWITCHES, 'AUTOPILOT AVAILABLE', FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32);
AddVariable(DEFINITION_SWITCHES, 'AUTOPILOT MASTER', FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32); AddVariable(DEFINITION_SWITCHES, 'AUTOPILOT MASTER', FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32);
// AddVariable(DEFINITION_SWITCHES, 'fuel pump?', FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32); // AddVariable(DEFINITION_SWITCHES, 'fuel pump?', FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32);
AddVariable(DEFINITION_SWITCHES, 'AUTOPILOT HEADING LOCK', FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32);
AddVariable(DEFINITION_SWITCHES, 'AUTOPILOT APPROACH HOLD', FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32);
AddVariable(DEFINITION_SWITCHES, 'AUTOPILOT BACKCOURSE HOLD', FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32);
AddVariable(DEFINITION_SWITCHES, 'AUTOPILOT ALTITUDE LOCK', FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32);
AddVariable(DEFINITION_SWITCHES, 'AUTOPILOT NAV1 LOCK', FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32);
AddDefinition(DEFINITION_SWITCHES); AddDefinition(DEFINITION_SWITCHES);
end; end;
@ -487,6 +513,7 @@ type
PExitDoorData = ^TExitDoorData; PExitDoorData = ^TExitDoorData;
TExitDoorData = packed record TExitDoorData = packed record
PercentOpen: Double; PercentOpen: Double;
TailHookPercent: Double;
end; end;
var var
@ -500,6 +527,12 @@ begin
95..100: Consumer.SetStateByFunction(FUNCTION_FSX_EXITDOOR, lsRed); 95..100: Consumer.SetStateByFunction(FUNCTION_FSX_EXITDOOR, lsRed);
else Consumer.SetStateByFunction(FUNCTION_FSX_EXITDOOR, lsAmber); else Consumer.SetStateByFunction(FUNCTION_FSX_EXITDOOR, lsAmber);
end; end;
case Trunc(exitDoorData^.TailHookPercent) of
0: Consumer.SetStateByFunction(FUNCTION_FSX_TAILHOOK, lsGreen);
95..100: Consumer.SetStateByFunction(FUNCTION_FSX_TAILHOOK, lsRed);
else Consumer.SetStateByFunction(FUNCTION_FSX_TAILHOOK, lsAmber);
end;
end; end;
@ -544,6 +577,7 @@ end;
procedure TFSXLEDStateProvider.HandleSwitchesData(AData: Pointer); procedure TFSXLEDStateProvider.HandleSwitchesData(AData: Pointer);
const const
ONOFF_STATE: array[Boolean] of TLEDState = (lsRed, lsGreen); ONOFF_STATE: array[Boolean] of TLEDState = (lsRed, lsGreen);
AMBER_ONOFF_STATE: array[Boolean] of TLEDState = (lsOff, lsAmber);
type type
PSwitchesData = ^TSwitchesData; PSwitchesData = ^TSwitchesData;
@ -552,9 +586,14 @@ type
BatterySwitch: Cardinal; BatterySwitch: Cardinal;
PressurizationDumpSwitch: Cardinal; PressurizationDumpSwitch: Cardinal;
// CarbHeatAvailable: Cardinal; // CarbHeatAvailable: Cardinal;
// AntiIceSwitch: Cardinal; AntiIceSwitch: Cardinal;
AutoPilotAvailable: Cardinal; AutoPilotAvailable: Cardinal;
AutoPilotMaster: Cardinal; AutoPilotMaster: Cardinal;
AutoPilotHeading: Cardinal;
AutoPilotApproach: Cardinal;
AutoPilotBackcourse: Cardinal;
AutoPilotAltitude: Cardinal;
AutoPilotNav: Cardinal;
end; end;
var var
@ -568,14 +607,29 @@ begin
Consumer.SetStateByFunction(FUNCTION_FSX_PRESSURIZATIONDUMPSWITCH, ONOFF_STATE[switchesData^.PressurizationDumpSwitch <> 0]); Consumer.SetStateByFunction(FUNCTION_FSX_PRESSURIZATIONDUMPSWITCH, ONOFF_STATE[switchesData^.PressurizationDumpSwitch <> 0]);
// if switchesData^.CarbHeatAvailable <> 0 then // if switchesData^.CarbHeatAvailable <> 0 then
// Consumer.SetStateByFunction(FUNCTION_FSX_CARBHEAT, ONOFF_STATE[switchesData^.AntiIceSwitch <> 0]) Consumer.SetStateByFunction(FUNCTION_FSX_CARBHEAT, ONOFF_STATE[switchesData^.AntiIceSwitch <> 0]);
// else // else
// Consumer.SetStateByFunction(FUNCTION_FSX_CARBHEAT, lsOff); // Consumer.SetStateByFunction(FUNCTION_FSX_CARBHEAT, lsOff);
if switchesData^.AutoPilotAvailable <> 0 then if switchesData^.AutoPilotAvailable <> 0 then
Consumer.SetStateByFunction(FUNCTION_FSX_AUTOPILOT, ONOFF_STATE[switchesData^.AutoPilotMaster <> 0]) begin
else Consumer.SetStateByFunction(FUNCTION_FSX_AUTOPILOT, ONOFF_STATE[switchesData^.AutoPilotMaster <> 0]);
Consumer.SetStateByFunction(FUNCTION_FSX_AUTOPILOT_AMBER, AMBER_ONOFF_STATE[switchesData^.AutoPilotMaster <> 0]);
Consumer.SetStateByFunction(FUNCTION_FSX_AUTOPILOT_HEADING, AMBER_ONOFF_STATE[switchesData^.AutoPilotHeading <> 0]);
Consumer.SetStateByFunction(FUNCTION_FSX_AUTOPILOT_APPROACH, AMBER_ONOFF_STATE[switchesData^.AutoPilotApproach <> 0]);
Consumer.SetStateByFunction(FUNCTION_FSX_AUTOPILOT_BACKCOURSE, AMBER_ONOFF_STATE[switchesData^.AutoPilotBackcourse <> 0]);
Consumer.SetStateByFunction(FUNCTION_FSX_AUTOPILOT_ALTITUDE, AMBER_ONOFF_STATE[switchesData^.AutoPilotAltitude <> 0]);
Consumer.SetStateByFunction(FUNCTION_FSX_AUTOPILOT_NAV, AMBER_ONOFF_STATE[switchesData^.AutoPilotNav <> 0]);
end else
begin
Consumer.SetStateByFunction(FUNCTION_FSX_AUTOPILOT, lsOff); Consumer.SetStateByFunction(FUNCTION_FSX_AUTOPILOT, lsOff);
Consumer.SetStateByFunction(FUNCTION_FSX_AUTOPILOT_AMBER, lsOff);
Consumer.SetStateByFunction(FUNCTION_FSX_AUTOPILOT_HEADING, lsOff);
Consumer.SetStateByFunction(FUNCTION_FSX_AUTOPILOT_APPROACH, lsOff);
Consumer.SetStateByFunction(FUNCTION_FSX_AUTOPILOT_BACKCOURSE, lsOff);
Consumer.SetStateByFunction(FUNCTION_FSX_AUTOPILOT_ALTITUDE, lsOff);
Consumer.SetStateByFunction(FUNCTION_FSX_AUTOPILOT_NAV, lsOff);
end;
end; end;