Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Flypadosv3 - Presets for Lighting and Aircraft #6925

Merged

Conversation

frankkopp
Copy link
Member

@frankkopp frankkopp commented Mar 15, 2022

Targets flypadosv3

Put these into the flypadosv3 PR when merged: #6230,

Summary of Changes

This PR implements presets for interior lighting and for aircraft state.

Interior Lighting Presets: User can load and save the state of interior lighting setting via the EFB.

Aircraft States; The user can choose 5 presets from the EFB which will be applied to the aircraft. The presets will be applied by executing the correct procedure as if done by a Co-Pilot. The presets are therefore NOT applied instantaneous.

Architecture

Front End:

EFB presets page with tabs for lighting and aircraft presets (see screenshots)
Uses LVARs to request the presets being applied by the wasm backend.

Backend:

C++ WASM backend to overcome MSFS JS limitation to execute certain tasks (calculator codes).
The backend checks the request LVARs and applies the requested preset settings accordingly. The request LVAR is reset to 0 after applying the preset.

Lighting:

  • For lighting this is instantaneous.
  • Lighting settings are stored in an 'ini' in the /work/ folder next to the ThrottleCalibration.ini, etc.
  • Default values of 50% for all lights are applied when a new preset ID is loaded

Aircraft:

  • For aircrafts presets this is done in real time by executing predefined procedure steps in real time and waiting for certain conditions if necessary (e.g. APU Start, Engine Start, etc.).
  • The procedure presets are hard coded in a simple data structure in the C++ (header file) using MSFS Calculator Code (RNP notation). This could eventually also move to a configuration file if users are requesting it.
  • The procedure steps check if a step need executing at all or if its state is already set
  • Also special steps to wait for specific state are possible (e.g. wait for APU Start, Engine Start, ADIRS align, etc.)

LVARs:

  • LVAR: A32NX_LOAD_LIGHTING_PRESET
    • value; ID for the requested preset, 0 when no request is active
  • LVAR: A32NX_SAVE_LIGHTING_PRESET
    • value; saves current lighting settings to the preset slot provided presets slot ID , 0 when no request is active or saving is done
  • LVAR: A32NX_LOAD_AIRCRAFT_PRESET
    • value; ID for the requested preset, 0 when no request is active or when loading shall be stopped
  • LVAR: A32NX_LOAD_AIRCRAFT_PRESET_PROGRESS
    • value: percentage of steps done while loading a preset.

Screenshots

Layout might still change.

Lighting Presets Page:
image

Aircraft Presets Page:
image
image

Video:
https://user-images.githubusercontent.com/16833201/158637942-5592cd6e-20fe-49a5-be83-7599b3213cfa.mp4

Discord username (if different from GitHub): Cdr_Maverick#6475

Testing instructions

General

  • Loading of the aircraft - this PR adds another wasm file. I would be interested in feedback how much difference this makes for you startup time after loading the PR for the first time.
  • Feedback on the layout of the preset pages in general
    • is it easy to understand?
    • what could be improved?

Lighting

  • Presets cannot be loaded or saved when aircraft is without power
  • After turning on Ext Pwr, APU or Engines presets should be loadable/saveable
  • Test changing of preset names (e.g. test none ASCII characters, etc.)
  • Test saving & laoding of presets - check that all settings are save and correctly loaded again
  • Check if presets are correctly saved to ini file:
    • MS STORE: C:\Users\USERNAME\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalState\packages\flybywire-aircraft-a320-neo\work\InteriorLightingPresets.ini
  • Change values in the ini and check that they are loaded correctly
  • Try to break the ini file

Aircraft Presets

  • Test loading of presets from C&D
  • Test loading a preset twice - no action should be executed
  • Test jumping between presets - everything should be setup correctly
  • Test changing some settings manually then load a preset - everything should be setup correctly
  • Test canceling loading - loading should immediately stop. Procedure will be incomplete.
    • Load the same preset or another to make sure the procedure is complete - check if setup is correct
  • Test starting at gate or runway
  • Try setting a preset while in the air - should not be possible - only allowed on ground
  • Try breaking it in any way 😉

Help page

  • Check if understandable
  • Check for typos

How to download the PR for QA

Every new commit to this PR will cause a new A32NX artifact to be created, built, and uploaded.

  1. Make sure you are signed in to GitHub
  2. Click on the Checks tab on the PR
  3. On the left side, click on the bottom PR tab
  4. Click on the A32NX download link at the bottom of the page

@gandalfthewhite19890404

Please, fix typos in PR name.
Do not be hasty.

@ErickSharp ErickSharp changed the title feat: Flypadosv3 - Presets for Lightiung and Aircraft feat: Flypadosv3 - Presets for Lighting and Aircraft Mar 16, 2022
@frankkopp frankkopp force-pushed the flypadosv3-presets-aircraft branch from 914640a to ba312ba Compare March 16, 2022 07:55
@frankkopp frankkopp self-assigned this Mar 16, 2022
@czarnetz
Copy link

Two addional Ideas:

  1. Save the current state "e.g. save-btn in efb" as preset for the next flight.
  2. Use the FBW-Server to upload this "state", with the Airport/Gate/Livery Infos. And if anyone next join to gate x at Airport y as airline z, he can take over "this" aircraft state for the next flight.

Example Order to find a "state":

  • match airport+gate+airline
  • match airport+gate
  • match airport

If more states match, use one of it randomly. If nothing match, use C&D. More realism is not possible :-)

Please ensure, that u will also save the Brightness-Positions of the PFD, ND, ECAM etc.
Because i heard, that in real life they never at minimum if you enter the cockpit ;-)

@frankkopp frankkopp force-pushed the flypadosv3-presets-aircraft branch from aee696e to 30f4373 Compare March 17, 2022 18:04
@frankkopp frankkopp force-pushed the flypadosv3-presets-aircraft branch 4 times, most recently from 3f6ea66 to 1fccbac Compare March 18, 2022 10:29
@frankkopp frankkopp marked this pull request as ready for review March 18, 2022 13:00
@frankkopp frankkopp requested a review from ErickSharp March 18, 2022 13:22
src/presets/src/Aircraft/AircraftPreset.h Outdated Show resolved Hide resolved
src/presets/src/Aircraft/AircraftPreset.h Outdated Show resolved Hide resolved
Copy link
Contributor

@ErickSharp ErickSharp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple things :). Also make sure to remove some of the explanatory comments in the files that don't add too much value to the overall understanding of what you are doing.

src/instruments/src/EFB/Assets/Efb.scss Outdated Show resolved Hide resolved
src/instruments/src/EFB/Presets/Widgets/LightPresets.tsx Outdated Show resolved Hide resolved
src/instruments/src/EFB/Presets/Widgets/LightPresets.tsx Outdated Show resolved Hide resolved
src/instruments/src/EFB/Presets/Widgets/LightPresets.tsx Outdated Show resolved Hide resolved
src/instruments/src/EFB/Presets/Widgets/LightPresets.tsx Outdated Show resolved Hide resolved
src/instruments/src/EFB/Presets/Widgets/LightPresets.tsx Outdated Show resolved Hide resolved
src/instruments/src/EFB/Presets/Widgets/PresetsHelp.tsx Outdated Show resolved Hide resolved
@frankkopp
Copy link
Member Author

frankkopp commented Mar 19, 2022

Just a couple things :). Also make sure to remove some of the explanatory comments in the files that don't add too much value to the overall understanding of what you are doing.

I think I rather have too much documentation than too little 😜
We have altogether way to little code documentation.

@frankkopp frankkopp requested review from ErickSharp and svengcz March 20, 2022 06:22
@frankkopp frankkopp force-pushed the flypadosv3-presets-aircraft branch from ce835a0 to e865203 Compare March 20, 2022 06:27
@ErickSharp ErickSharp force-pushed the flypadosv3-presets-aircraft branch from 1232494 to 784a5ba Compare March 20, 2022 07:29
@tracernz
Copy link
Member

I defer to the kernel coding style on this

Comments are good, but there is also a danger of over-commenting. NEVER try to explain HOW your code works in a comment: it’s much better to write the code so that the working is obvious, and it’s a waste of time to explain badly written code.

Generally, you want your comments to tell WHAT your code does, not HOW. Also, try to avoid putting comments inside a function body: if the function is so complex that you need to separately comment parts of it, you should probably go back to chapter 6 for a while. You can make small comments to note or warn about something particularly clever (or ugly), but try to avoid excess. Instead, put the comments at the head of the function, telling people what it does, and possibly WHY it does it.

@mico975
Copy link
Contributor

mico975 commented Mar 22, 2022

Quality Assurance Tester Report

Discord : mico#3145
Object of testing: #6925
Tier of Testing : 1
Date : 22/03/2022

Testing Process:

General
Loading of the aircraft - this PR adds another wasm file. I would be interested in feedback how much difference this makes for you startup time after loading the PR for the first time. - OK, not noticeably longer than usually
Feedback on the layout of the preset pages in general
is it easy to understand? - YES
what could be improved? - Presets explanation behind the question mark could maybe benefit from more compact wording and then offering detailed explanation in the docs.

Lighting
Presets cannot be loaded or saved when aircraft is without power - OK
After turning on Ext Pwr, APU or Engines presets should be loadable/saveable - OK
Test changing of preset names (e.g. test none ASCII characters, etc.) - OK
Test saving & laoding of presets - check that all settings are save and correctly loaded again - OK
Check if presets are correctly saved to ini file - OK
Change values in the ini and check that they are loaded correctly - OK
Try to break the ini file - OK, this thing takes quite a beating without breaking

Aircraft Presets
Test loading of presets from C&D - OK
Test loading a preset twice - no action should be executed - OK
Test jumping between presets - everything should be setup correctly - OK
Test changing some settings manually then load a preset - everything should be setup correctly - OK
Test canceling loading - loading should immediately stop. Procedure will be incomplete. - OK
Load the same preset or another to make sure the procedure is complete - check if setup is correct - OK
Test starting at gate or runway - Both OK
Try setting a preset while in the air - should not be possible - only allowed on ground - OK
Try breaking it in any way - UNABLE 🤣

Negatives:
N/A

Testing Results:
Passed

Conclusions:
Very nice 🚀

@LeDerpLegend
Copy link

LeDerpLegend commented Mar 22, 2022

Quality Assurance Trainee Report

Discord : LeDerpLegend#0109
Object of testing: #6925
Tier of Testing : 1
Date : 22/03/2022

Testing Process:

General
Loading of the aircraft - this PR adds another wasm file. I would be interested in feedback how much difference this makes for you startup time after loading the PR for the first time. - Ever so slightly longer but generally the same.
Feedback on the layout of the preset pages in general
is it easy to understand? - Very Clear
what could be improved? - Presets could use a dialogue confirmation box in order to proceed, hence clicking cold and dark by accident when turnaround was wanted. This could also help prevent overwriting other light profiles by accident. Procedure of switching between aircraft states feels a little fast, but still good.

Lighting
Presets cannot be loaded or saved when aircraft is without power - Good
After turning on Ext Pwr, APU or Engines presets should be loadable/saveable - Good
Test changing of preset names (e.g. test none ASCII characters, etc.) - Good
Test saving & laoding of presets - check that all settings are save and correctly loaded again - Good
Check if presets are correctly saved to ini file - Good
Change values in the ini and check that they are loaded correctly - Good
Try to break the ini file - Good, basically had to mess up quite a bit for it to hate me.

Aircraft Presets
Test loading of presets from C&D - Good
Test loading a preset twice - no action should be executed - Good
Test jumping between presets - everything should be set up correctly - Good
Test changing some settings manually then load a preset - everything should be setup correctly - Good
Test canceling loading - loading should immediately stop. Procedure will be incomplete. - Good
Load the same preset or another to make sure the procedure is complete - check if setup is correct - Good
Test starting at gate or runway - Gate: Good / Runway: Good
Try setting a preset while in the air - should not be possible - only allowed on ground - Good
Try breaking it in any way - Even rapid SLEW couldn't be enough.

Negatives: Presets help dialogue icon could use more attention. Didn't notice it at first.

Testing Results: PASSED

Conclusions: Very nice, recommend a confirmation box before saving presets and loading aircraft configuration state.

@frankkopp frankkopp force-pushed the flypadosv3-presets-aircraft branch from 87dd485 to 2a3b368 Compare March 22, 2022 09:39
@frankkopp frankkopp requested a review from Benjozork March 23, 2022 09:46
@frankkopp frankkopp merged commit 52eb9c8 into flybywiresim:flypadosv3 Mar 23, 2022
@frankkopp frankkopp deleted the flypadosv3-presets-aircraft branch March 23, 2022 18:42
ErickSharp pushed a commit that referenced this pull request Mar 24, 2022
Co-authored-by: Benjamin Dupont <benjozorkfr@gmail.com>
aguther pushed a commit that referenced this pull request Mar 25, 2022
Co-authored-by: Benjamin Dupont <benjozorkfr@gmail.com>
@2hwk 2hwk modified the milestones: Backlog, v0.8.0 Apr 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants