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

Added support for spoilers (air brake)

Now checks if flaps/spoilers are available
This commit is contained in:
Mark van Renswoude 2012-11-19 19:56:37 +00:00
parent b01ca9b9e7
commit 9e2fa518aa
4 changed files with 64 additions and 31 deletions

View File

@ -87,8 +87,7 @@ type
procedure btnFSXToggleZoomClick(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure FunctionComboBoxChange(Sender: TObject);
procedure lblLinkLinkClick(Sender: TObject; const Link: string;
LinkType: TSysLinkType);
procedure lblLinkLinkClick(Sender: TObject; const Link: string; LinkType: TSysLinkType);
private
FEventMonitor: TOmniEventMonitor;
FStateConsumerTask: IOmniTaskControl;

View File

@ -49,8 +49,16 @@
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<DCC_DcuOutput>Lib</DCC_DcuOutput>
<VerInfo_MajorVer>0</VerInfo_MajorVer>
<DCC_ExeOutput>Bin</DCC_ExeOutput>
<DCC_UnitSearchPath>..\Shared;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_MinorVer>2</VerInfo_MinorVer>
<Manifest_File>None</Manifest_File>
<Icon_MainIcon>G940LEDControl_Icon.ico</Icon_MainIcon>
<DCC_Namespace>Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;System.Win;$(DCC_Namespace)</DCC_Namespace>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<VerInfo_Keys>CompanyName=X²Software;FileDescription=G940 LED Control;FileVersion=0.2.0.0;InternalName=;LegalCopyright=© 2011 X²Software;LegalTrademarks=;OriginalFilename=G940LEDControl.exe;ProductName=G940 LED Control;ProductVersion=0.2;Comments=</VerInfo_Keys>
<VerInfo_Locale>1043</VerInfo_Locale>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win64)'!=''">
@ -61,8 +69,6 @@
<DCC_PACKAGE_NO_LINK>false</DCC_PACKAGE_NO_LINK>
<DCC_UNIT_PLATFORM>false</DCC_UNIT_PLATFORM>
<DCC_SYMBOL_PLATFORM>false</DCC_SYMBOL_PLATFORM>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<Icon_MainIcon>G940LEDControl_Icon.ico</Icon_MainIcon>
<DCC_Namespace>Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
<VerInfo_Locale>1033</VerInfo_Locale>
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
@ -75,17 +81,17 @@
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Release>1</VerInfo_Release>
<VerInfo_MinorVer>3</VerInfo_MinorVer>
<VerInfo_Keys>CompanyName=X²Software;FileDescription=G940 LED Control;FileVersion=0.3.1.0;InternalName=;LegalCopyright=© 2011 X²Software;LegalTrademarks=;OriginalFilename=G940LEDControl.exe;ProductName=G940 LED Control;ProductVersion=0.3;Comments=</VerInfo_Keys>
<VerInfo_Locale>1033</VerInfo_Locale>
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<Version>7.0</Version>
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
<DCC_ExeOutput>Bin</DCC_ExeOutput>
<DCC_DcuOutput>Lib</DCC_DcuOutput>
<DCC_ObjOutput>Lib</DCC_ObjOutput>
<DCC_HppOutput>Lib</DCC_HppOutput>
<DCC_UnitSearchPath>..\DirectX;..\Shared;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
<DCC_ResourcePath>..\DirectX;..\Shared;$(DCC_ResourcePath)</DCC_ResourcePath>
<DCC_ObjPath>..\DirectX;..\Shared;$(DCC_ObjPath)</DCC_ObjPath>
<DCC_IncludePath>..\DirectX;..\Shared;$(DCC_IncludePath)</DCC_IncludePath>
@ -93,10 +99,8 @@
<DCC_UNIT_PLATFORM>False</DCC_UNIT_PLATFORM>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
<VerInfo_MinorVer>2</VerInfo_MinorVer>
<VerInfo_MajorVer>0</VerInfo_MajorVer>
<VerInfo_IncludeVerInfo>false</VerInfo_IncludeVerInfo>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=0.2.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=0.2;Comments=</VerInfo_Keys>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<Manifest_File>F:\Components\X2Utils\Resources\VistaManAsInvoker.manifest</Manifest_File>
<VerInfo_Locale>1033</VerInfo_Locale>
</PropertyGroup>

Binary file not shown.

View File

@ -29,6 +29,8 @@ const
FUNCTION_FSX_BATTERYMASTER = FUNCTION_PROVIDER_OFFSET + 11;
FUNCTION_FSX_AVIONICSMASTER = FUNCTION_PROVIDER_OFFSET + 12;
FUNCTION_FSX_SPOILERS = FUNCTION_PROVIDER_OFFSET + 13;
type
TFSXLEDStateProvider = class(TLEDStateProvider)
@ -90,7 +92,7 @@ const
DEFINITION_ENGINE = 5;
DEFINITION_THROTTLE = 6;
DEFINITION_EXITDOOR = 7;
DEFINITION_FLAPS = 8;
DEFINITION_FLAPSSPOILERS = 8;
DEFINITION_SWITCHES = 9;
EVENT_ZOOM = 10;
@ -107,9 +109,12 @@ const
FSX_VARIABLE_GEARDAMAGEBYSPEED = 'GEAR DAMAGE BY SPEED';
FSX_VARIABLE_GEARSPEEDEXCEEDED = 'GEAR SPEED EXCEEDED';
FSX_VARIABLE_CANOPYOPEN = 'CANOPY OPEN';
FSX_VARIABLE_FLAPSAVAILABLE = 'FLAPS AVAILABLE';
FSX_VARIABLE_FLAPSHANDLEPERCENT = 'FLAPS HANDLE PERCENT';
FSX_VARIABLE_AVIONICSMASTERSWITCH = 'AVIONICS MASTER SWITCH';
FSX_VARIABLE_ELECTRICALMASTERBATTERY = 'ELECTRICAL MASTER BATTERY';
FSX_VARIABLE_SPOILERSAVAILABLE = 'SPOILER AVAILABLE';
FSX_VARIABLE_SPOILERSHANDLEPOSITION = 'SPOILERS HANDLE POSITION';
@ -141,6 +146,8 @@ const
FUNCTION_DESC_FSX_BATTERYMASTER = 'Battery master switch';
FUNCTION_DESC_FSX_AVIONICSMASTER = 'Avionics master switch';
FUNCTION_DESC_FSX_SPOILERS = 'Spoilers (air brake)';
type
TThrottleData = packed record
NumberOfEngines: Integer;
@ -168,6 +175,8 @@ begin
AConsumer.AddFunction(FUNCTION_FSX_FLAPS, FUNCTION_DESC_FSX_FLAPS);
AConsumer.AddFunction(FUNCTION_FSX_BATTERYMASTER, FUNCTION_DESC_FSX_BATTERYMASTER);
AConsumer.AddFunction(FUNCTION_FSX_AVIONICSMASTER, FUNCTION_DESC_FSX_AVIONICSMASTER);
AConsumer.AddFunction(FUNCTION_FSX_SPOILERS, FUNCTION_DESC_FSX_SPOILERS);
end;
@ -307,11 +316,15 @@ begin
AddDefinition(DEFINITION_EXITDOOR);
end;
{ Flaps }
if Consumer.FunctionMap.HasFunction(FUNCTION_FSX_FLAPS) then
{ Flaps & spoilers }
if Consumer.FunctionMap.HasFunction(FUNCTION_FSX_FLAPS) or
Consumer.FunctionMap.HasFunction(FUNCTION_FSX_SPOILERS) then
begin
AddVariable(DEFINITION_FLAPS, FSX_VARIABLE_FLAPSHANDLEPERCENT, FSX_UNIT_PERCENT, SIMCONNECT_DATAType_FLOAT64);
AddDefinition(DEFINITION_FLAPS);
AddVariable(DEFINITION_FLAPSSPOILERS, FSX_VARIABLE_FLAPSAVAILABLE, FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32);
AddVariable(DEFINITION_FLAPSSPOILERS, FSX_VARIABLE_FLAPSHANDLEPERCENT, FSX_UNIT_PERCENT, SIMCONNECT_DATAType_FLOAT64);
AddVariable(DEFINITION_FLAPSSPOILERS, FSX_VARIABLE_SPOILERSAVAILABLE, FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32);
AddVariable(DEFINITION_FLAPSSPOILERS, FSX_VARIABLE_SPOILERSHANDLEPOSITION, FSX_UNIT_PERCENT, SIMCONNECT_DATAType_FLOAT64);
AddDefinition(DEFINITION_FLAPSSPOILERS);
end;
{ Master switches }
@ -363,7 +376,7 @@ begin
DEFINITION_PARKINGBRAKE: HandleParkingBrakeData(data);
DEFINITION_ENGINE: HandleEngineData(data);
DEFINITION_EXITDOOR: HandleExitDoorData(data);
DEFINITION_FLAPS: HandleFlapsData(data);
DEFINITION_FLAPSSPOILERS: HandleFlapsData(data);
DEFINITION_SWITCHES: HandleSwitchesData(data);
{
DEFINITION_THROTTLE:
@ -397,7 +410,7 @@ procedure TFSXLEDStateProvider.HandleGearData(AData: Pointer);
type
PGearData = ^TGearData;
TGearData = packed record
IsGearRetractable: Integer;
IsGearRetractable: Cardinal;
TotalPctExtended: Double;
DamageBySpeed: Integer;
SpeedExceeded: Integer;
@ -418,9 +431,9 @@ begin
else if gearData^.IsGearRetractable <> 0 then
begin
case Trunc(gearData ^.TotalPctExtended * 100) of
0: Consumer.SetStateByFunction(FUNCTION_FSX_GEAR, lsRed);
100: Consumer.SetStateByFunction(FUNCTION_FSX_GEAR, lsGreen);
else Consumer.SetStateByFunction(FUNCTION_FSX_GEAR, lsAmber);
0: Consumer.SetStateByFunction(FUNCTION_FSX_GEAR, lsRed);
95..100: Consumer.SetStateByFunction(FUNCTION_FSX_GEAR, lsGreen);
else Consumer.SetStateByFunction(FUNCTION_FSX_GEAR, lsAmber);
end;
end else
Consumer.SetStateByFunction(FUNCTION_FSX_GEAR, lsOff);
@ -508,9 +521,9 @@ begin
exitDoorData := AData;
case Trunc(exitDoorData^.PercentOpen) of
0: Consumer.SetStateByFunction(FUNCTION_FSX_EXITDOOR, lsGreen);
100: Consumer.SetStateByFunction(FUNCTION_FSX_EXITDOOR, lsRed);
else Consumer.SetStateByFunction(FUNCTION_FSX_EXITDOOR, lsAmber);
0: Consumer.SetStateByFunction(FUNCTION_FSX_EXITDOOR, lsGreen);
95..100: Consumer.SetStateByFunction(FUNCTION_FSX_EXITDOOR, lsRed);
else Consumer.SetStateByFunction(FUNCTION_FSX_EXITDOOR, lsAmber);
end;
end;
@ -519,7 +532,10 @@ procedure TFSXLEDStateProvider.HandleFlapsData(AData: Pointer);
type
PFlapsData = ^TFlapsData;
TFlapsData = packed record
HandlePercent: Double;
FlapsAvailable: Cardinal;
FlapsHandlePercent: Double;
SpoilersAvailable: Cardinal;
SpoilersHandlePercent: Double;
end;
var
@ -528,11 +544,25 @@ var
begin
flapsData := AData;
case Trunc(flapsData^.HandlePercent) of
0: Consumer.SetStateByFunction(FUNCTION_FSX_FLAPS, lsGreen);
100: Consumer.SetStateByFunction(FUNCTION_FSX_FLAPS, lsRed);
else Consumer.SetStateByFunction(FUNCTION_FSX_FLAPS, lsAmber);
end;
if flapsData^.FlapsAvailable <> 0 then
begin
case Trunc(flapsData^.FlapsHandlePercent) of
0: Consumer.SetStateByFunction(FUNCTION_FSX_FLAPS, lsGreen);
95..100: Consumer.SetStateByFunction(FUNCTION_FSX_FLAPS, lsRed);
else Consumer.SetStateByFunction(FUNCTION_FSX_FLAPS, lsAmber);
end;
end else
Consumer.SetStateByFunction(FUNCTION_FSX_FLAPS, lsOff);
if flapsData^.SpoilersAvailable <> 0 then
begin
case Trunc(flapsData^.SpoilersHandlePercent) of
0: Consumer.SetStateByFunction(FUNCTION_FSX_SPOILERS, lsGreen);
95..100: Consumer.SetStateByFunction(FUNCTION_FSX_SPOILERS, lsRed);
else Consumer.SetStateByFunction(FUNCTION_FSX_SPOILERS, lsAmber);
end;
end else
Consumer.SetStateByFunction(FUNCTION_FSX_SPOILERS, lsOff);
end;