1
0
mirror of synced 2024-11-05 02:59:16 +00:00

Added: pitot heat

This commit is contained in:
Mark van Renswoude 2015-03-14 09:43:15 +00:00
parent f0d3feb6cf
commit f3b7a0c45f
6 changed files with 169 additions and 57 deletions

View File

@ -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>

Binary file not shown.

View File

@ -67,6 +67,21 @@ type
end; end;
{ Instruments }
TFSXPitotOnOffFunction = class(TCustomFSXOnOffFunction)
protected
function GetCategoryName: string; override;
function GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass; override;
end;
TFSXPitotWarningFunction = class(TCustomFSXFunction)
protected
function GetCategoryName: string; override;
procedure RegisterStates; override;
function GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass; override;
end;
{ Engines } { Engines }
TFSXEngineAntiIceFunction = class(TCustomFSXFunction) TFSXEngineAntiIceFunction = class(TCustomFSXFunction)
protected protected
@ -358,6 +373,48 @@ begin
end; end;
{ TFSXPitotOnOffFunction }
function TFSXPitotOnOffFunction.GetCategoryName: string;
begin
Result := FSXCategoryInstruments;
end;
function TFSXPitotOnOffFunction.GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass;
begin
Result := TFSXPitotOnOffFunctionWorker;
end;
{ TFSXPitotWarningFunction }
function TFSXPitotWarningFunction.GetCategoryName: string;
begin
Result := FSXCategoryInstruments;
end;
procedure TFSXPitotWarningFunction.RegisterStates;
begin
RegisterState(TLEDState.Create(FSXStateUIDPitotOffIceNone, FSXStateDisplayNamePitotOffIceNone, lcRed));
RegisterState(TLEDState.Create(FSXStateUIDPitotOffIce25to50, FSXStateDisplayNamePitotOffIce25to50, lcFlashingAmberNormal));
RegisterState(TLEDState.Create(FSXStateUIDPitotOffIce50to75, FSXStateDisplayNamePitotOffIce50to75, lcFlashingAmberFast));
RegisterState(TLEDState.Create(FSXStateUIDPitotOffIce75to100, FSXStateDisplayNamePitotOffIce75to100, lcFlashingAmberFast));
RegisterState(TLEDState.Create(FSXStateUIDPitotOffIceFull, FSXStateDisplayNamePitotOffIceFull, lcFlashingRedFast));
RegisterState(TLEDState.Create(FSXStateUIDPitotOnIceFull, FSXStateDisplayNamePitotOnIceFull, lcFlashingRedNormal));
RegisterState(TLEDState.Create(FSXStateUIDPitotOnIce75to100, FSXStateDisplayNamePitotOnIce75to100, lcAmber));
RegisterState(TLEDState.Create(FSXStateUIDPitotOnIce50to75, FSXStateDisplayNamePitotOnIce50to75, lcAmber));
RegisterState(TLEDState.Create(FSXStateUIDPitotOnIce25to50, FSXStateDisplayNamePitotOnIce25to50, lcAmber));
RegisterState(TLEDState.Create(FSXStateUIDPitotOnIceNone, FSXStateDisplayNamePitotOnIceNone, lcGreen));
end;
function TFSXPitotWarningFunction.GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass;
begin
Result := TFSXPitotWarningFunctionWorker;
end;
{ TFSXEngineAntiIceFunction } { TFSXEngineAntiIceFunction }
function TFSXEngineAntiIceFunction.GetCategoryName: string; function TFSXEngineAntiIceFunction.GetCategoryName: string;
begin begin

View File

@ -136,6 +136,10 @@ begin
RegisterFunction(TFSXPressDumpSwitchFunction.Create( Self, FSXFunctionDisplayNamePressDumpSwitch, FSXFunctionUIDPressDumpSwitch)); RegisterFunction(TFSXPressDumpSwitchFunction.Create( Self, FSXFunctionDisplayNamePressDumpSwitch, FSXFunctionUIDPressDumpSwitch));
RegisterFunction(TFSXTailHookFunction.Create( Self, FSXFunctionDisplayNameTailHook, FSXFunctionUIDTailHook)); RegisterFunction(TFSXTailHookFunction.Create( Self, FSXFunctionDisplayNameTailHook, FSXFunctionUIDTailHook));
{ Instruments }
RegisterFunction(TFSXPitotOnOffFunction.Create( Self, FSXFunctionDisplayNamePitotOnOff, FSXFunctionUIDPitotOnOff));
RegisterFunction(TFSXPitotWarningFunction.Create( Self, FSXFunctionDisplayNamePitotWarning, FSXFunctionUIDPitotWarning));
{ Engines } { Engines }
RegisterFunction(TFSXEngineAntiIceFunction.Create( Self, FSXFunctionDisplayNameEngineAntiIce, FSXFunctionUIDEngineAntiIce)); RegisterFunction(TFSXEngineAntiIceFunction.Create( Self, FSXFunctionDisplayNameEngineAntiIce, FSXFunctionUIDEngineAntiIce));
RegisterFunction(TFSXEngineFunction.Create( Self, FSXFunctionDisplayNameEngine, FSXFunctionUIDEngine)); RegisterFunction(TFSXEngineFunction.Create( Self, FSXFunctionDisplayNameEngine, FSXFunctionUIDEngine));

View File

@ -11,17 +11,21 @@ uses
type type
{ Systems } TCustomFSXOnOffFunctionWorker = class(TCustomFSXFunctionWorker)
TFSXBatteryMasterFunctionWorker = class(TCustomFSXFunctionWorker)
protected protected
procedure RegisterVariables(ADefinition: IFSXSimConnectDefinition); override;
procedure HandleData(AData: Pointer); override; procedure HandleData(AData: Pointer); override;
end; end;
TFSXDeIceFunctionWorker = class(TCustomFSXFunctionWorker)
{ Systems }
TFSXBatteryMasterFunctionWorker = class(TCustomFSXOnOffFunctionWorker)
protected
procedure RegisterVariables(ADefinition: IFSXSimConnectDefinition); override;
end;
TFSXDeIceFunctionWorker = class(TCustomFSXOnOffFunctionWorker)
protected protected
procedure RegisterVariables(ADefinition: IFSXSimConnectDefinition); override; procedure RegisterVariables(ADefinition: IFSXSimConnectDefinition); override;
procedure HandleData(AData: Pointer); override;
end; end;
TFSXExitDoorFunctionWorker = class(TCustomFSXFunctionWorker) TFSXExitDoorFunctionWorker = class(TCustomFSXFunctionWorker)
@ -36,16 +40,14 @@ type
procedure HandleData(AData: Pointer); override; procedure HandleData(AData: Pointer); override;
end; end;
TFSXParkingBrakeFunctionWorker = class(TCustomFSXFunctionWorker) TFSXParkingBrakeFunctionWorker = class(TCustomFSXOnOffFunctionWorker)
protected protected
procedure RegisterVariables(ADefinition: IFSXSimConnectDefinition); override; procedure RegisterVariables(ADefinition: IFSXSimConnectDefinition); override;
procedure HandleData(AData: Pointer); override;
end; end;
TFSXPressDumpSwitchFunctionWorker = class(TCustomFSXFunctionWorker) TFSXPressDumpSwitchFunctionWorker = class(TCustomFSXOnOffFunctionWorker)
protected protected
procedure RegisterVariables(ADefinition: IFSXSimConnectDefinition); override; procedure RegisterVariables(ADefinition: IFSXSimConnectDefinition); override;
procedure HandleData(AData: Pointer); override;
end; end;
TFSXTailHookFunctionWorker = class(TCustomFSXFunctionWorker) TFSXTailHookFunctionWorker = class(TCustomFSXFunctionWorker)
@ -55,6 +57,19 @@ type
end; end;
{ Instruments }
TFSXPitotOnOffFunctionWorker = class(TCustomFSXOnOffFunctionWorker)
protected
procedure RegisterVariables(ADefinition: IFSXSimConnectDefinition); override;
end;
TFSXPitotWarningFunctionWorker = class(TCustomFSXFunctionWorker)
protected
procedure RegisterVariables(ADefinition: IFSXSimConnectDefinition); override;
procedure HandleData(AData: Pointer); override;
end;
{ Engines } { Engines }
TFSXEngineAntiIceFunctionWorker = class(TCustomFSXFunctionWorker) TFSXEngineAntiIceFunctionWorker = class(TCustomFSXFunctionWorker)
protected protected
@ -168,10 +183,9 @@ type
{ Radios } { Radios }
TFSXAvionicsMasterFunctionWorker = class(TCustomFSXFunctionWorker) TFSXAvionicsMasterFunctionWorker = class(TCustomFSXOnOffFunctionWorker)
protected protected
procedure RegisterVariables(ADefinition: IFSXSimConnectDefinition); override; procedure RegisterVariables(ADefinition: IFSXSimConnectDefinition); override;
procedure HandleData(AData: Pointer); override;
end; end;
@ -196,6 +210,7 @@ type
implementation implementation
uses uses
System.Math, System.Math,
System.StrUtils,
System.SysUtils, System.SysUtils,
Winapi.Windows, Winapi.Windows,
@ -206,6 +221,16 @@ uses
SimConnect; SimConnect;
{ TCustomFSXOnOffFunctionWorker }
procedure TCustomFSXOnOffFunctionWorker.HandleData(AData: Pointer);
begin
if PCardinal(AData)^ <> 0 then
SetCurrentState(FSXStateUIDOn)
else
SetCurrentState(FSXStateUIDOff);
end;
{ TFSXBatteryMasterFunctionWorker } { TFSXBatteryMasterFunctionWorker }
procedure TFSXBatteryMasterFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition); procedure TFSXBatteryMasterFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
begin begin
@ -213,15 +238,6 @@ begin
end; end;
procedure TFSXBatteryMasterFunctionWorker.HandleData(AData: Pointer);
begin
if PCardinal(AData)^ <> 0 then
SetCurrentState(FSXStateUIDOn)
else
SetCurrentState(FSXStateUIDOff);
end;
{ TFSXDeIceFunctionWorker } { TFSXDeIceFunctionWorker }
procedure TFSXDeIceFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition); procedure TFSXDeIceFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
begin begin
@ -229,15 +245,6 @@ begin
end; end;
procedure TFSXDeIceFunctionWorker.HandleData(AData: Pointer);
begin
if PCardinal(AData)^ <> 0 then
SetCurrentState(FSXStateUIDOn)
else
SetCurrentState(FSXStateUIDOff);
end;
{ TFSXExitDoorFunctionWorker } { TFSXExitDoorFunctionWorker }
procedure TFSXExitDoorFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition); procedure TFSXExitDoorFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
begin begin
@ -306,15 +313,6 @@ begin
end; end;
procedure TFSXParkingBrakeFunctionWorker.HandleData(AData: Pointer);
begin
if PCardinal(AData)^ <> 0 then
SetCurrentState(FSXStateUIDOn)
else
SetCurrentState(FSXStateUIDOff);
end;
{ TFSXPressDumpSwitchFunctionWorker } { TFSXPressDumpSwitchFunctionWorker }
procedure TFSXPressDumpSwitchFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition); procedure TFSXPressDumpSwitchFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
begin begin
@ -322,15 +320,6 @@ begin
end; end;
procedure TFSXPressDumpSwitchFunctionWorker.HandleData(AData: Pointer);
begin
if PCardinal(AData)^ <> 0 then
SetCurrentState(FSXStateUIDOn)
else
SetCurrentState(FSXStateUIDOff);
end;
{ TFSXTailHookFunctionWorker } { TFSXTailHookFunctionWorker }
procedure TFSXTailHookFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition); procedure TFSXTailHookFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
begin begin
@ -348,6 +337,47 @@ begin
end; end;
{ TFSXPitotOnOffFunctionWorker }
procedure TFSXPitotOnOffFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
begin
ADefinition.AddVariable('PITOT HEAT', FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32);
end;
{ TFSXPitotWarningFunctionWorker }
procedure TFSXPitotWarningFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
begin
ADefinition.AddVariable('PITOT HEAT', FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32);
ADefinition.AddVariable('PITOT ICE PCT', FSX_UNIT_PERCENT, SIMCONNECT_DATAType_FLOAT64);
end;
procedure TFSXPitotWarningFunctionWorker.HandleData(AData: Pointer);
type
PPitotData = ^TPitotData;
TPitotData = packed record
HeatActive: Cardinal;
IcePercentage: Double;
end;
var
pitotData: PPitotData;
heatActive: Boolean;
begin
pitotData := AData;
heatActive := (pitotData^.HeatActive <> 0);
case Trunc(pitotData^.IcePercentage) of
25..49: SetCurrentState(IfThen(heatActive, FSXStateUIDPitotOnIce25to50, FSXStateUIDPitotOffIce25to50));
50..74: SetCurrentState(IfThen(heatActive, FSXStateUIDPitotOnIce50to75, FSXStateUIDPitotOffIce50to75));
75..99: SetCurrentState(IfThen(heatActive, FSXStateUIDPitotOnIce75to100, FSXStateUIDPitotOffIce75to100));
100: SetCurrentState(IfThen(heatActive, FSXStateUIDPitotOnIceFull, FSXStateUIDPitotOffIceFull));
else SetCurrentState(IfThen(heatActive, FSXStateUIDPitotOnIceNone, FSXStateUIDPitotOffIceNone));
end;
end;
{ TFSXEngineAntiIceFunctionWorker } { TFSXEngineAntiIceFunctionWorker }
procedure TFSXEngineAntiIceFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition); procedure TFSXEngineAntiIceFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
var var
@ -732,15 +762,6 @@ begin
end; end;
procedure TFSXAvionicsMasterFunctionWorker.HandleData(AData: Pointer);
begin
if PCardinal(AData)^ <> 0 then
SetCurrentState(FSXStateUIDOn)
else
SetCurrentState(FSXStateUIDOff);
end;
{ TFSXFuelFunctionWorker } { TFSXFuelFunctionWorker }
procedure TFSXFuelFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition); procedure TFSXFuelFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
begin begin

View File

@ -13,6 +13,7 @@ const
FSXCategoryAutoPilot = FSXCategory + ' - Autopilot'; FSXCategoryAutoPilot = FSXCategory + ' - Autopilot';
FSXCategoryRadios = FSXCategory + ' - Radios'; FSXCategoryRadios = FSXCategory + ' - Radios';
FSXCategoryATC = FSXCategory + ' - ATC'; FSXCategoryATC = FSXCategory + ' - ATC';
FSXCategoryInstruments = FSXCategory + ' - Instruments';
FSXStateUIDOn = 'on'; FSXStateUIDOn = 'on';
FSXStateUIDOff = 'off'; FSXStateUIDOff = 'off';
@ -247,6 +248,35 @@ const
FSXStateDisplayNameATCVisible = 'Visible'; FSXStateDisplayNameATCVisible = 'Visible';
FSXFunctionUIDPitotOnOff = 'pitotOnOff';
FSXFunctionDisplayNamePitotOnOff = 'Pitot heat (on / off only)';
FSXFunctionUIDPitotWarning = 'pitotWarning';
FSXFunctionDisplayNamePitotWarning = 'Pitot heat (including warnings)';
FSXStateUIDPitotOffIceNone = 'off0';
FSXStateUIDPitotOffIce25to50 = 'off25To50';
FSXStateUIDPitotOffIce50to75 = 'off50To75';
FSXStateUIDPitotOffIce75to100 = 'off75To100';
FSXStateUIDPitotOffIceFull = 'off100';
FSXStateUIDPitotOnIceNone = 'on0';
FSXStateUIDPitotOnIce25to50 = 'on25To50';
FSXStateUIDPitotOnIce50to75 = 'on50To75';
FSXStateUIDPitotOnIce75to100 = 'on75To100';
FSXStateUIDPitotOnIceFull = 'on100';
FSXStateDisplayNamePitotOffIceNone = 'Heat off - No ice';
FSXStateDisplayNamePitotOffIce25to50 = 'Heat off - > 25% iced';
FSXStateDisplayNamePitotOffIce50to75 = 'Heat off - > 50% iced';
FSXStateDisplayNamePitotOffIce75to100 = 'Heat off - > 75% iced';
FSXStateDisplayNamePitotOffIceFull = 'Heat off - Fully iced';
FSXStateDisplayNamePitotOnIceNone = 'Heat on - No ice';
FSXStateDisplayNamePitotOnIce25to50 = 'Heat on - > 25% iced';
FSXStateDisplayNamePitotOnIce50to75 = 'Heat on - > 50% iced';
FSXStateDisplayNamePitotOnIce75to100 = 'Heat on - > 75% iced';
FSXStateDisplayNamePitotOnIceFull = 'Heat on - Fully iced';
FSXMenuProfiles = 'G940 Profile'; FSXMenuProfiles = 'G940 Profile';
FSXMenuProfileFormat = 'G940: %s'; FSXMenuProfileFormat = 'G940: %s';