Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 10 additions & 4 deletions Scripts/Winwing/flightfactor_777v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ def get_char(char: str) -> str:
return CHAR_MAP.get(char, char)


def get_color(color: int, effect: int) -> str:
if effect == 1:
return "e"
def get_color(color: int) -> str:
return COLOR_MAP.get(color, "w")


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

def get_style(effect: int) -> int:
# FlightFactor's 777v2 style uses the following values
# 0 = normal
# 1 = highlighted
# 2 = reverse
return 1 if effect == 1 else 0


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

display_data[index] = [
get_char(char),
get_color(color, effect),
get_color(color),
get_size(size),
get_style(effect)
]

return json.dumps({"Target": "Display", "Data": display_data})
Expand Down
5 changes: 2 additions & 3 deletions Scripts/Winwing/pmdg_737_winwing_cdu.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ def create_mobi_json(data: bytes) -> str:
# Handle color based on flags
if flags & CDU_FLAG_UNUSED:
color_str: str = "e" # Gray for unused
elif flags & CDU_FLAG_REVERSE:
color_str = "e" # Gray for reverse video
else:
color_str = {
CDU_COLOR_WHITE: "w",
Expand All @@ -169,7 +167,8 @@ def create_mobi_json(data: bytes) -> str:
message["Data"][dst_idx] = [
symbol,
color_str,
1 if (is_lowercase) or (flags & CDU_FLAG_SMALL_FONT) else 0
1 if (is_lowercase) or (flags & CDU_FLAG_SMALL_FONT) else 0,
1 if flags & CDU_FLAG_REVERSE else 0
]
except (ValueError, TypeError, IndexError) as e:
message["Data"][dst_idx] = []
Expand Down
5 changes: 2 additions & 3 deletions Scripts/Winwing/pmdg_777_winwing_cdu.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,6 @@ def create_mobi_json(data: bytes) -> str:
# Handle color based on flags
if flags & CDU_FLAG_UNUSED:
color_str: str = "e" # Gray for unused
elif flags & CDU_FLAG_REVERSE:
color_str = "e" # Gray for reverse video
else:
color_str = {
CDU_COLOR_WHITE: "w",
Expand All @@ -174,7 +172,8 @@ def create_mobi_json(data: bytes) -> str:
message["Data"][dst_idx] = [
symbol,
color_str,
1 if (is_lowercase) or (flags & CDU_FLAG_SMALL_FONT) else 0
1 if (is_lowercase) or (flags & CDU_FLAG_SMALL_FONT) else 0,
1 if flags & CDU_FLAG_REVERSE else 0
]
except (ValueError, TypeError, IndexError) as e:
message["Data"][dst_idx] = []
Expand Down
8 changes: 7 additions & 1 deletion Scripts/Winwing/zibo_737_800x.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
WS_CO_PILOT = f"ws://{WEBSOCKET_HOST}:{WEBSOCKET_PORT}/winwing/cdu-co-pilot"

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


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


def get_style(dataref: str) -> int:
dataref_ending = dataref[dataref.rindex("_") + 1]

return 1 if dataref_ending == "I" else 0

def process_cdu_line(line_datarefs: dict[str, str], row: int) -> list[list]:
line_chars = [[] for _ in range(CDU_COLUMNS)]

Expand All @@ -114,6 +119,7 @@ def process_cdu_line(line_datarefs: dict[str, str], row: int) -> list[list]:
CHARACTER_MAPPING.get(char, char),
get_color(dataref),
get_size(dataref),
get_style(dataref),
)

return line_chars
Expand Down
Binary file modified lib/MobiFlightWwFcu.dll
Binary file not shown.
Loading