From 7a1e4ed494731f58341ef9a11e30d53e3a9068ba Mon Sep 17 00:00:00 2001 From: Mark van Renswoude Date: Sat, 19 Dec 2015 13:53:10 +0000 Subject: [PATCH] Added Auto brake and Spoilers armed functions Added search functionality for functions Updated version of SimConnect Steam Edition --- G940LEDControl/Bin/FSX-SE-SimConnect.dll | Bin 45056 -> 45056 bytes G940LEDControl/Forms/ButtonFunctionFrm.dfm | 119 ++++++---- G940LEDControl/Forms/ButtonFunctionFrm.pas | 89 ++++++++ G940LEDControl/Forms/MainFrm.dfm | 12 +- G940LEDControl/Forms/MainFrm.pas | 3 +- G940LEDControl/G940LEDControl.dproj | 12 +- G940LEDControl/G940LEDControl.res | Bin 28540 -> 28540 bytes G940LEDControl/Units/FSXLEDFunction.pas | 56 +++++ .../Units/FSXLEDFunctionProvider.pas | 2 + G940LEDControl/Units/FSXLEDFunctionWorker.pas | 78 ++++++- G940LEDControl/Units/FSXResources.pas | 20 ++ Test/G940Test.dproj | 210 ++++++++++++------ 12 files changed, 480 insertions(+), 121 deletions(-) diff --git a/G940LEDControl/Bin/FSX-SE-SimConnect.dll b/G940LEDControl/Bin/FSX-SE-SimConnect.dll index a70883d307a05e3f3f91628c4adfc39ca36d04ac..afa03e913593d186c93e4e9f79dca29b23b6bffe 100644 GIT binary patch delta 3624 zcmZ{nc~}%j7Qm|pP*BiDh;nEg@Fp0$r@NukG*q^{aaC)q7p_s%pM* zx=c=&sh+|SkJi_YLv4=>MMiYQ{s>ip!u(u$lQ4Kt#BdcO6Niu>vUgOV zxhJCPA`s<_L=@d0QO)`$?+dt3Q8cKQBdQT(9T3AHs+t2A0~XxCbtpM)l7^Y zLfpipxTHU`U87HB?1|m7)7&m>T&fH+La}1{Yehw|#WUvQrVp8(|9W0YRsxrvJEdqw zN&1kal%#lQ&n8s+UOvW`dPCgqArLkX!a~3GF~XEW-$@GF_w4(^axWC2vPy)u0p9?T zu&#+f8L*{lbwoFEv^^UzCInILXI=;$^X@&7`1n?LZ$BHMJ8~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|2sliSf6nmSjtor4nif|5~#_tjuPzbJ!}j zmi-LQS0=y6%G*+GAJ|fb3a5~3Uto9IKei7Nr;Fc+--)kCrSg7xx|*O((Pn9jv{zv` z)!Jt5qOo=kg!+Oo(cW|bEzqfSES5PjR@>D3 asvqp!XpPo5O@>8@*G6ke`qv*0#s33_xl#fE diff --git a/G940LEDControl/Forms/ButtonFunctionFrm.dfm b/G940LEDControl/Forms/ButtonFunctionFrm.dfm index ddbe85c..eddd84b 100644 --- a/G940LEDControl/Forms/ButtonFunctionFrm.dfm +++ b/G940LEDControl/Forms/ButtonFunctionFrm.dfm @@ -40,8 +40,7 @@ object ButtonFunctionForm: TButtonFunctionForm Margins.Bottom = 0 Align = alBottom BevelOuter = bvNone - TabOrder = 3 - ExplicitTop = 441 + TabOrder = 2 DesignSize = ( 692 43) @@ -76,42 +75,6 @@ object ButtonFunctionForm: TButtonFunctionForm TabOrder = 1 end end - object vstFunctions: TVirtualStringTree - AlignWithMargins = True - Left = 8 - Top = 60 - Width = 257 - Height = 450 - Margins.Left = 8 - Margins.Top = 8 - Margins.Right = 0 - Margins.Bottom = 0 - Align = alLeft - Header.AutoSizeIndex = 0 - Header.Font.Charset = DEFAULT_CHARSET - Header.Font.Color = clWindowText - Header.Font.Height = -11 - Header.Font.Name = 'Tahoma' - Header.Font.Style = [] - Header.Options = [hoAutoResize, hoColumnResize, hoDrag, hoShowSortGlyphs, hoVisible] - IncrementalSearch = isAll - TabOrder = 1 - TreeOptions.AutoOptions = [toAutoDropExpand, toAutoScrollOnExpand, toAutoSort, toAutoTristateTracking, toAutoDeleteMovedNodes] - TreeOptions.MiscOptions = [toAcceptOLEDrop, toFullRepaintOnResize, toInitOnSave, toWheelPanning, toEditOnClick] - TreeOptions.PaintOptions = [toShowButtons, toShowDropmark, toShowTreeLines, toThemeAware, toUseBlendedImages] - TreeOptions.SelectionOptions = [toFullRowSelect] - OnFocusChanged = vstFunctionsFocusChanged - OnGetText = vstFunctionsGetText - OnPaintText = vstFunctionsPaintText - OnIncrementalSearch = vstFunctionsIncrementalSearch - ExplicitHeight = 373 - Columns = < - item - Position = 0 - Width = 253 - WideText = 'Available functions' - end> - end object pnlFunction: TPanel AlignWithMargins = True Left = 273 @@ -124,8 +87,7 @@ object ButtonFunctionForm: TButtonFunctionForm Margins.Bottom = 0 Align = alClient BevelOuter = bvNone - TabOrder = 2 - ExplicitHeight = 373 + TabOrder = 1 object pnlName: TPanel Left = 0 Top = 0 @@ -197,7 +159,6 @@ object ButtonFunctionForm: TButtonFunctionForm Align = alClient BorderStyle = bsNone TabOrder = 1 - ExplicitHeight = 276 end end object pnlHeader: TPanel @@ -266,4 +227,80 @@ object ButtonFunctionForm: TButtonFunctionForm ParentFont = False end end + object pnlFunctions: TPanel + AlignWithMargins = True + Left = 8 + Top = 60 + Width = 257 + Height = 450 + Margins.Left = 8 + Margins.Top = 8 + Margins.Right = 0 + Margins.Bottom = 0 + Align = alLeft + BevelOuter = bvNone + TabOrder = 3 + ExplicitLeft = 265 + ExplicitTop = 52 + ExplicitHeight = 458 + object vstFunctions: TVirtualStringTree + Left = 0 + Top = 29 + Width = 257 + Height = 421 + Align = alClient + Header.AutoSizeIndex = 0 + Header.Font.Charset = DEFAULT_CHARSET + Header.Font.Color = clWindowText + Header.Font.Height = -11 + Header.Font.Name = 'Tahoma' + Header.Font.Style = [] + Header.Options = [hoAutoResize, hoColumnResize, hoDrag, hoShowSortGlyphs, hoVisible] + IncrementalSearch = isAll + TabOrder = 1 + TreeOptions.AutoOptions = [toAutoDropExpand, toAutoScrollOnExpand, toAutoSort, toAutoTristateTracking, toAutoDeleteMovedNodes] + TreeOptions.MiscOptions = [toAcceptOLEDrop, toFullRepaintOnResize, toInitOnSave, toWheelPanning, toEditOnClick] + TreeOptions.PaintOptions = [toShowButtons, toShowDropmark, toShowTreeLines, toThemeAware, toUseBlendedImages] + TreeOptions.SelectionOptions = [toFullRowSelect] + OnFocusChanged = vstFunctionsFocusChanged + OnGetText = vstFunctionsGetText + OnPaintText = vstFunctionsPaintText + OnIncrementalSearch = vstFunctionsIncrementalSearch + ExplicitTop = 8 + ExplicitHeight = 450 + Columns = < + item + Position = 0 + Width = 253 + WideText = 'Available functions' + end> + end + object edtSearch: TEdit + Tag = 1 + AlignWithMargins = True + Left = 0 + Top = 0 + Width = 257 + Height = 21 + Margins.Left = 0 + Margins.Top = 0 + Margins.Right = 0 + Margins.Bottom = 8 + Align = alTop + Font.Charset = DEFAULT_CHARSET + Font.Color = clGrayText + Font.Height = -11 + Font.Name = 'Tahoma' + Font.Style = [] + ParentFont = False + TabOrder = 0 + Text = 'Search...' + OnChange = edtSearchChange + OnEnter = edtSearchEnter + OnExit = edtSearchExit + ExplicitLeft = 72 + ExplicitTop = 216 + ExplicitWidth = 121 + end + end end diff --git a/G940LEDControl/Forms/ButtonFunctionFrm.pas b/G940LEDControl/Forms/ButtonFunctionFrm.pas index a1e81bf..495691a 100644 --- a/G940LEDControl/Forms/ButtonFunctionFrm.pas +++ b/G940LEDControl/Forms/ButtonFunctionFrm.pas @@ -43,6 +43,8 @@ type lblCurrentFunction: TLabel; lblCurrentCategory: TLabel; bvlFooter: TBevel; + pnlFunctions: TPanel; + edtSearch: TEdit; procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); @@ -51,6 +53,9 @@ type procedure vstFunctionsFocusChanged(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex); procedure vstFunctionsIncrementalSearch(Sender: TBaseVirtualTree; Node: PVirtualNode; const SearchText: string; var Result: Integer); procedure btnOKClick(Sender: TObject); + procedure edtSearchChange(Sender: TObject); + procedure edtSearchEnter(Sender: TObject); + procedure edtSearchExit(Sender: TObject); private FProfile: TProfile; FButtonIndex: Integer; @@ -64,6 +69,7 @@ type procedure Initialize(AProfile: TProfile; AButtonIndex: Integer); procedure LoadFunctions; + procedure ApplyFilter(const AFilter: string); procedure SetFunction(AProvider: ILEDFunctionProvider; AFunction: ILEDFunction); procedure LoadStates(AProvider: ILEDFunctionProvider; AFunction: ILEDMultiStateFunction); @@ -99,6 +105,7 @@ type implementation uses System.Math, + System.StrUtils, System.SysUtils, Winapi.Windows, @@ -232,6 +239,55 @@ begin end; +procedure TButtonFunctionForm.ApplyFilter(const AFilter: string); +var + hasFilter: Boolean; + categoryNode: PVirtualNode; + functionNode: PVirtualNode; + hasVisibleChildren: Boolean; + nodeData: PFunctionNodeData; + +begin + hasFilter := (Length(AFilter) > 0); + + vstFunctions.BeginUpdate; + try + categoryNode := vstFunctions.GetFirst; + while Assigned(categoryNode) do + begin + hasVisibleChildren := False; + + functionNode := vstFunctions.GetFirstChild(categoryNode); + while Assigned(functionNode) do + begin + nodeData := vstFunctions.GetNodeData(functionNode); + if nodeData^.NodeType = ntFunction then + begin + if hasFilter and (not ContainsText(nodeData^.LEDFunction.GetDisplayName, AFilter)) then + Exclude(functionNode^.States, vsVisible) + else + Include(functionNode^.States, vsVisible); + end; + + if vsVisible in functionNode^.States then + hasVisibleChildren := True; + + functionNode := vstFunctions.GetNextSibling(functionNode); + end; + + if hasVisibleChildren then + Include(categoryNode^.States, vsVisible) + else + Exclude(categoryNode^.States, vsVisible); + + categoryNode := vstFunctions.GetNextSibling(categoryNode); + end; + finally + vstFunctions.EndUpdate; + end; +end; + + procedure TButtonFunctionForm.SetFunction(AProvider: ILEDFunctionProvider; AFunction: ILEDFunction); var multiStateFunction: ILEDMultiStateFunction; @@ -476,6 +532,39 @@ begin end; +procedure TButtonFunctionForm.edtSearchChange(Sender: TObject); +begin + if edtSearch.Tag = 1 then + ApplyFilter('') + else + ApplyFilter(Trim(edtSearch.Text)); +end; + + +procedure TButtonFunctionForm.edtSearchEnter(Sender: TObject); +begin + if edtSearch.Tag = 1 then + begin + edtSearch.Text := ''; + edtSearch.Font.Color := clWindowText; + edtSearch.Tag := 0; + end; +end; + + +procedure TButtonFunctionForm.edtSearchExit(Sender: TObject); +begin + if Length(Trim(edtSearch.Text)) = 0 then + begin + edtSearch.Tag := 1; + edtSearch.Text := 'Search...'; + edtSearch.Font.Color := clGrayText; + end else + edtSearch.Tag := 0; +end; + + + { TStateControlInfo } constructor TStateControlInfo.Create(AState: ILEDState; AStateLabel: TLabel; AComboBox: TComboBox); begin diff --git a/G940LEDControl/Forms/MainFrm.dfm b/G940LEDControl/Forms/MainFrm.dfm index 5f2a07a..24163a6 100644 --- a/G940LEDControl/Forms/MainFrm.dfm +++ b/G940LEDControl/Forms/MainFrm.dfm @@ -1,7 +1,7 @@ object MainForm: TMainForm Left = 0 Top = 0 - ActiveControl = cbTrayIcon + ActiveControl = cmbProfiles BorderIcons = [biSystemMenu, biMinimize] BorderStyle = bsSingle Caption = 'G940 LED Control' @@ -30,15 +30,11 @@ object MainForm: TMainForm Margins.Top = 8 Margins.Right = 8 Margins.Bottom = 8 - ActivePage = tsConfiguration + ActivePage = tsButtons Align = alClient TabOrder = 0 object tsButtons: TTabSheet Caption = ' Button assignment ' - ExplicitLeft = 0 - ExplicitTop = 0 - ExplicitWidth = 0 - ExplicitHeight = 0 DesignSize = ( 442 452) @@ -533,10 +529,6 @@ object MainForm: TMainForm object tsAbout: TTabSheet Caption = 'About' ImageIndex = 1 - ExplicitLeft = 0 - ExplicitTop = 0 - ExplicitWidth = 0 - ExplicitHeight = 0 object lblVersionCaption: TLabel Left = 16 Top = 67 diff --git a/G940LEDControl/Forms/MainFrm.pas b/G940LEDControl/Forms/MainFrm.pas index c7e0808..a8c18d8 100644 --- a/G940LEDControl/Forms/MainFrm.pas +++ b/G940LEDControl/Forms/MainFrm.pas @@ -13,6 +13,7 @@ uses Vcl.StdCtrls, Winapi.Messages, Winapi.Windows, + Vcl.AppEvnts, OtlComm, OtlEventMonitor, @@ -27,7 +28,7 @@ uses LEDStateConsumer, Profile, ProfileManager, - Settings, Vcl.AppEvnts; + Settings; const diff --git a/G940LEDControl/G940LEDControl.dproj b/G940LEDControl/G940LEDControl.dproj index eab5b18..0e27dc6 100644 --- a/G940LEDControl/G940LEDControl.dproj +++ b/G940LEDControl/G940LEDControl.dproj @@ -8,7 +8,7 @@ VCL 13.4 True - Release + Debug Win32 1 Application @@ -49,8 +49,7 @@ true - 1 - 1 + 2 1 rtl;dbrtl;$(DCC_UsePackage) Lib @@ -60,7 +59,7 @@ None G940LEDControl_Icon.ico Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;System.Win;$(DCC_Namespace) - CompanyName=X²Software;FileDescription=G940 LED Control;FileVersion=1.1.1.1;InternalName=;LegalCopyright=© 2011 - 2015 X²Software;LegalTrademarks=;OriginalFilename=G940LEDControl.exe;ProductName=G940 LED Control;ProductVersion=1.1;Comments= + CompanyName=X²Software;FileDescription=G940 LED Control;FileVersion=1.1.2.0;InternalName=;LegalCopyright=© 2011 - 2015 X²Software;LegalTrademarks=;OriginalFilename=G940LEDControl.exe;ProductName=G940 LED Control;ProductVersion=1.1;Comments= 1033 @@ -98,7 +97,7 @@ /restart false - CompanyName=;FileDescription=;FileVersion=0.2.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=0.2;Comments= + CompanyName=;FileDescription=;FileVersion=1.1.1.1;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=0.2;Comments= $(BDS)\bin\default_app.manifest @@ -196,7 +195,8 @@ - JVCL BDE Components + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/G940LEDControl/G940LEDControl.res b/G940LEDControl/G940LEDControl.res index 25a0be1f3f01a2ceed33c5ddc8c68b8b06b2b37c..3a9a558918a4340fc3dab675fcec8d16adbfd9c6 100644 GIT binary patch delta 27 jcmex!kMYkv#t9|N3=B*g%Xt}DjTrP83^sQ%e$E8|kbem% delta 27 jcmex!kMYkv#t9|Nj0}t$%Xt}D4H@(p3^#W&e$E8|kbMa# diff --git a/G940LEDControl/Units/FSXLEDFunction.pas b/G940LEDControl/Units/FSXLEDFunction.pas index ac7de2e..52250f5 100644 --- a/G940LEDControl/Units/FSXLEDFunction.pas +++ b/G940LEDControl/Units/FSXLEDFunction.pas @@ -54,6 +54,13 @@ type function GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass; override; end; + TFSXAutoBrakeFunction = class(TCustomFSXFunction) + protected + function GetCategoryName: string; override; + procedure RegisterStates; override; + function GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass; override; + end; + TFSXPressDumpSwitchFunction = class(TCustomFSXInvertedOnOffFunction) protected function GetCategoryName: string; override; @@ -120,6 +127,13 @@ type function GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass; override; end; + TFSXSpoilersArmedFunction = class(TCustomFSXFunction) + protected + function GetCategoryName: string; override; + procedure RegisterStates; override; + function GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass; override; + end; + { Lights } TCustomFSXLightFunction = class(TCustomFSXOnOffFunction) @@ -346,6 +360,27 @@ begin end; +{ TFSXAutoBrakeFunction } +function TFSXAutoBrakeFunction.GetCategoryName: string; +begin + Result := FSXCategorySystems; +end; + +procedure TFSXAutoBrakeFunction.RegisterStates; +begin + RegisterState(TLEDState.Create(FSXStateUIDAutoBrake0, FSXStateDisplayNameAutoBrake0, lcGreen)); + RegisterState(TLEDState.Create(FSXStateUIDAutoBrake1, FSXStateDisplayNameAutoBrake1, lcAmber)); + RegisterState(TLEDState.Create(FSXStateUIDAutoBrake2, FSXStateDisplayNameAutoBrake2, lcAmber)); + RegisterState(TLEDState.Create(FSXStateUIDAutoBrake3, FSXStateDisplayNameAutoBrake3, lcAmber)); + RegisterState(TLEDState.Create(FSXStateUIDAutoBrake4, FSXStateDisplayNameAutoBrake4, lcRed)); +end; + +function TFSXAutoBrakeFunction.GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass; +begin + Result := TFSXAutoBrakeFunctionWorker; +end; + + { TFSXPressDumpSwitchFunction } function TFSXPressDumpSwitchFunction.GetCategoryName: string; begin @@ -530,6 +565,27 @@ begin end; +{ TFSXSpoilersArmedFunction } +function TFSXSpoilersArmedFunction.GetCategoryName: string; +begin + Result := FSXCategoryControlSurfaces; +end; + + +procedure TFSXSpoilersArmedFunction.RegisterStates; +begin + RegisterState(TLEDState.Create(FSXStateUIDSpoilersNotAvailable, FSXStateDisplayNameSpoilersNotAvailable, lcOff)); + RegisterState(TLEDState.Create(FSXStateUIDOn, FSXStateDisplayNameOn, lcRed)); + RegisterState(TLEDState.Create(FSXStateUIDOff, FSXStateDisplayNameOff, lcGreen)); +end; + + +function TFSXSpoilersArmedFunction.GetWorkerClass: TCustomLEDMultiStateFunctionWorkerClass; +begin + Result := TFSXSpoilersArmedFunctionWorker; +end; + + { TFSXLightFunction } function TCustomFSXLightFunction.GetCategoryName: string; begin diff --git a/G940LEDControl/Units/FSXLEDFunctionProvider.pas b/G940LEDControl/Units/FSXLEDFunctionProvider.pas index 4a604e1..826d812 100644 --- a/G940LEDControl/Units/FSXLEDFunctionProvider.pas +++ b/G940LEDControl/Units/FSXLEDFunctionProvider.pas @@ -137,6 +137,7 @@ begin RegisterFunction(TFSXExitDoorFunction.Create( Self, FSXFunctionDisplayNameExitDoor, FSXFunctionUIDExitDoor)); RegisterFunction(TFSXGearFunction.Create( Self, FSXFunctionDisplayNameGear, FSXFunctionUIDGear)); RegisterFunction(TFSXParkingBrakeFunction.Create( Self, FSXFunctionDisplayNameParkingBrake, FSXFunctionUIDParkingBrake)); + RegisterFunction(TFSXAutoBrakeFunction.Create( Self, FSXFunctionDisplayNameAutoBrake, FSXFunctionUIDAutoBrake)); RegisterFunction(TFSXPressDumpSwitchFunction.Create( Self, FSXFunctionDisplayNamePressDumpSwitch, FSXFunctionUIDPressDumpSwitch)); RegisterFunction(TFSXTailHookFunction.Create( Self, FSXFunctionDisplayNameTailHook, FSXFunctionUIDTailHook)); @@ -152,6 +153,7 @@ begin { Control surfaces } RegisterFunction(TFSXFlapsFunction.Create( Self, FSXFunctionDisplayNameFlaps, FSXFunctionUIDFlaps)); RegisterFunction(TFSXSpoilersFunction.Create( Self, FSXFunctionDisplayNameSpoilers, FSXFunctionUIDSpoilers)); + RegisterFunction(TFSXSpoilersArmedFunction.Create( Self, FSXFunctionDisplayNameSpoilersArmed, FSXFunctionUIDSpoilersArmed)); { Lights } RegisterFunction(TFSXBeaconLightsFunction.Create( Self, FSXFunctionDisplayNameBeaconLights, FSXFunctionUIDBeaconLights)); diff --git a/G940LEDControl/Units/FSXLEDFunctionWorker.pas b/G940LEDControl/Units/FSXLEDFunctionWorker.pas index d1dd624..6c27288 100644 --- a/G940LEDControl/Units/FSXLEDFunctionWorker.pas +++ b/G940LEDControl/Units/FSXLEDFunctionWorker.pas @@ -45,6 +45,12 @@ type procedure RegisterVariables(ADefinition: IFSXSimConnectDefinition); override; end; + TFSXAutoBrakeFunctionWorker = class(TCustomFSXOnOffFunctionWorker) + protected + procedure RegisterVariables(ADefinition: IFSXSimConnectDefinition); override; + procedure HandleData(AData: Pointer); override; + end; + TFSXPressDumpSwitchFunctionWorker = class(TCustomFSXOnOffFunctionWorker) protected procedure RegisterVariables(ADefinition: IFSXSimConnectDefinition); override; @@ -103,6 +109,12 @@ type procedure HandleData(AData: Pointer); override; end; + TFSXSpoilersArmedFunctionWorker = class(TCustomFSXFunctionWorker) + protected + procedure RegisterVariables(ADefinition: IFSXSimConnectDefinition); override; + procedure HandleData(AData: Pointer); override; + end; + { Lights } TFSXLightStatesFunctionWorker = class(TCustomFSXFunctionWorker) @@ -313,6 +325,36 @@ begin end; +{ TFSXAutoBrakeFunctionWorker } +procedure TFSXAutoBrakeFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition); +begin + ADefinition.AddVariable('AUTO BRAKE SWITCH CB', FSX_UNIT_NUMBER, SIMCONNECT_DATAType_INT32); +end; + +procedure TFSXAutoBrakeFunctionWorker.HandleData(AData: Pointer); +type + PAutoBrakeData = ^TAutoBrakeData; + TAutoBrakeData = packed record + Position: Cardinal; + end; + +var + autoBrakeData: PAutoBrakeData; + +begin + autoBrakeData := AData; + + case autoBrakeData^.Position of + 0: SetCurrentState(FSXStateUIDAutoBrake0); + 1: SetCurrentState(FSXStateUIDAutoBrake1); + 2: SetCurrentState(FSXStateUIDAutoBrake2); + 3: SetCurrentState(FSXStateUIDAutoBrake3); + else + SetCurrentState(FSXStateUIDAutoBrake4); + end; +end; + + { TFSXPressDumpSwitchFunctionWorker } procedure TFSXPressDumpSwitchFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition); begin @@ -631,7 +673,7 @@ var begin spoilersData := AData; - if SpoilersData^.SpoilersAvailable <> 0 then + if spoilersData^.SpoilersAvailable <> 0 then begin case Trunc(SpoilersData^.SpoilersHandlePercent) of 0..5: SetCurrentState(FSXStateUIDSpoilersRetracted); @@ -643,6 +685,40 @@ begin end; +{ TFSXSpoilersArmedFunctionWorker } +procedure TFSXSpoilersArmedFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition); +begin + ADefinition.AddVariable('SPOILER AVAILABLE', FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32); + ADefinition.AddVariable('SPOILERS ARMED', FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32); +end; + + +procedure TFSXSpoilersArmedFunctionWorker.HandleData(AData: Pointer); +type + PSpoilersArmedData = ^TSpoilersArmedData; + TSpoilersArmedData = packed record + SpoilersAvailable: Cardinal; + SpoilersArmed: Cardinal; + end; + +var + spoilersArmedData: PSpoilersArmedData; + +begin + spoilersArmedData := AData; + + if spoilersArmedData^.SpoilersAvailable <> 0 then + begin + if spoilersArmedData^.SpoilersArmed <> 0 then + SetCurrentState(FSXStateUIDOn) + else + SetCurrentState(FSXStateUIDOff); + end else + SetCurrentState(FSXStateUIDSpoilersNotAvailable); +end; + + + { TFSXLightStatesFunctionWorker } procedure TFSXLightStatesFunctionWorker.RegisterVariables(ADefinition: IFSXSimConnectDefinition); begin diff --git a/G940LEDControl/Units/FSXResources.pas b/G940LEDControl/Units/FSXResources.pas index a8d68d0..4aa6b1c 100644 --- a/G940LEDControl/Units/FSXResources.pas +++ b/G940LEDControl/Units/FSXResources.pas @@ -278,6 +278,26 @@ const FSXStateDisplayNamePitotOnIceFull = 'Heat on - Fully iced'; + FSXFunctionUIDAutoBrake = 'autoBrake'; + FSXFunctionDisplayNameAutoBrake = 'Auto brake'; + + FSXStateUIDAutoBrake0 = '0'; + FSXStateUIDAutoBrake1 = '1'; + FSXStateUIDAutoBrake2 = '2'; + FSXStateUIDAutoBrake3 = '3'; + FSXStateUIDAutoBrake4 = '4'; + + FSXStateDisplayNameAutoBrake0 = 'Off / not available'; + FSXStateDisplayNameAutoBrake1 = '1'; + FSXStateDisplayNameAutoBrake2 = '2'; + FSXStateDisplayNameAutoBrake3 = '3'; + FSXStateDisplayNameAutoBrake4 = '4'; + + + FSXFunctionUIDSpoilersArmed = 'spoilersArmed'; + FSXFunctionDisplayNameSpoilersArmed = 'Auto-spoilers armed'; + + FSXMenuProfiles = 'G940 Profile'; FSXMenuProfileFormat = 'G940: %s'; FSXMenuProfileFormatCascaded = '%s'; diff --git a/Test/G940Test.dproj b/Test/G940Test.dproj index 9ba027b..cd7cedc 100644 --- a/Test/G940Test.dproj +++ b/Test/G940Test.dproj @@ -1,62 +1,148 @@ - - - {e15b9b2c-c6df-43f5-b397-01c1885281f4} - Debug - AnyCPU - DCC32 - G940Test.exe - G940Test.dpr - - - 7.0 - False - False - 0 - RELEASE - - - 7.0 - DEBUG - Lib - Lib - Lib - ..\DirectX;..\Shared - ..\DirectX;..\Shared - ..\DirectX;..\Shared - ..\DirectX;..\Shared - - - Delphi.Personality - - -FalseTrueFalseFalseFalse1000FalseFalseFalseFalseFalse104312521.0.0.01.0.0.0G940Test.dpr - - - - - - - - - - - - - - - - WPViewPDF - PDFViewClass - madExceptVcl 2.0c - www.madshi.net - ExpressPivotGrid 2 OLAP by Developer Express Inc. - - - - - - MainSource - - -
MainForm
-
-
-
\ No newline at end of file + + + {e15b9b2c-c6df-43f5-b397-01c1885281f4} + Debug + DCC32 + G940Test.exe + G940Test.dpr + VCL + 13.4 + True + Debug + Win32 + 1 + Application + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;System.Win;$(DCC_Namespace) + CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= + 1043 + + + G940Test_Icon1.ico + $(BDS)\bin\default_app.manifest + + + true + G940Test_Icon1.ico + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + 1033 + $(BDS)\bin\default_app.manifest + CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= + + + 7.0 + False + False + 0 + RELEASE;$(DCC_Define) + + + 7.0 + DEBUG;$(DCC_Define) + Lib + Lib + Lib + ..\DirectX;..\Shared;$(DCC_UnitSearchPath) + ..\DirectX;..\Shared;$(DCC_ResourcePath) + ..\DirectX;..\Shared;$(DCC_ObjPath) + ..\DirectX;..\Shared;$(DCC_IncludePath) + + + Delphi.Personality.12 + + + + + False + True + False + + + False + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1043 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + G940Test.dpr + + + WPViewPDF - PDFViewClass + madExceptVcl 2.0c - www.madshi.net + ExpressPivotGrid 2 OLAP by Developer Express Inc. + + + + False + True + + + 12 + + + + + MainSource + + +
MainForm
+
+ + Cfg_2 + Base + + + Base + + + Cfg_1 + Base + +
+ +