Skip to content

Commit

Permalink
feat(GSX): GSX Integration for Chocks and Cones (flybywiresim#8405)
Browse files Browse the repository at this point in the history
* gitignore

* Project-Setup

* GSX-Integration-for-FBW-Chocks-and-Cones

* Cleaning Up formatOnSave Changes

* Fixing settings.json

* Still fixing settings.json - sorry

* Fixing gitignore :(

* Summarized Changes in Changelog

---------
  • Loading branch information
Fragtality authored Jan 13, 2024
1 parent a7ecc5c commit 22559ed
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 34 deletions.
1 change: 1 addition & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
1. [ND] Worked around a font rendering bug with the ND chrono - @tracernz (Mike)
1. [TELEX] Decrease API poll rate to random number between 45-70 seconds - @auroraisluna (alepouna)
1. [AUTOFLIGHT] Fixed managed speed not engaging when V2 is confirmed after a departure runway change - @tracernz (Mike)
1. [GSX/EFB] FBW Chocks & Cones are usable with GSX Fuel/Payload Sync and react to GSX Pushback - @Fragtality (Fragtality)

## 0.11.0

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[aircraft]
icaotype = A20N
parkingbrakestest = (L:A32NX_PARK_BRAKE_LEVER_POS,number)
parkingbrakestest = (L:A32NX_PARK_BRAKE_LEVER_POS,number) (L:A32NX_GND_EQP_IS_VISIBLE, number) ||
nosegear = 8.26
refueling = 0
battery = 1
pushbackraise = 1
pushbackdummyevent = 0
pushbackcheckengines = 0
iscargo = 0
trafficcones = 1
trafficcones = 0
preferredexit = 0
wingrootpos = 2.36 -1.89 0.85
wingtippos = 15.70 -7.41 1.84
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@
<FREQUENCY>10</FREQUENCY>
<UPDATE_CODE>
(A:SURFACE RELATIVE GROUND SPEED, feet per second) 0.1 &gt; ! (&gt;L:A32NX_IS_STATIONARY, bool)
(A:SIM ON GROUND, bool) (L:A32NX_ENGINE_N1:1, Number) 3.5 &lt; and (L:A32NX_ENGINE_N1:2, Number) 3.5 &lt; and (L:A32NX_HYD_NW_STRG_DISC_ECAM_MEMO, bool) 0 == and (A:LIGHT BEACON, bool) 0 == and (&gt;L:A32NX_GND_EQP_IS_VISIBLE, bool)
(A:SIM ON GROUND, bool) (L:A32NX_ENGINE_N1:1, Number) 3.5 &lt; and (L:A32NX_ENGINE_N1:2, Number) 3.5 &lt; and (L:A32NX_HYD_NW_STRG_DISC_ECAM_MEMO, bool) 0 == and (A:LIGHT BEACON, bool) 0 == and (L:FSDT_GSX_DEPARTURE_STATE, number) 2 &lt;= (L:FSDT_GSX_DEPARTURE_STATE, number) 6 == or and (&gt;L:A32NX_GND_EQP_IS_VISIBLE, bool)
</UPDATE_CODE>
</UseTemplate>

Expand Down
2 changes: 1 addition & 1 deletion fbw-a32nx/src/behavior/src/A32NX_Exterior.xml
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
<DefaultTemplateParameters>
<GND_ENABLE_OVRD></GND_ENABLE_OVRD>
<GND_EQUIPMENT_LOGIC>
(A:SIM ON GROUND, bool) (L:A32NX_ENGINE_N1:1, Number) 3.5 &lt; and (L:A32NX_ENGINE_N1:2, Number) 3.5 &lt; and (L:A32NX_HYD_NW_STRG_DISC_ECAM_MEMO, bool) 0 == and (A:LIGHT BEACON, bool) 0 == and
(A:SIM ON GROUND, bool) (L:A32NX_ENGINE_N1:1, Number) 3.5 &lt; and (L:A32NX_ENGINE_N1:2, Number) 3.5 &lt; and (L:A32NX_HYD_NW_STRG_DISC_ECAM_MEMO, bool) 0 == and (A:LIGHT BEACON, bool) 0 == and (L:FSDT_GSX_DEPARTURE_STATE, number) 2 &lt;= (L:FSDT_GSX_DEPARTURE_STATE, number) 6 == or and
</GND_EQUIPMENT_LOGIC>
</DefaultTemplateParameters>
<Component ID="#NODE_ID#" Node="#NODE_ID#">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ export const SimOptionsPage = () => {
const [, setRadioReceiverUsageSimVar] = useSimVar('L:A32NX_RADIO_RECEIVER_USAGE_ENABLED', 'number', 0);
const [wheelChocksEnabled, setWheelChocksEnabled] = usePersistentNumberProperty('MODEL_WHEELCHOCKS_ENABLED', 1);
const [conesEnabled, setConesEnabled] = usePersistentNumberProperty('MODEL_CONES_ENABLED', 1);
const [gsxFuelSyncEnabled] = usePersistentNumberProperty('GSX_FUEL_SYNC', 0);
const [gsxPayloadSyncEnabled] = usePersistentNumberProperty('GSX_PAYLOAD_SYNC', 0);

const defaultBaroButtons: ButtonType[] = [
{ name: t('Settings.SimOptions.Auto'), setting: 'AUTO' },
Expand All @@ -45,8 +43,6 @@ export const SimOptionsPage = () => {
{ name: t('Settings.SimOptions.Save'), setting: 'SAVE' },
];

const isGSXSyncEnabled = () => !!gsxFuelSyncEnabled || !!gsxPayloadSyncEnabled;

return (
<>
{!showThrottleSettings
Expand Down Expand Up @@ -83,7 +79,7 @@ export const SimOptionsPage = () => {
<SettingItem name={t('Settings.SimOptions.EnableSimBridge')}>
<SelectGroup>
<SelectItem
className="text-center color-red"
className="color-red text-center"
onSelect={() => setSimbridgeEnabled('AUTO ON')}
selected={simbridgeEnabled === 'AUTO ON' || simbridgeEnabled === 'AUTO OFF'}

Expand All @@ -105,7 +101,7 @@ export const SimOptionsPage = () => {
<SettingItem name="SimBridge Host Machine">
<SelectGroup>
<SelectItem
className="text-center color-red"
className="color-red text-center"
onSelect={
() => {
setSimbridgeRemoteStatus('local');
Expand All @@ -130,7 +126,7 @@ export const SimOptionsPage = () => {
&& (
<div className="pt-2 text-center">
<SimpleInput
className="text-center w-30"
className="w-30 text-center"
value={simbridgeIp}
onChange={(event) => {
// Error on empty string
Expand All @@ -150,7 +146,7 @@ export const SimOptionsPage = () => {

<SettingItem name={t('Settings.SimOptions.SimBridgePort')}>
<SimpleInput
className="text-center w-30"
className="w-30 text-center"
value={simbridgePort}
onChange={(event) => {
setSimbridgePort(event.replace(/[^0-9]+/g, ''));
Expand All @@ -172,7 +168,7 @@ export const SimOptionsPage = () => {
/>
</SettingItem>

<SettingItem name={t('Settings.SimOptions.WheelChocksEnabled')} disabled={isGSXSyncEnabled()}>
<SettingItem name={t('Settings.SimOptions.WheelChocksEnabled')}>
<Toggle
value={wheelChocksEnabled === 1}
onToggle={(value) => {
Expand All @@ -181,7 +177,7 @@ export const SimOptionsPage = () => {
/>
</SettingItem>

<SettingItem name={t('Settings.SimOptions.ConesEnabled')} disabled={isGSXSyncEnabled()}>
<SettingItem name={t('Settings.SimOptions.ConesEnabled')}>
<Toggle
value={conesEnabled === 1}
onToggle={(value) => {
Expand All @@ -193,8 +189,8 @@ export const SimOptionsPage = () => {
<SettingItem name={t('Settings.SimOptions.ThrottleDetents')}>
<button
type="button"
className="py-2.5 px-5 text-theme-body hover:text-theme-highlight bg-theme-highlight
hover:bg-theme-body rounded-md border-2 border-theme-highlight transition duration-100"
className="text-theme-body hover:text-theme-highlight bg-theme-highlight hover:bg-theme-body border-theme-highlight
rounded-md border-2 px-5 py-2.5 transition duration-100"
onClick={() => setShowThrottleSettings(true)}
>
{t('Settings.SimOptions.Calibrate')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: GPL-3.0

import React, { useEffect, useState } from 'react';
import React, { useState } from 'react';
import { NavigraphSubscriptionStatus, usePersistentNumberProperty, usePersistentProperty } from '@flybywiresim/fbw-sdk';
import { Route, Switch, useHistory } from 'react-router-dom';
import { toast } from 'react-toastify';
Expand All @@ -24,15 +24,6 @@ export const ThirdPartyOptionsPage = () => {

const [gsxFuelSyncEnabled, setGsxFuelSyncEnabled] = usePersistentNumberProperty('GSX_FUEL_SYNC', 0);
const [gsxPayloadSyncEnabled, setGsxPayloadSyncEnabled] = usePersistentNumberProperty('GSX_PAYLOAD_SYNC', 0);
const [, setWheelChocksEnabled] = usePersistentNumberProperty('MODEL_WHEELCHOCKS_ENABLED', 1);
const [, setConesEnabled] = usePersistentNumberProperty('MODEL_CONES_ENABLED', 1);

useEffect(() => {
if (gsxFuelSyncEnabled === 1 || gsxPayloadSyncEnabled === 1) {
setWheelChocksEnabled(0);
setConesEnabled(0);
}
}, [gsxFuelSyncEnabled, gsxPayloadSyncEnabled]);

const [overrideSimbriefUserID, setOverrideSimbriefUserID] = usePersistentProperty('CONFIG_OVERRIDE_SIMBRIEF_USERID');
const [overrideSimbriefDisplay, setOverrideSimbriefDisplay] = useState(overrideSimbriefUserID);
Expand Down Expand Up @@ -117,14 +108,14 @@ export const ThirdPartyOptionsPage = () => {
<>
<span className="py-2.5 pr-4">
{navigraphAuthInfo.username}
<img src={NavigraphIcon} className="inline-block mx-1.5 mb-1 w-6" />
<img src={NavigraphIcon} className="mx-1.5 mb-1 inline-block w-6" />
{t(`Settings.ThirdPartyOptions.NavigraphAccountLink.SubscriptionStatus.${NavigraphSubscriptionStatus[navigraphAuthInfo.subscriptionStatus]}`)}
</span>

<button
type="button"
className="py-2.5 px-5 text-theme-text hover:text-red-600 bg-red-600
hover:bg-theme-body rounded-md border-2 border-red-600 transition duration-100"
className="text-theme-text hover:bg-theme-body rounded-md border-2 border-red-600
bg-red-600 px-5 py-2.5 transition duration-100 hover:text-red-600"
onClick={handleNavigraphAccountUnlink}
>
{t('Settings.ThirdPartyOptions.NavigraphAccountLink.Unlink')}
Expand All @@ -133,8 +124,8 @@ export const ThirdPartyOptionsPage = () => {
) : (
<button
type="button"
className="py-2.5 px-5 text-theme-body hover:text-theme-highlight bg-theme-highlight
hover:bg-theme-body rounded-md border-2 border-theme-highlight transition duration-100"
className="text-theme-body hover:text-theme-highlight bg-theme-highlight hover:bg-theme-body border-theme-highlight
rounded-md border-2 px-5 py-2.5 transition duration-100"
onClick={() => history.push('/settings/3rd-party-options/navigraph-login')}
>
{t('Settings.ThirdPartyOptions.NavigraphAccountLink.Link')}
Expand All @@ -146,15 +137,15 @@ export const ThirdPartyOptionsPage = () => {
<SettingItem name={t('Settings.ThirdPartyOptions.OverrideSimBriefUserID')}>
<div className="flex flex-row">
<SimpleInput
className="mr-5 text-center w-30"
className="w-30 mr-5 text-center"
value={overrideSimbriefDisplay}
onBlur={(value) => handleOverrideSimbriefIDInput(value.replace(/\s/g, ''))}
onChange={(value) => setOverrideSimbriefDisplay(value)}
/>

<div
className="flex flex-shrink justify-center items-center py-2 px-2 w-min text-center text-theme-body hover:text-utility-red
bg-utility-red hover:bg-theme-body rounded-md border-2 border-utility-red transition duration-100"
className="text-theme-body hover:text-utility-red bg-utility-red hover:bg-theme-body border-utility-red flex w-min shrink items-center justify-center
rounded-md border-2 p-2 text-center transition duration-100"
onClick={handleOverrideSimBriefIDDelete}
>
<IconTrash />
Expand Down

0 comments on commit 22559ed

Please sign in to comment.