Added fuel level function
This commit is contained in:
parent
f3257a15b8
commit
b30d1ec59d
@ -5,7 +5,7 @@ object ButtonFunctionForm: TButtonFunctionForm
|
|||||||
BorderIcons = [biSystemMenu]
|
BorderIcons = [biSystemMenu]
|
||||||
BorderStyle = bsDialog
|
BorderStyle = bsDialog
|
||||||
Caption = 'Configure button'
|
Caption = 'Configure button'
|
||||||
ClientHeight = 484
|
ClientHeight = 561
|
||||||
ClientWidth = 692
|
ClientWidth = 692
|
||||||
Color = clBtnFace
|
Color = clBtnFace
|
||||||
Font.Charset = DEFAULT_CHARSET
|
Font.Charset = DEFAULT_CHARSET
|
||||||
@ -31,7 +31,7 @@ object ButtonFunctionForm: TButtonFunctionForm
|
|||||||
object pnlButtons: TPanel
|
object pnlButtons: TPanel
|
||||||
AlignWithMargins = True
|
AlignWithMargins = True
|
||||||
Left = 0
|
Left = 0
|
||||||
Top = 441
|
Top = 518
|
||||||
Width = 692
|
Width = 692
|
||||||
Height = 43
|
Height = 43
|
||||||
Margins.Left = 0
|
Margins.Left = 0
|
||||||
@ -41,6 +41,7 @@ object ButtonFunctionForm: TButtonFunctionForm
|
|||||||
Align = alBottom
|
Align = alBottom
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
TabOrder = 3
|
TabOrder = 3
|
||||||
|
ExplicitTop = 441
|
||||||
DesignSize = (
|
DesignSize = (
|
||||||
692
|
692
|
||||||
43)
|
43)
|
||||||
@ -80,7 +81,7 @@ object ButtonFunctionForm: TButtonFunctionForm
|
|||||||
Left = 8
|
Left = 8
|
||||||
Top = 60
|
Top = 60
|
||||||
Width = 257
|
Width = 257
|
||||||
Height = 373
|
Height = 450
|
||||||
Margins.Left = 8
|
Margins.Left = 8
|
||||||
Margins.Top = 8
|
Margins.Top = 8
|
||||||
Margins.Right = 0
|
Margins.Right = 0
|
||||||
@ -103,6 +104,7 @@ object ButtonFunctionForm: TButtonFunctionForm
|
|||||||
OnGetText = vstFunctionsGetText
|
OnGetText = vstFunctionsGetText
|
||||||
OnPaintText = vstFunctionsPaintText
|
OnPaintText = vstFunctionsPaintText
|
||||||
OnIncrementalSearch = vstFunctionsIncrementalSearch
|
OnIncrementalSearch = vstFunctionsIncrementalSearch
|
||||||
|
ExplicitHeight = 373
|
||||||
Columns = <
|
Columns = <
|
||||||
item
|
item
|
||||||
Position = 0
|
Position = 0
|
||||||
@ -115,7 +117,7 @@ object ButtonFunctionForm: TButtonFunctionForm
|
|||||||
Left = 273
|
Left = 273
|
||||||
Top = 60
|
Top = 60
|
||||||
Width = 411
|
Width = 411
|
||||||
Height = 373
|
Height = 450
|
||||||
Margins.Left = 8
|
Margins.Left = 8
|
||||||
Margins.Top = 8
|
Margins.Top = 8
|
||||||
Margins.Right = 8
|
Margins.Right = 8
|
||||||
@ -123,6 +125,7 @@ object ButtonFunctionForm: TButtonFunctionForm
|
|||||||
Align = alClient
|
Align = alClient
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
|
ExplicitHeight = 373
|
||||||
object pnlName: TPanel
|
object pnlName: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Top = 0
|
Top = 0
|
||||||
@ -190,10 +193,11 @@ object ButtonFunctionForm: TButtonFunctionForm
|
|||||||
Left = 0
|
Left = 0
|
||||||
Top = 97
|
Top = 97
|
||||||
Width = 411
|
Width = 411
|
||||||
Height = 276
|
Height = 353
|
||||||
Align = alClient
|
Align = alClient
|
||||||
BorderStyle = bsNone
|
BorderStyle = bsNone
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
|
ExplicitHeight = 276
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object pnlHeader: TPanel
|
object pnlHeader: TPanel
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<FrameworkType>VCL</FrameworkType>
|
<FrameworkType>VCL</FrameworkType>
|
||||||
<ProjectVersion>13.4</ProjectVersion>
|
<ProjectVersion>13.4</ProjectVersion>
|
||||||
<Base>True</Base>
|
<Base>True</Base>
|
||||||
<Config Condition="'$(Config)'==''">Release</Config>
|
<Config Condition="'$(Config)'==''">Debug</Config>
|
||||||
<Platform Condition="'$(Platform)'==''">Win32</Platform>
|
<Platform Condition="'$(Platform)'==''">Win32</Platform>
|
||||||
<TargetedPlatforms>1</TargetedPlatforms>
|
<TargetedPlatforms>1</TargetedPlatforms>
|
||||||
<AppType>Application</AppType>
|
<AppType>Application</AppType>
|
||||||
@ -103,7 +103,7 @@
|
|||||||
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
|
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
|
||||||
<VerInfo_IncludeVerInfo>false</VerInfo_IncludeVerInfo>
|
<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_Keys>CompanyName=;FileDescription=;FileVersion=0.2.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=0.2;Comments=</VerInfo_Keys>
|
||||||
<Manifest_File>F:\Components\X2Utils\Resources\VistaManAsInvoker.manifest</Manifest_File>
|
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
|
||||||
<VerInfo_Locale>1033</VerInfo_Locale>
|
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -200,9 +200,7 @@
|
|||||||
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
|
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
|
||||||
<VersionInfoKeys Name="Comments"/>
|
<VersionInfoKeys Name="Comments"/>
|
||||||
</VersionInfoKeys>
|
</VersionInfoKeys>
|
||||||
<Excluded_Packages>
|
<Excluded_Packages/>
|
||||||
<Excluded_Packages Name="D:\Program Files\Developer Express.VCL\Library\Delphi16\dclcxPivotGridOLAPD16.bpl">ExpressPivotGrid 2 OLAP by Developer Express Inc.</Excluded_Packages>
|
|
||||||
</Excluded_Packages>
|
|
||||||
</Delphi.Personality>
|
</Delphi.Personality>
|
||||||
<Platforms>
|
<Platforms>
|
||||||
<Platform value="Win64">False</Platform>
|
<Platform value="Win64">False</Platform>
|
||||||
|
Binary file not shown.
@ -199,6 +199,15 @@ type
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ Fuel }
|
||||||
|
TFSXFuelFunction = class(TCustomFSXFunction)
|
||||||
|
protected
|
||||||
|
procedure RegisterStates; override;
|
||||||
|
function GetCategoryName: string; override;
|
||||||
|
function GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass; override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
uses
|
uses
|
||||||
FSXLEDFunctionWorker,
|
FSXLEDFunctionWorker,
|
||||||
@ -580,4 +589,32 @@ begin
|
|||||||
Result := TFSXAvionicsMasterFunctionWorker;
|
Result := TFSXAvionicsMasterFunctionWorker;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TFSXFuelFunction }
|
||||||
|
procedure TFSXFuelFunction.RegisterStates;
|
||||||
|
begin
|
||||||
|
RegisterState(TLEDState.Create(FSXStateUIDFuelNotAvailable, FSXStateDisplayNameFuelNotAvailable, lcOff));
|
||||||
|
RegisterState(TLEDState.Create(FSXStateUIDFuelEmpty, FSXStateDisplayNameFuelEmpty, lcFlashingRedFast));
|
||||||
|
RegisterState(TLEDState.Create(FSXStateUIDFuel0to1, FSXStateDisplayNameFuel0to1, lcFlashingRedNormal));
|
||||||
|
RegisterState(TLEDState.Create(FSXStateUIDFuel1to2, FSXStateDisplayNameFuel1to2, lcFlashingRedNormal));
|
||||||
|
RegisterState(TLEDState.Create(FSXStateUIDFuel2to5, FSXStateDisplayNameFuel2to5, lcRed));
|
||||||
|
RegisterState(TLEDState.Create(FSXStateUIDFuel5to10, FSXStateDisplayNameFuel5to10, lcAmber));
|
||||||
|
RegisterState(TLEDState.Create(FSXStateUIDFuel10to20, FSXStateDisplayNameFuel10to20, lcAmber));
|
||||||
|
RegisterState(TLEDState.Create(FSXStateUIDFuel20to50, FSXStateDisplayNameFuel20to50, lcGreen));
|
||||||
|
RegisterState(TLEDState.Create(FSXStateUIDFuel50to75, FSXStateDisplayNameFuel50to75, lcGreen));
|
||||||
|
RegisterState(TLEDState.Create(FSXStateUIDFuel75to100, FSXStateDisplayNameFuel75to100, lcGreen));
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TFSXFuelFunction.GetCategoryName: string;
|
||||||
|
begin
|
||||||
|
Result := FSXCategorySystems;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TFSXFuelFunction.GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass;
|
||||||
|
begin
|
||||||
|
Result := TFSXFuelFunctionWorker;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -164,6 +164,9 @@ begin
|
|||||||
|
|
||||||
{ Radios }
|
{ Radios }
|
||||||
RegisterFunction(TFSXAvionicsMasterFunction.Create( Self, FSXFunctionDisplayNameAvionicsMaster, FSXFunctionUIDAvionicsMaster));
|
RegisterFunction(TFSXAvionicsMasterFunction.Create( Self, FSXFunctionDisplayNameAvionicsMaster, FSXFunctionUIDAvionicsMaster));
|
||||||
|
|
||||||
|
{ Fuel }
|
||||||
|
RegisterFunction(TFSXFuelFunction.Create( Self, FSXFunctionDisplayNameFuel, FSXFunctionUIDFuel));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -165,6 +165,14 @@ type
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ Fuel }
|
||||||
|
TFSXFuelFunctionWorker = class(TCustomFSXFunctionWorker)
|
||||||
|
protected
|
||||||
|
procedure RegisterVariables(ADefinition: IFSXSimConnectDefinition); override;
|
||||||
|
procedure HandleData(AData: Pointer); override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
uses
|
uses
|
||||||
System.Math,
|
System.Math,
|
||||||
@ -510,7 +518,7 @@ var
|
|||||||
spoilersData: PSpoilersData;
|
spoilersData: PSpoilersData;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
SpoilersData := AData;
|
spoilersData := AData;
|
||||||
|
|
||||||
if SpoilersData^.SpoilersAvailable <> 0 then
|
if SpoilersData^.SpoilersAvailable <> 0 then
|
||||||
begin
|
begin
|
||||||
@ -651,4 +659,47 @@ begin
|
|||||||
SetCurrentState(FSXStateUIDOff);
|
SetCurrentState(FSXStateUIDOff);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TFSXFuelFunctionWorker }
|
||||||
|
procedure TFSXFuelFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
|
||||||
|
begin
|
||||||
|
ADefinition.AddVariable('FUEL TOTAL CAPACITY', FSX_UNIT_NUMBER, SIMCONNECT_DATAType_FLOAT64);
|
||||||
|
ADefinition.AddVariable('FUEL TOTAL QUANTITY', FSX_UNIT_NUMBER, SIMCONNECT_DATAType_FLOAT64);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TFSXFuelFunctionWorker.HandleData(AData: Pointer);
|
||||||
|
type
|
||||||
|
PFuelData = ^TFuelData;
|
||||||
|
TFuelData = packed record
|
||||||
|
TotalCapacity: Double;
|
||||||
|
TotalQuantity: Double;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
fuelData: PFuelData;
|
||||||
|
percentage: Integer;
|
||||||
|
|
||||||
|
begin
|
||||||
|
fuelData := AData;
|
||||||
|
|
||||||
|
if fuelData^.TotalCapacity > 0 then
|
||||||
|
begin
|
||||||
|
percentage := Ceil(fuelData^.TotalQuantity / fuelData^.TotalCapacity * 100);
|
||||||
|
case percentage of
|
||||||
|
0: SetCurrentState(FSXStateUIDFuelEmpty);
|
||||||
|
1: SetCurrentState(FSXStateUIDFuel0to1);
|
||||||
|
2: SetCurrentState(FSXStateUIDFuel1to2);
|
||||||
|
3..5: SetCurrentState(FSXStateUIDFuel2to5);
|
||||||
|
6..10: SetCurrentState(FSXStateUIDFuel5to10);
|
||||||
|
11..20: SetCurrentState(FSXStateUIDFuel10to20);
|
||||||
|
21..50: SetCurrentState(FSXStateUIDFuel20to50);
|
||||||
|
51..75: SetCurrentState(FSXStateUIDFuel50to75);
|
||||||
|
else
|
||||||
|
SetCurrentState(FSXStateUIDFuel75to100);
|
||||||
|
end;
|
||||||
|
end else
|
||||||
|
SetCurrentState(FSXStateUIDFuelNotAvailable);
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -194,6 +194,32 @@ const
|
|||||||
FSXFunctionDisplayNameAutoPilotNav = 'Autopilot nav';
|
FSXFunctionDisplayNameAutoPilotNav = 'Autopilot nav';
|
||||||
|
|
||||||
|
|
||||||
|
FSXFunctionUIDFuel = 'fuelLevel';
|
||||||
|
FSXFunctionDisplayNameFuel = 'Fuel Level';
|
||||||
|
|
||||||
|
FSXStateUIDFuelNotAvailable = 'notAvailable';
|
||||||
|
FSXStateUIDFuelEmpty = 'empty';
|
||||||
|
FSXStateUIDFuel0to1 = '0To1';
|
||||||
|
FSXStateUIDFuel1to2 = '1To2';
|
||||||
|
FSXStateUIDFuel2to5 = '2To5';
|
||||||
|
FSXStateUIDFuel5to10 = '5To10';
|
||||||
|
FSXStateUIDFuel10to20 = '10To20';
|
||||||
|
FSXStateUIDFuel20to50 = '20To50';
|
||||||
|
FSXStateUIDFuel50to75 = '50To75';
|
||||||
|
FSXStateUIDFuel75to100 = '75To100';
|
||||||
|
|
||||||
|
FSXStateDisplayNameFuelNotAvailable = 'Not available';
|
||||||
|
FSXStateDisplayNameFuelEmpty = 'Empty';
|
||||||
|
FSXStateDisplayNameFuel0to1 = '< 1%';
|
||||||
|
FSXStateDisplayNameFuel1to2 = '< 2%';
|
||||||
|
FSXStateDisplayNameFuel2to5 = '< 5%';
|
||||||
|
FSXStateDisplayNameFuel5to10 = '< 10%';
|
||||||
|
FSXStateDisplayNameFuel10to20 = '< 20%';
|
||||||
|
FSXStateDisplayNameFuel20to50 = '< 50%';
|
||||||
|
FSXStateDisplayNameFuel50to75 = '< 75%';
|
||||||
|
FSXStateDisplayNameFuel75to100 = '75% - Full';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FSXMenuProfiles = 'G940 Profile';
|
FSXMenuProfiles = 'G940 Profile';
|
||||||
FSXMenuProfileFormat = 'G940: %s';
|
FSXMenuProfileFormat = 'G940: %s';
|
||||||
|
Loading…
Reference in New Issue
Block a user