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 }
procedure TFSXFlapsFunction.RegisterStates;
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;
@ -289,7 +292,10 @@ end;
{ TFSXSpoilersFunction }
procedure TFSXSpoilersFunction.RegisterStates;
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;

View File

@ -316,39 +316,85 @@ end;
{ TFSXTailHookFunctionWorker }
procedure TFSXTailHookFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
begin
// #ToDo1 -cEmpty -oMvR: 22-2-2013: TFSXTailHookFunctionWorker.RegisterVariables
ADefinition.AddVariable('TAILHOOK POSITION', FSX_UNIT_PERCENT, SIMCONNECT_DATAType_FLOAT64);
end;
procedure TFSXTailHookFunctionWorker.HandleData(AData: Pointer);
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;
{ TFSXFlapsFunctionWorker }
procedure TFSXFlapsFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
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;
procedure TFSXFlapsFunctionWorker.HandleData(AData: Pointer);
type
PFlapsData = ^TFlapsData;
TFlapsData = packed record
FlapsAvailable: Cardinal;
FlapsHandlePercent: Double;
end;
var
flapsData: PFlapsData;
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;
{ TFSXSpoilersFunctionWorker }
procedure TFSXSpoilersFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition);
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;
procedure TFSXSpoilersFunctionWorker.HandleData(AData: Pointer);
type
PSpoilersData = ^TSpoilersData;
TSpoilersData = packed record
SpoilersAvailable: Cardinal;
SpoilersHandlePercent: Double;
end;
var
spoilersData: PSpoilersData;
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;

View File

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