Add WinCtrl CDU support for Laminar Boeing 747-400.#2904
Add WinCtrl CDU support for Laminar Boeing 747-400.#2904DocMoebiuz merged 3 commits intoMobiFlight:mainfrom
Conversation
This change also enables support for the [Sparky 747-400](https://github.com/mSparks43/747-400) mod, which is based on the Laminar Boeing 747-400 and uses the same CDU datarefs.
|
Build for this pull request: |
There was a problem hiding this comment.
Pull request overview
Adds a new Winwing CDU Python script for the Laminar Boeing 747-400 (and Sparky 747-400 mod) and wires it into the script auto-run mapping so it launches when the aircraft is detected.
Changes:
- Added
laminar_747_400.pyX-Plane dataref-to-CDU translation + websocket forwarding script (Captain/CoPilot/Observer). - Registered the script in
ScriptMappings.jsonfor aircraft description matching. - Updated
MobiFlightConnector.csprojto ship the new script as content.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/MobiFlightConnector/Scripts/Winwing/laminar_747_400.py | New Winwing CDU integration script for Laminar/Sparky 747-400 datarefs. |
| src/MobiFlightConnector/Scripts/ScriptMappings.json | Adds aircraft snippet mapping to run the new script for “boeing 747-400”. |
| src/MobiFlightConnector/MobiFlightConnector.csproj | Ensures the new script is copied to output on build. |
| display_data = [[] for _ in range(CDU_CELLS)] | ||
|
|
||
| for row in range(CDU_ROWS): | ||
| # Strings are sometimes empty, so pad with spaces to the full expected wwidth. |
There was a problem hiding this comment.
Typo in comment: "wwidth" should be "width".
| # Strings are sometimes empty, so pad with spaces to the full expected wwidth. | |
| # Strings are sometimes empty, so pad with spaces to the full expected width. |
| dataref_name = dataref_map[dataref_id] | ||
|
|
||
| new_values[dataref_name] = base64.b64decode(value).decode() | ||
|
|
There was a problem hiding this comment.
Decoding subscribed dataref values with base64.b64decode(value).decode() can leave embedded NUL characters ("\x00") in the resulting string and can raise decoding errors on unexpected byte sequences. Other Winwing X-Plane scripts sanitize text values by decoding with a defined error strategy and replacing NULs with spaces; doing the same here will avoid sending invalid characters to the CDU and prevent the task from crashing.
There was a problem hiding this comment.
I've changed the error strategy to errors='replace' (so that non-UTF-8 input doesn't raise an error) and replaced null characters with spaces.
|
@maboehme - please take a look at the review feedback |
DocMoebiuz
left a comment
There was a problem hiding this comment.
See review comments by CoPilot
* Fix typo in "wwidth" * Make bytes-to-string decoding more resilient to erroneous input
Thanks, I've made changes in response to the review comments! |
|
Build for this pull request: |
|
Build for this pull request: |
This change also enables support for the Sparky
747-400 mod, which is based on
the Laminar Boeing 747-400 and uses the same CDU datarefs.