1
0
mirror of synced 2024-11-21 17:43:51 +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>
<ProjectVersion>13.4</ProjectVersion>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Release</Config>
<Config Condition="'$(Config)'==''">Debug</Config>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
<TargetedPlatforms>1</TargetedPlatforms>
<AppType>Application</AppType>

Binary file not shown.

View File

@ -67,6 +67,21 @@ type
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 }
TFSXEngineAntiIceFunction = class(TCustomFSXFunction)
protected
@ -358,6 +373,48 @@ begin
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 }
function TFSXEngineAntiIceFunction.GetCategoryName: string;
begin

View File

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

View File

@ -11,17 +11,21 @@ uses
type
{ Systems }
TFSXBatteryMasterFunctionWorker = class(TCustomFSXFunctionWorker)
TCustomFSXOnOffFunctionWorker = class(TCustomFSXFunctionWorker)
protected
procedure RegisterVariables(ADefinition: IFSXSimConnectDefinition); override;
procedure HandleData(AData: Pointer); override;
end;
TFSXDeIceFunctionWorker = class(TCustomFSXFunctionWorker)
{ Systems }
TFSXBatteryMasterFunctionWorker = class(TCustomFSXOnOffFunctionWorker)
protected
procedure RegisterVariables(ADefinition: IFSXSimConnectDefinition); override;
end;
TFSXDeIceFunctionWorker = class(TCustomFSXOnOffFunctionWorker)
protected
procedure RegisterVariables(ADefinition: IFSXSimConnectDefinition); override;
procedure HandleData(AData: Pointer); override;
end;
TFSXExitDoorFunctionWorker = class(TCustomFSXFunctionWorker)
@ -36,16 +40,14 @@ type
procedure HandleData(AData: Pointer); override;
end;
TFSXParkingBrakeFunctionWorker = class(TCustomFSXFunctionWorker)
TFSXParkingBrakeFunctionWorker = class(TCustomFSXOnOffFunctionWorker)
protected
procedure RegisterVariables(ADefinition: IFSXSimConnectDefinition); override;
procedure HandleData(AData: Pointer); override;
end;
TFSXPressDumpSwitchFunctionWorker = class(TCustomFSXFunctionWorker)
TFSXPressDumpSwitchFunctionWorker = class(TCustomFSXOnOffFunctionWorker)
protected
procedure RegisterVariables(ADefinition: IFSXSimConnectDefinition); override;
procedure HandleData(AData: Pointer); override;
end;
TFSXTailHookFunctionWorker = class(TCustomFSXFunctionWorker)
@ -55,6 +57,19 @@ type
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 }
TFSXEngineAntiIceFunctionWorker = class(TCustomFSXFunctionWorker)
protected
@ -168,10 +183,9 @@ type
{ Radios }
TFSXAvionicsMasterFunctionWorker = class(TCustomFSXFunctionWorker)
TFSXAvionicsMasterFunctionWorker = class(TCustomFSXOnOffFunctionWorker)
protected
procedure RegisterVariables(ADefinition: IFSXSimConnectDefinition); override;
procedure HandleData(AData: Pointer); override;
end;
@ -196,6 +210,7 @@ type
implementation
uses
System.Math,
System.StrUtils,
System.SysUtils,
Winapi.Windows,
@ -206,6 +221,16 @@ uses
SimConnect;
{ TCustomFSXOnOffFunctionWorker }
procedure TCustomFSXOnOffFunctionWorker.HandleData(AData: Pointer);
begin
if PCardinal(AData)^ <> 0 then
SetCurrentState(FSXStateUIDOn)
else
SetCurrentState(FSXStateUIDOff);
end;
{ TFSXBatteryMasterFunctionWorker }
procedure TFSXBatteryMasterFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
begin
@ -213,15 +238,6 @@ begin
end;
procedure TFSXBatteryMasterFunctionWorker.HandleData(AData: Pointer);
begin
if PCardinal(AData)^ <> 0 then
SetCurrentState(FSXStateUIDOn)
else
SetCurrentState(FSXStateUIDOff);
end;
{ TFSXDeIceFunctionWorker }
procedure TFSXDeIceFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
begin
@ -229,15 +245,6 @@ begin
end;
procedure TFSXDeIceFunctionWorker.HandleData(AData: Pointer);
begin
if PCardinal(AData)^ <> 0 then
SetCurrentState(FSXStateUIDOn)
else
SetCurrentState(FSXStateUIDOff);
end;
{ TFSXExitDoorFunctionWorker }
procedure TFSXExitDoorFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
begin
@ -306,15 +313,6 @@ begin
end;
procedure TFSXParkingBrakeFunctionWorker.HandleData(AData: Pointer);
begin
if PCardinal(AData)^ <> 0 then
SetCurrentState(FSXStateUIDOn)
else
SetCurrentState(FSXStateUIDOff);
end;
{ TFSXPressDumpSwitchFunctionWorker }
procedure TFSXPressDumpSwitchFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
begin
@ -322,15 +320,6 @@ begin
end;
procedure TFSXPressDumpSwitchFunctionWorker.HandleData(AData: Pointer);
begin
if PCardinal(AData)^ <> 0 then
SetCurrentState(FSXStateUIDOn)
else
SetCurrentState(FSXStateUIDOff);
end;
{ TFSXTailHookFunctionWorker }
procedure TFSXTailHookFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
begin
@ -348,6 +337,47 @@ begin
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 }
procedure TFSXEngineAntiIceFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
var
@ -732,15 +762,6 @@ begin
end;
procedure TFSXAvionicsMasterFunctionWorker.HandleData(AData: Pointer);
begin
if PCardinal(AData)^ <> 0 then
SetCurrentState(FSXStateUIDOn)
else
SetCurrentState(FSXStateUIDOff);
end;
{ TFSXFuelFunctionWorker }
procedure TFSXFuelFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
begin

View File

@ -13,6 +13,7 @@ const
FSXCategoryAutoPilot = FSXCategory + ' - Autopilot';
FSXCategoryRadios = FSXCategory + ' - Radios';
FSXCategoryATC = FSXCategory + ' - ATC';
FSXCategoryInstruments = FSXCategory + ' - Instruments';
FSXStateUIDOn = 'on';
FSXStateUIDOff = 'off';
@ -247,6 +248,35 @@ const
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';
FSXMenuProfileFormat = 'G940: %s';