From 20e390ad2024869560de3ea3468ea65a2dd50568 Mon Sep 17 00:00:00 2001 From: Charlie <30303272+charliefoxtwo@users.noreply.github.com> Date: Mon, 13 May 2024 14:02:15 -0700 Subject: [PATCH] Fix #575 FA/18-C UFC Comm triangle symbol not mapping properly (#576) --- .../aircraft_modules/FA-18C_hornet.lua | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Scripts/DCS-BIOS/lib/modules/aircraft_modules/FA-18C_hornet.lua b/Scripts/DCS-BIOS/lib/modules/aircraft_modules/FA-18C_hornet.lua index f734480dd..a5814b831 100644 --- a/Scripts/DCS-BIOS/lib/modules/aircraft_modules/FA-18C_hornet.lua +++ b/Scripts/DCS-BIOS/lib/modules/aircraft_modules/FA-18C_hornet.lua @@ -144,9 +144,13 @@ local function processUfcTwoDigitDisplay(s) s = Functions.coerce_nil_to_string(s) if s == "_" then s = "--" + elseif s == "d" then -- receiving(?), show triangle symbol + s = "<>" + else + s = s:gsub("^`", "1") + s = s:gsub("^~", "2") end - s = s:gsub("^`", "1") - s = s:gsub("^~", "2") + return Functions.pad_left(s, 2) end @@ -157,10 +161,19 @@ FA_18C_hornet:addExportHook(function() ufc = Module.parse_indication(6) or {} end) +local comm_channel_cache = {} + local function get_comm_channel(channel) local display_value = channel == 1 and ufc.UFC_Comm1Display or ufc.UFC_Comm2Display - return comm_channel_map[display_value] or 0 + if display_value == "d" then -- receiving(?), comm channel hasn't changed + return comm_channel_cache[channel] or 0 + end + + local value = comm_channel_map[display_value] or 0 + comm_channel_cache[channel] = value + + return value end -- radio freqs: by Capt Zeen