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

Added: tail hook worker, flaps and spoilers

This commit is contained in:
Mark van Renswoude 2013-02-23 08:32:20 +00:00
parent 2cef07e337
commit 62fb8e1357
3 changed files with 82 additions and 8 deletions

View File

@ -276,7 +276,10 @@ end;
{ TFSXFlapsFunction } { TFSXFlapsFunction }
procedure TFSXFlapsFunction.RegisterStates; procedure TFSXFlapsFunction.RegisterStates;
begin begin
// #ToDo1 -cEmpty -oMvR: 22-2-2013: TFSXFlapsFunction.RegisterStates RegisterState(TLEDState.Create(FSXStateUIDFlapsNotAvailable, FSXStateDisplayNameFlapsNotAvailable, lcOff));
RegisterState(TLEDState.Create(FSXStateUIDFlapsRetracted, FSXStateDisplayNameFlapsRetracted, lcGreen));
RegisterState(TLEDState.Create(FSXStateUIDFlapsBetween, FSXStateDisplayNameFlapsBetween, lcAmber));
RegisterState(TLEDState.Create(FSXStateUIDFlapsExtended, FSXStateDisplayNameFlapsExtended, lcRed));
end; end;
@ -289,7 +292,10 @@ end;
{ TFSXSpoilersFunction } { TFSXSpoilersFunction }
procedure TFSXSpoilersFunction.RegisterStates; procedure TFSXSpoilersFunction.RegisterStates;
begin begin
// #ToDo1 -cEmpty -oMvR: 22-2-2013: TFSXSpoilersFunction.RegisterStates RegisterState(TLEDState.Create(FSXStateUIDSpoilersNotAvailable, FSXStateDisplayNameSpoilersNotAvailable, lcOff));
RegisterState(TLEDState.Create(FSXStateUIDSpoilersRetracted, FSXStateDisplayNameSpoilersRetracted, lcGreen));
RegisterState(TLEDState.Create(FSXStateUIDSpoilersBetween, FSXStateDisplayNameSpoilersBetween, lcAmber));
RegisterState(TLEDState.Create(FSXStateUIDSpoilersExtended, FSXStateDisplayNameSpoilersExtended, lcRed));
end; end;

View File

@ -316,39 +316,85 @@ end;
{ TFSXTailHookFunctionWorker } { TFSXTailHookFunctionWorker }
procedure TFSXTailHookFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition); procedure TFSXTailHookFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
begin begin
// #ToDo1 -cEmpty -oMvR: 22-2-2013: TFSXTailHookFunctionWorker.RegisterVariables ADefinition.AddVariable('TAILHOOK POSITION', FSX_UNIT_PERCENT, SIMCONNECT_DATAType_FLOAT64);
end; end;
procedure TFSXTailHookFunctionWorker.HandleData(AData: Pointer); procedure TFSXTailHookFunctionWorker.HandleData(AData: Pointer);
begin begin
// #ToDo1 -cEmpty -oMvR: 22-2-2013: TFSXTailHookFunctionWorker.HandleData case Trunc(PDouble(AData)^) of
0..5: SetCurrentState(FSXStateUIDTailHookRetracted);
95..100: SetCurrentState(FSXStateUIDTailHookBetween);
else SetCurrentState(FSXStateUIDTailHookExtended);
end;
end; end;
{ TFSXFlapsFunctionWorker } { TFSXFlapsFunctionWorker }
procedure TFSXFlapsFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition); procedure TFSXFlapsFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
begin begin
// #ToDo1 -cEmpty -oMvR: 22-2-2013: TFSXFlapsFunctionWorker.RegisterVariables ADefinition.AddVariable('FLAPS AVAILABLE', FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32);
ADefinition.AddVariable('FLAPS HANDLE PERCENT', FSX_UNIT_PERCENT, SIMCONNECT_DATAType_FLOAT64);
end; end;
procedure TFSXFlapsFunctionWorker.HandleData(AData: Pointer); procedure TFSXFlapsFunctionWorker.HandleData(AData: Pointer);
type
PFlapsData = ^TFlapsData;
TFlapsData = packed record
FlapsAvailable: Cardinal;
FlapsHandlePercent: Double;
end;
var
flapsData: PFlapsData;
begin begin
// #ToDo1 -cEmpty -oMvR: 22-2-2013: TFSXFlapsFunctionWorker.HandleData flapsData := AData;
if flapsData^.FlapsAvailable <> 0 then
begin
case Trunc(flapsData^.FlapsHandlePercent) of
0..5: SetCurrentState(FSXStateUIDFlapsRetracted);
95..100: SetCurrentState(FSXStateUIDFlapsExtended);
else SetCurrentState(FSXStateUIDFlapsBetween);
end;
end else
SetCurrentState(FSXStateUIDFlapsNotAvailable);
end; end;
{ TFSXSpoilersFunctionWorker } { TFSXSpoilersFunctionWorker }
procedure TFSXSpoilersFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition); procedure TFSXSpoilersFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
begin begin
// #ToDo1 -cEmpty -oMvR: 22-2-2013: TFSXSpoilersFunctionWorker.RegisterVariables ADefinition.AddVariable('SPOILER AVAILABLE', FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32);
ADefinition.AddVariable('SPOILERS HANDLE POSITION', FSX_UNIT_PERCENT, SIMCONNECT_DATAType_FLOAT64);
end; end;
procedure TFSXSpoilersFunctionWorker.HandleData(AData: Pointer); procedure TFSXSpoilersFunctionWorker.HandleData(AData: Pointer);
type
PSpoilersData = ^TSpoilersData;
TSpoilersData = packed record
SpoilersAvailable: Cardinal;
SpoilersHandlePercent: Double;
end;
var
spoilersData: PSpoilersData;
begin begin
// #ToDo1 -cEmpty -oMvR: 22-2-2013: TFSXSpoilersFunctionWorker.HandleData SpoilersData := AData;
if SpoilersData^.SpoilersAvailable <> 0 then
begin
case Trunc(SpoilersData^.SpoilersHandlePercent) of
0..5: SetCurrentState(FSXStateUIDSpoilersRetracted);
95..100: SetCurrentState(FSXStateUIDSpoilersExtended);
else SetCurrentState(FSXStateUIDSpoilersBetween);
end;
end else
SetCurrentState(FSXStateUIDSpoilersNotAvailable);
end; end;

View File

@ -102,9 +102,31 @@ const
FSXFunctionUIDFlaps = 'flaps'; FSXFunctionUIDFlaps = 'flaps';
FSXFunctionDisplayNameFlaps = 'Flaps'; FSXFunctionDisplayNameFlaps = 'Flaps';
FSXStateUIDFlapsNotAvailable = 'notAvailable';
FSXStateUIDFlapsRetracted = 'retracted';
FSXStateUIDFlapsBetween = 'between';
FSXStateUIDFlapsExtended = 'extended';
FSXStateDisplayNameFlapsNotAvailable = 'No flaps';
FSXStateDisplayNameFlapsRetracted = 'Retracted';
FSXStateDisplayNameFlapsBetween = 'Extending / retracting';
FSXStateDisplayNameFlapsExtended = 'Extended';
FSXFunctionUIDSpoilers = 'spoilers'; FSXFunctionUIDSpoilers = 'spoilers';
FSXFunctionDisplayNameSpoilers = 'Spoilers'; FSXFunctionDisplayNameSpoilers = 'Spoilers';
FSXStateUIDSpoilersNotAvailable = 'notAvailable';
FSXStateUIDSpoilersRetracted = 'retracted';
FSXStateUIDSpoilersBetween = 'between';
FSXStateUIDSpoilersExtended = 'extended';
FSXStateDisplayNameSpoilersNotAvailable = 'No spoilers';
FSXStateDisplayNameSpoilersRetracted = 'Retracted';
FSXStateDisplayNameSpoilersBetween = 'Extending / retracting';
FSXStateDisplayNameSpoilersExtended = 'Extended';
FSXFunctionUIDBatteryMaster = 'batteryMaster'; FSXFunctionUIDBatteryMaster = 'batteryMaster';
FSXFunctionDisplayNameBatteryMaster = 'Battery master'; FSXFunctionDisplayNameBatteryMaster = 'Battery master';