Skip to content

Commit 7c4995b

Browse files
authored
[X-Plane] 777/737 - Implement new reverse video schema (#2742)
* Implement new reverse video schema * Update 77v2 script * Update WwFcu dependency * Reverse video for PMDG 737 & 777
1 parent d0355ad commit 7c4995b

File tree

5 files changed

+21
-11
lines changed

5 files changed

+21
-11
lines changed

Scripts/Winwing/flightfactor_777v2.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,7 @@ def get_char(char: str) -> str:
8484
return CHAR_MAP.get(char, char)
8585

8686

87-
def get_color(color: int, effect: int) -> str:
88-
if effect == 1:
89-
return "e"
87+
def get_color(color: int) -> str:
9088
return COLOR_MAP.get(color, "w")
9189

9290

@@ -96,6 +94,13 @@ def get_size(size: int) -> int:
9694
# 2 = small
9795
return 1 if size == 2 else 0
9896

97+
def get_style(effect: int) -> int:
98+
# FlightFactor's 777v2 style uses the following values
99+
# 0 = normal
100+
# 1 = highlighted
101+
# 2 = reverse
102+
return 1 if effect == 1 else 0
103+
99104

100105
def fetch_dataref_mapping(device: CduDevice):
101106
with urllib.request.urlopen(BASE_REST_URL, timeout=5) as response:
@@ -135,8 +140,9 @@ def generate_display_json(device: CduDevice, values: dict[str, str]):
135140

136141
display_data[index] = [
137142
get_char(char),
138-
get_color(color, effect),
143+
get_color(color),
139144
get_size(size),
145+
get_style(effect)
140146
]
141147

142148
return json.dumps({"Target": "Display", "Data": display_data})

Scripts/Winwing/pmdg_737_winwing_cdu.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,6 @@ def create_mobi_json(data: bytes) -> str:
154154
# Handle color based on flags
155155
if flags & CDU_FLAG_UNUSED:
156156
color_str: str = "e" # Gray for unused
157-
elif flags & CDU_FLAG_REVERSE:
158-
color_str = "e" # Gray for reverse video
159157
else:
160158
color_str = {
161159
CDU_COLOR_WHITE: "w",
@@ -169,7 +167,8 @@ def create_mobi_json(data: bytes) -> str:
169167
message["Data"][dst_idx] = [
170168
symbol,
171169
color_str,
172-
1 if (is_lowercase) or (flags & CDU_FLAG_SMALL_FONT) else 0
170+
1 if (is_lowercase) or (flags & CDU_FLAG_SMALL_FONT) else 0,
171+
1 if flags & CDU_FLAG_REVERSE else 0
173172
]
174173
except (ValueError, TypeError, IndexError) as e:
175174
message["Data"][dst_idx] = []

Scripts/Winwing/pmdg_777_winwing_cdu.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,6 @@ def create_mobi_json(data: bytes) -> str:
159159
# Handle color based on flags
160160
if flags & CDU_FLAG_UNUSED:
161161
color_str: str = "e" # Gray for unused
162-
elif flags & CDU_FLAG_REVERSE:
163-
color_str = "e" # Gray for reverse video
164162
else:
165163
color_str = {
166164
CDU_COLOR_WHITE: "w",
@@ -174,7 +172,8 @@ def create_mobi_json(data: bytes) -> str:
174172
message["Data"][dst_idx] = [
175173
symbol,
176174
color_str,
177-
1 if (is_lowercase) or (flags & CDU_FLAG_SMALL_FONT) else 0
175+
1 if (is_lowercase) or (flags & CDU_FLAG_SMALL_FONT) else 0,
176+
1 if flags & CDU_FLAG_REVERSE else 0
178177
]
179178
except (ValueError, TypeError, IndexError) as e:
180179
message["Data"][dst_idx] = []

Scripts/Winwing/zibo_737_800x.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
WS_CO_PILOT = f"ws://{WEBSOCKET_HOST}:{WEBSOCKET_PORT}/winwing/cdu-co-pilot"
4242

4343
CHARACTER_MAPPING = {"`": "°", "*": "☐", "=": "*"}
44-
COLOR_MAPPING = {"G": "g", "C": "c", "I": "e", "M": "m"}
44+
COLOR_MAPPING = {"G": "g", "C": "c", "M": "m"}
4545

4646

4747
FONT_REQUEST = json.dumps({"Target": "Font", "Data": "Boeing"})
@@ -89,6 +89,11 @@ def get_size(dataref: str) -> int:
8989
return 1 if dataref.endswith("_X") or dataref.endswith("_S") else 0
9090

9191

92+
def get_style(dataref: str) -> int:
93+
dataref_ending = dataref[dataref.rindex("_") + 1]
94+
95+
return 1 if dataref_ending == "I" else 0
96+
9297
def process_cdu_line(line_datarefs: dict[str, str], row: int) -> list[list]:
9398
line_chars = [[] for _ in range(CDU_COLUMNS)]
9499

@@ -114,6 +119,7 @@ def process_cdu_line(line_datarefs: dict[str, str], row: int) -> list[list]:
114119
CHARACTER_MAPPING.get(char, char),
115120
get_color(dataref),
116121
get_size(dataref),
122+
get_style(dataref),
117123
)
118124

119125
return line_chars

lib/MobiFlightWwFcu.dll

-1.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)