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

refactor: Cpp WASM Lightweight Framework #7711

Merged
merged 200 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
200 commits
Select commit Hold shift + click to select a range
864363f
Cpp WASM Lightweight Framework - squashed for rebase with new repo
frankkopp Jan 9, 2023
ffe9a51
Rebased to new repo structure
frankkopp Jan 28, 2023
0d22f1f
added build-script execute permissions
frankkopp Jan 29, 2023
da5dbf4
Refactored common code to fbw-common folder
frankkopp Jan 29, 2023
63d5948
Optimized imports
frankkopp Jan 29, 2023
c7d8d48
Corrected comment
frankkopp Jan 29, 2023
d99da14
Added extra-backend to A380X (modules not adapted to A380 yet)
frankkopp Jan 29, 2023
5e97940
Removed updateDataToSim from DataDefinitionVariable
frankkopp Jan 29, 2023
75e09b7
Updated documentation
frankkopp Jan 29, 2023
c7393de
Updated documentation
frankkopp Jan 29, 2023
989dc18
Fixed some A380 build issues
frankkopp Jan 29, 2023
77f519f
Some minor A380X fixes pushback, lighting presets ok, aircraft preset…
frankkopp Jan 29, 2023
acfac81
Fix pushback and aircraft presets reads from sim to respect cache
frankkopp Jan 30, 2023
c3845de
Fix cache and age handling
frankkopp Jan 30, 2023
477ad20
Examples for debugging
frankkopp Jan 30, 2023
2cee93d
Removed redundant timeStamp/tickCounter in DataManager
frankkopp Jan 30, 2023
9d22c39
Testing and minor changes
frankkopp Jan 30, 2023
26257aa
Some commenting for examples
frankkopp Jan 31, 2023
29503b1
Change order in in list of sources files
frankkopp Feb 1, 2023
d383167
Added getter for isInitialized in Module.h
frankkopp Feb 1, 2023
06b6841
Added method for checking if a variable needs updating to the Managed…
frankkopp Feb 1, 2023
7ca9dee
Removed DataDefinitionVariable.cpp by moving remaining definition to .h
frankkopp Feb 1, 2023
e33663f
Added warning and small potential bug fix in Event.cpp
frankkopp Feb 1, 2023
1ccfeb1
Removed DataDefinitionVariable.cpp by moving remaining definition to .h
frankkopp Feb 1, 2023
4dd72f2
Added a verbose var for easier debugging to AircraftPresets
frankkopp Feb 3, 2023
89f6fba
Added typedefs to AircraftProcedures.h
frankkopp Feb 3, 2023
e37c950
Add warning for unknown/unimplemented sim messages
frankkopp Feb 3, 2023
d2ec0a2
Introduced verbose LVAR for AircraftPresets
frankkopp Feb 3, 2023
fa67255
Simplification and commenting
frankkopp Feb 4, 2023
840ae6e
Use optional instead of nullptr check
frankkopp Feb 5, 2023
96ec36e
Added templated callback for static callback for key event handler
frankkopp Feb 6, 2023
ba24555
Added dummy classes for KeyEvent and InputEvent
frankkopp Feb 6, 2023
fcbf1d3
Added ClientDataAreaVariable
frankkopp Feb 9, 2023
fca6482
Used template for math almostEqual
frankkopp Feb 10, 2023
5a5012e
Renamed templated .h files to .hpp as they include full definition wi…
frankkopp Feb 11, 2023
05177aa
Added simtime and tickcounter to the processSimData method to allow f…
frankkopp Feb 11, 2023
fd66967
Using c++-20 standard
frankkopp Feb 11, 2023
ac61412
Commenting
frankkopp Feb 12, 2023
533f515
C++20 as standard and build script/cmake tweaks
frankkopp Feb 12, 2023
93271e3
Refined ClientDataAreaVariable and added documentation.
frankkopp Feb 12, 2023
f70d34f
Clean up examples
frankkopp Feb 12, 2023
0fb2c5b
Rebase fix
frankkopp Feb 12, 2023
26e4cce
Removed unnecessary includes
frankkopp Feb 12, 2023
97a08d8
More rebase fixes
frankkopp Feb 12, 2023
c6f79d2
Some tests and comments to string variable length
frankkopp Feb 13, 2023
ba153ee
Move changed check and added listener to ManagedDataObjectBase. Also …
frankkopp Feb 17, 2023
d00b43f
Change base data to automatic update
frankkopp Feb 18, 2023
603af44
ClientDataBufferedArea (WIP)
frankkopp Feb 18, 2023
0302968
Not working yet - ClientDataBufferedArea
frankkopp Feb 19, 2023
ccf6a2a
Debug improvements to ClientDataBufferedAreaVariable.hpp and ExampleM…
frankkopp Feb 19, 2023
d208f72
Added KeyEvent Handling
frankkopp Feb 21, 2023
56d302f
Added KeyEvent Handling
frankkopp Feb 21, 2023
68119c2
Moved Callback.h into DataManager folder
frankkopp Feb 23, 2023
053bbe1
Moved constructor of DataObjectBase.h to protected
frankkopp Feb 24, 2023
c88f32b
Documentation update
frankkopp Feb 24, 2023
59e69d7
Some restructuring and cleanup
frankkopp Feb 24, 2023
599bf36
Cleanup examples
frankkopp Feb 24, 2023
17bc7c8
Added getter for SimConnect handle
frankkopp Feb 24, 2023
f4d8fcf
Added example for input events
frankkopp Feb 24, 2023
a09ef9d
Added input events to Event class and added documentation
frankkopp Feb 24, 2023
173fd59
Added ClientEvent to replace Event
frankkopp Feb 26, 2023
97fc710
Completed ClientEvent class
frankkopp Feb 26, 2023
f1e2535
Removed/replaced old Event class
frankkopp Feb 26, 2023
f003938
Made all data types ctors private so only DataManager can be used to …
frankkopp Feb 26, 2023
96a5596
Changed to clang-format - touched basically all files
frankkopp Feb 26, 2023
06de475
Added method for DownUp event in one
frankkopp Mar 1, 2023
a3ce9b8
Added option to not immediately register an event when constructing it
frankkopp Mar 1, 2023
42a9f7f
Added pause detection with events which doesn't work b/o sim bug. Com…
frankkopp Mar 1, 2023
778116b
Added System Event mapping, completed ClientEvent and documentation
frankkopp Mar 2, 2023
27cd835
Fixed ClientDataBufferedAreaVariable.hpp
frankkopp Mar 4, 2023
f3b7237
Simplified ClientDataAreaVariable.hpp and ClientDataBufferedAreaVaria…
frankkopp Mar 4, 2023
7147d4d
Added writing (sending) of ClientDataBufferedAreaVariable.hpp
frankkopp Mar 4, 2023
8be2ada
Clean up, documentation, clean up examples
frankkopp Mar 5, 2023
44298ce
Moved SimconnectExceptionStrings.h
frankkopp Mar 5, 2023
1bef63a
Added quantity from Sven's code
frankkopp Mar 5, 2023
6230d6b
Renamed math_utils lib
frankkopp Mar 5, 2023
b0ed900
Optimized Lighting Presets to change slower over time so knob animati…
frankkopp Mar 6, 2023
12a5731
Updated some documentation
frankkopp Mar 8, 2023
f408ca9
Updated some GUIDELINE
frankkopp Mar 8, 2023
3b72820
Made nodiscard more consistent
frankkopp Mar 8, 2023
02e9cce
Added setInputGroupPriority to ClientEvent
frankkopp Mar 8, 2023
5c9d5c1
Added another input event example
frankkopp Mar 8, 2023
56dd61f
Added @brief tags to classes for doxygen docs
frankkopp Mar 10, 2023
388e4ac
Some clean up
frankkopp Mar 11, 2023
f604427
Some clean up
frankkopp Mar 11, 2023
10d2438
Updated A380X with latest A32NX code
frankkopp Mar 12, 2023
2bebb41
Fixed accidental deletion of files
frankkopp Mar 12, 2023
8dd4baa
Fixed a compiler warning when not in debug mode
frankkopp Mar 12, 2023
db2f7dd
Bug fix in Lighting Presets
frankkopp Mar 12, 2023
7bc0f2a
Review fixes and changes
frankkopp Mar 15, 2023
bb4c129
fix compiler warnings if logging is disabled
svengcz Mar 14, 2023
f447f97
move some base scripts to prepare for later replacement of manual bui…
svengcz Mar 14, 2023
abfb1f0
define the build script for the common framework
svengcz Mar 14, 2023
836f685
add a cmake script to automatically create the correct binaries
svengcz Mar 14, 2023
ef145b6
define the build targets for A32NX and A380X
svengcz Mar 14, 2023
0b4e1d6
define the top-level scripts for both aircrafts
svengcz Mar 14, 2023
6739da4
adapt the build scripts
svengcz Mar 14, 2023
978928e
Make the scripts executable
svengcz Mar 16, 2023
e4e29fc
add a compilation error in case of an invalid configuration
svengcz Mar 17, 2023
ef89372
build the base for both aircrafts
svengcz Mar 17, 2023
2932949
use one toplevel cmake-build-script
svengcz Mar 17, 2023
ec191d3
update the execution flag
svengcz Mar 17, 2023
5c91017
restructure the scripts to use only the top-level script
svengcz Mar 17, 2023
91777cb
C++ wasm modules are built by one script
svengcz Mar 17, 2023
9cc928e
adapt the igniter commands
svengcz Mar 17, 2023
158fc5a
Rename the build script tp prepare for it to be valid for all cpp was…
frankkopp Mar 17, 2023
bc86630
Added check if out folder exists when using build script directly
frankkopp Mar 17, 2023
ef9fc02
Changes to Cmake script to accomodate review changes
frankkopp Mar 17, 2023
120293e
Restore fbw-a380x/src/wasm/fadec_a380/src/SimVars.h
frankkopp Mar 17, 2023
cfbb24b
Restore fbw-a32nx/src/wasm/fadec_a320/src/SimVars.h
frankkopp Mar 17, 2023
d43ab41
Deactivating A80 compilation for the time being - will be reactivated…
frankkopp Mar 17, 2023
1ef5c94
Added debug clean build script
frankkopp Mar 17, 2023
58a553a
Fixed wasm build as CMake does not check for change on dependencies o…
frankkopp Mar 17, 2023
9113480
Fixed wasm debug build
frankkopp Mar 18, 2023
22ade87
Fixes from review
frankkopp Mar 18, 2023
9c8daca
Some cleanup
frankkopp Mar 18, 2023
0ac80ed
Turn off verbose CMake
frankkopp Mar 18, 2023
2363c1f
Refactor update time/tick check
frankkopp Mar 18, 2023
19018bf
Removed marco definition in favor of templated using statement
frankkopp Mar 18, 2023
a2e6c0e
Removed marco definition in favor of templated using statement
frankkopp Mar 18, 2023
5187873
Renamed fbw-common/src/wasm/extra-backend to fbw-common/src/wasm/cpp-…
frankkopp Mar 18, 2023
21d5d77
Refactor to avoid aircraft dependency in framework by adding aircraft…
frankkopp Mar 18, 2023
2f3fbd0
Moved the framework Example to the cpp-msfs-framework folder
frankkopp Mar 18, 2023
412bfd9
Moved Pushback to fbw-common
frankkopp Mar 18, 2023
3db521a
Refactored AircraftPresets to use an aircraft specific configuration
frankkopp Mar 19, 2023
1416e31
Moved AircraftPresets to fbw-common
frankkopp Mar 19, 2023
49009bb
Data type changed for consistency
frankkopp Mar 19, 2023
a6fdd7a
Refactored LightingPresets to split into common and aircraft-specific…
frankkopp Mar 19, 2023
e92ce9b
Added A380 compilation again
frankkopp Mar 19, 2023
abab7d5
Fixed log output for a380x
frankkopp Mar 19, 2023
ff45011
Temporarily using A32NX_ prefix for A380 as A380X flyPad does not use…
frankkopp Mar 19, 2023
6ee8c1e
Renaming base variables in MsfsHandler
frankkopp Mar 19, 2023
db01c5f
Testing and commenting for A380X
frankkopp Mar 19, 2023
7e6463f
Formatted CMake with 4 spaces for continuation
frankkopp Mar 19, 2023
c66e669
Additional commenting
frankkopp Mar 19, 2023
2b94747
Updated copyright
frankkopp Mar 19, 2023
6316af4
Minor cleanup
frankkopp Mar 24, 2023
bde3aeb
Removed unnecessary keep file
frankkopp Mar 25, 2023
7efcfd2
Fixed some clang-tidy warnings
frankkopp Mar 25, 2023
e429093
Rebase fixes
frankkopp Apr 1, 2023
5f7550d
Cleanup imports and small consistency refactorings
frankkopp Apr 15, 2023
8b5820d
Added docs comment
frankkopp Apr 15, 2023
75e0c38
Added move ctor/assign delete and some additional cleanup
frankkopp Apr 15, 2023
187001e
Added ScopedTimer
frankkopp Apr 17, 2023
6539e8b
Added SimpleProfiler.hpp
frankkopp Apr 18, 2023
2a2a921
Profiled and optimized LightingPresets
frankkopp Apr 19, 2023
d9f2493
Added profiling class and compile option - see SimpleProfiler class
frankkopp Apr 19, 2023
b7c18c4
Added unregistering of all named var on msfsHandler shut down
frankkopp Apr 19, 2023
c450258
Added template type check to ProfileBuffer.hpp
frankkopp Apr 19, 2023
76c8ac5
Added check if timer is started when calling stop.
frankkopp Apr 19, 2023
56405e7
Commenting
frankkopp Apr 19, 2023
ebfb5ac
Added nodiscard to SimpleProfiler.hpp
frankkopp Apr 19, 2023
cda7077
Using accumulate for summing
frankkopp Apr 20, 2023
961f32a
Commenting
frankkopp Apr 20, 2023
2ee09ee
Added event base pause detection
frankkopp Apr 21, 2023
8dc06d5
Changed base data from single lvar into datadefinition with lvar
frankkopp Apr 21, 2023
9df3e6e
Fixed example pointers
frankkopp Apr 21, 2023
e32d095
removed -Werror
frankkopp Apr 21, 2023
6e5c51a
added prefix handling to base data lvars
frankkopp Apr 21, 2023
05b33c5
Updated comment for pause detection
frankkopp Apr 23, 2023
f4fed2c
Updated comment and reformatting
frankkopp Apr 23, 2023
a923cfc
ID starting at 0 now
frankkopp Apr 23, 2023
e569d41
Added min/max to ProfileBuffer.hpp
frankkopp Apr 23, 2023
7ce11d8
Added methods to retrieve trimmedAvg, min and max values.
frankkopp Apr 23, 2023
d37180d
Added default values for allocateClientDataArea back
frankkopp Apr 23, 2023
ce0acf6
Fixed refactor changes not reflected due to comments/ifdefs
frankkopp Apr 23, 2023
0c4a6c3
Small refactor for readability
frankkopp Apr 29, 2023
6428c04
Small refactor for lib performance
frankkopp Apr 29, 2023
4dfc978
Small cosmetic refactors
frankkopp Apr 30, 2023
74ffadf
Combined autoRead/autoWrite to enum updateMode
frankkopp Apr 30, 2023
dd17226
Deactivating Examples
frankkopp Apr 30, 2023
4f3046b
Remove unnecessary assert
frankkopp Apr 30, 2023
eb43032
Simplification of InertialDampener
frankkopp Apr 30, 2023
93c344d
Replaced accumulate with reduce in ProfileBuffer.hpp
frankkopp Apr 30, 2023
258d270
Change trimmed average to 5%
frankkopp Apr 30, 2023
d92fb1d
Simplification in Pushback.cpp
frankkopp Apr 30, 2023
7ae1991
Format fix for docs
frankkopp May 1, 2023
72f8955
Cleanup some code
frankkopp May 1, 2023
e735bbe
Renamed .h to .hpp for files with included definition and no cpp
frankkopp May 1, 2023
2830002
Added make_ functions for custom-, sim- and system-events
frankkopp May 1, 2023
d464eed
Fixed registeredToSim flag handling
frankkopp May 1, 2023
7086de8
Removed executor_code precompile
frankkopp May 1, 2023
809d48f
Using new make_ functions for creating events
frankkopp May 1, 2023
d6def4d
Commenting
frankkopp May 1, 2023
f674e1f
Optimized/fixed strobe handling in presets
frankkopp May 7, 2023
e0d135c
Update to README
frankkopp May 12, 2023
2e38a19
Simplification and commenting
frankkopp Jul 2, 2023
1e30a12
Fixed comment
frankkopp Jul 2, 2023
3ab635e
Added comment/Todo
frankkopp Jul 27, 2023
ee6646c
Code simplification
frankkopp Nov 13, 2023
2d413bb
Fix C++ build and change wasm-opt similar to other c++ build code
frankkopp Nov 13, 2023
d5028d0
Updated framework READMEs
frankkopp Nov 19, 2023
7b12c1f
Code cleanup
frankkopp Nov 19, 2023
fce1c73
Fix/optimize build
frankkopp Nov 19, 2023
6d65999
Calling set on a chashable variable now sets hasChanged.
frankkopp Dec 14, 2023
26d1d3d
Fixed CHANGELOG.md
frankkopp Dec 14, 2023
255ae8d
Small code optimizations
frankkopp Dec 23, 2023
c074259
Comment fix
frankkopp Dec 29, 2023
aaf8bd6
Code review fixes
frankkopp Dec 30, 2023
9002b4f
Change A380X panel.cfg to use extra-backend.
frankkopp Jan 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
1. [EFCS] Implement calculated yaw damper gain - @lukecologne (luke)
1. [EFCS] Decrease yaw damper at low speeds on ground, down to 0 below 40kts - @lukecologne (luke)
1. [FLIGHTMODEL] Fix pitch trim on approach - @donstim (donbikes)
1. [GENERAL] Added C++ WASM framework and migrated all flypad-backend code to it - @frankkopp (Frank Kopp)
frankkopp marked this conversation as resolved.
Show resolved Hide resolved
1. [EFB] C++ WASM framework, extra-backend to replace flypad-backend, smooth dial turning for Lighting Presets - @frankkopp (Frank Kopp)

## 0.11.0

Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@
# explicit exclusions
/.env
node_modules/
obj/
target/
obj/
cmake-build*/
*.tgz
*.wasm
cmake-build*
Expand Down
12 changes: 8 additions & 4 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@
"${MSFS_SDK}/SimConnect SDK/include",
"${workspaceFolder}/fbw-common/src/wasm/fbw_common/src/**",
"${workspaceFolder}/fbw-a32nx/src/wasm/fbw_a320/src/**",
"${workspaceFolder}/fbw-a380x/src/wasm/fbw_a380/src/**"
],
"${workspaceFolder}/fbw-a380x/src/wasm/fbw_a380/src/**",
"${workspaceFolder}/fbw-common/src/wasm/cpp-msfs-framework/**",
"${workspaceFolder}/fbw-common/src/wasm/extra-backend/**",
"${workspaceFolder}/fbw-a32nx/src/wasm/extra-backend-a32nx/src/**",
"${workspaceFolder}/fbw-a380x/src/wasm/extra-backend-a380x/src/**",
"${workspaceFolder}/fbw-a32nx/src/wasm/fadec_a320/src/**",
"${workspaceFolder}/fbw-a380x/src/wasm/fadec_a380/src/**" ],
"defines": [
"_MSFS_WASM=1",
"__wasi__",
Expand All @@ -18,13 +23,12 @@
"_MBCS"
],
"windowsSdkVersion": "10.0.18362.0",
//"compilerPath": "${MSFS_SDK}/WASM/llvm/bin/clang-cl.exe",
"compilerArgs": [
"--sysroot ${MSFS_SDK}/WASM/wasi-sysroot",
"-target wasm32-unknown-wasi"
],
"cStandard": "c17",
"cppStandard": "c++17",
"cppStandard": "c++20",
frankkopp marked this conversation as resolved.
Show resolved Hide resolved
"intelliSenseMode": "msvc-x64"
}
],
Expand Down
3 changes: 2 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"name": "Attach",
"type": "cppvsdbg",
"request": "attach",
"processId": "${command:pickProcess}",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
Expand Down Expand Up @@ -45,4 +46,4 @@
}
}
]
}
}
74 changes: 53 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,59 @@
# This CMakeLists.txt file is used only for syntax highlighting and navigating
# through the code in an IDE. It is not used for building the project.

cmake_minimum_required(VERSION 3.19)
project(flybywire-a32nx)
cmake_minimum_required(VERSION 3.18)
project(flybywire-aircraft C CXX)

set(CMAKE_CXX_STANDARD 20)
set(MSFS_SDK "C:\\MSFS SDK")
set(FBW_ROOT ${CMAKE_SOURCE_DIR})
set(CMAKE_VERBOSE_MAKEFILE OFF)
set(FBW_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
set(FBW_COMMON ${FBW_ROOT}/fbw-common/src/wasm)

# cmake helper scripts
include("${FBW_COMMON}/cpp-msfs-framework/cmake/TargetDefinition.cmake")

# compiler refinement
set(COMPILER_FLAGS "-Wall -Wextra -Wno-unused-function -Wno-unused-command-line-argument -Wno-ignored-attributes -Wno-macro-redefined -target wasm32-unknown-wasi --sysroot \"${MSFS_SDK}/WASM/wasi-sysroot\" -mthread-model single -fno-exceptions -fms-extensions -fvisibility=hidden -ffunction-sections -fdata-sections -fno-stack-protector")

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMPILER_FLAGS}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto -O2 -DNDEBUG")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -DDEBUG")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILER_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto -O2 -DNDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -DDEBUG")

# include sub directories
message("MSFS_SDK: " ${MSFS_SDK})

# add the include paths
include_directories(
${PROJECT_SOURCE_DIR}/fbw-a32nx/src/wasm/fadec_a320
${PROJECT_SOURCE_DIR}/fbw-a32nx/src/wasm/fbw_a320
${PROJECT_SOURCE_DIR}/fbw-a32nx/src/wasm/flypad-backend
${PROJECT_SOURCE_DIR}/fbw-a380x/src/wasm/fadec_a380
${PROJECT_SOURCE_DIR}/fbw-a380x/src/wasm/fbw_a380
${PROJECT_SOURCE_DIR}/fbw-common/src/wasm/fadec_common
${PROJECT_SOURCE_DIR}/fbw-common/src/wasm/fbw_common
"${MSFS_SDK}/WASM/include"
"${MSFS_SDK}/WASM/wasi-sysroot/include"
"${MSFS_SDK}/WASM/wasi-sysroot/include/c++/v1"
"${MSFS_SDK}/SimConnect SDK/include"
"${FBW_COMMON}/cpp-msfs-framework/lib"
"${FBW_COMMON}/cpp-msfs-framework/MsfsHandler"
"${FBW_COMMON}/cpp-msfs-framework/MsfsHandler/DataTypes"
)

# add compiler definitions
add_definitions(
-D_MSFS_WASM=1
-D__wasi__
-D_LIBC_NO_EXCEPTIONS
-D_LIBCPP_HAS_NO_THREADS
-D_WINDLL
-D_MBCS
# ZERO_LVL=0 CRITICAL_LVL=1 ERROR_LVL=2 WARN_LVL=3 INFO_LVL=4 DEBUG_LVL=5 VERBOSE=6 TRACE_LVL=7
-DLOG_LEVEL=4
# EXAMPLES | NO_EXAMPLES
-DNO_EXAMPLES
#PROFILING | NO_PROFILING - for logging of profiling information of pre-, post-, update() calls
-DNO_PROFILING
)

add_subdirectory(./fbw-a32nx/src/wasm/fadec_a320)
add_subdirectory(./fbw-a32nx/src/wasm/fbw_a320)
add_subdirectory(./fbw-a32nx/src/wasm/flypad-backend)
add_subdirectory(./fbw-a380x/src/wasm/fadec_a380)
add_subdirectory(./fbw-a380x/src/wasm/fbw_a380)
add_subdirectory(./fbw-a380x/src/wasm/flypad-backend)
# add the common components
add_subdirectory(fbw-common/src/wasm)

# add the A32NX components
add_subdirectory(fbw-a32nx/src/wasm)

# add the A380X components
add_subdirectory(fbw-a380x/src/wasm)
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ background_color = 0,0,0
htmlgauge00 = WasmInstrument/WasmInstrument.html?wasm_module=systems.wasm&wasm_gauge=systems,0,0,1,1
htmlgauge01 = WasmInstrument/WasmInstrument.html?wasm_module=fbw.wasm&wasm_gauge=fbw,0,0,1,1
htmlgauge02 = WasmInstrument/WasmInstrument.html?wasm_module=fadec.wasm&wasm_gauge=FadecGauge,0,0,1,1
htmlgauge03 = WasmInstrument/WasmInstrument.html?wasm_module=flypad-backend.wasm&wasm_gauge=FlyPadBackend,0,0,1,1
htmlgauge03 = WasmInstrument/WasmInstrument.html?wasm_module=extra-backend-a32nx.wasm&wasm_gauge=Gauge_Extra_Backend,0,0,1,1

[VCockpit18]
size_mm = 0,0
Expand Down
8 changes: 6 additions & 2 deletions fbw-a32nx/src/systems/instruments/src/EFB/Efb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,28 +211,32 @@ const Efb = () => {

// Automatically load a lighting preset
useEffect(() => {
if (ac1BusIsPowered && autoLoadLightingPresetEnabled) {
if (ac1BusIsPowered && powerState === PowerStates.LOADED && autoLoadLightingPresetEnabled) {
// TIME OF DAY enum : 1 = Day ; 2 = Dusk/Dawn ; 3 = Night
switch (timeOfDay) {
case 1:
if (autoLoadDayLightingPresetID !== 0) {
console.log('Auto-loading lighting preset: ', autoLoadDayLightingPresetID);
frankkopp marked this conversation as resolved.
Show resolved Hide resolved
setLoadLightingPresetVar(autoLoadDayLightingPresetID);
}
break;
case 2:
if (autoLoadDawnDuskLightingPresetID !== 0) {
console.log('Auto-loading lighting preset: ', autoLoadDawnDuskLightingPresetID);
setLoadLightingPresetVar(autoLoadDawnDuskLightingPresetID);
}
break;
case 3:
if (autoLoadNightLightingPresetID !== 0) {
console.log('Auto-loading lighting preset: ', autoLoadNightLightingPresetID);
setLoadLightingPresetVar(autoLoadNightLightingPresetID);
}
break;
default:
break;
}
}
}, [ac1BusIsPowered, autoLoadLightingPresetEnabled]);
}, [ac1BusIsPowered, powerState, autoLoadLightingPresetEnabled]);

useInterval(() => {
if (!autoFillChecklists) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export const StepDescription = new Map([
[2090, 'ATC ALT RPTG On'],
[2100, 'TCAS TRAFFIC ABV'],
[2110, 'COCKPIT DOOR LCK'],
[2120, 'Strobe Auto'],
[2120, 'Strobe On'],
[2121, 'Strobe Off'],
[2122, 'Strobe Auto'],
Expand Down
13 changes: 13 additions & 0 deletions fbw-a32nx/src/wasm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# folder structure
set(OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../out/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/panel)

# add compiler definitions
add_definitions(-DA32NX)

add_subdirectory(extra-backend-a32nx)

# FIXME: remove the if-clause as soon as all components are using CMake
if (WIN32)
add_subdirectory(fadec_a320)
add_subdirectory(fbw_a320)
endif ()
2 changes: 1 addition & 1 deletion fbw-a32nx/src/wasm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ This directory contains the source Rust and C++ files for the WASM modules.
```
- fadec_a320 <c++ src for fadec>
- fbw_a320 <c++ src for fbw/ap>
- flypad-backend <c++ src for flypad backend>
- extra-backend-a32nx <c++ src for backend for flyPad and other extra non-aviation systems>
- systems <rust src for other systems>
```
42 changes: 42 additions & 0 deletions fbw-a32nx/src/wasm/extra-backend-a32nx/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# extra-backend-a32nx CMakeLists.txt

# add additional compiler definitions for the a32nx extra-backend build
add_definitions()

# add the local include directories
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/src/AircraftPresets
${CMAKE_CURRENT_SOURCE_DIR}/src/LightingPresets
${FBW_COMMON}/cpp-msfs-framework/
${FBW_COMMON}/extra-backend/
)

# define the source files
set(SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/src/Gauge_Extra_Backend.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/LightingPresets/LightingPresets_A32NX.cpp
${FBW_COMMON}/cpp-msfs-framework/Example/ExampleModule.cpp
${FBW_COMMON}/extra-backend/Pushback/Pushback.cpp
${FBW_COMMON}/extra-backend/AircraftPresets/AircraftPresets.cpp
${FBW_COMMON}/extra-backend/LightingPresets/LightingPresets.cpp
)
set(INCLUDE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/src/AircraftPresets/AircraftPresetProcedures_A32NX.h
${CMAKE_CURRENT_SOURCE_DIR}/src/LightingPresets/LightingPresets_A32NX.h
${FBW_COMMON}/cpp-msfs-framework/Example/ExampleModule.h
${FBW_COMMON}/cpp-msfs-framework/Example/longtext.h
${FBW_COMMON}/extra-backend/Pushback/InertialDampener.hpp
${FBW_COMMON}/extra-backend/Pushback/Pushback.h
${FBW_COMMON}/extra-backend/AircraftPresets/AircraftPresets.h
${FBW_COMMON}/extra-backend/AircraftPresets/PresetProcedures.h
${FBW_COMMON}/extra-backend/AircraftPresets/ProcedureStep.h
${FBW_COMMON}/extra-backend/LightingPresets/LightingPresets.h
)

# create the targets
add_library(extra-backend-a32nx OBJECT ${SOURCE_FILES} ${INCLUDE_FILES})
add_wasm_library(
NAME extra-backend-a32nx
DEPENDENCIES extra-backend-a32nx cpp-msfs-framework-a32nx
)
Loading
Loading