Skip to content

Commit

Permalink
CH-47F: Add ARC-186
Browse files Browse the repository at this point in the history
  • Loading branch information
charliefoxtwo committed Aug 24, 2024
1 parent b2023f8 commit 51d499c
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
17 changes: 17 additions & 0 deletions Scripts/DCS-BIOS/doc/Addresses.h
Original file line number Diff line number Diff line change
Expand Up @@ -5689,6 +5689,23 @@
#define Bf_109K_4_WNG_DRP_ON_AM 0x4200, 0x2000
#define Bf_109K_4_WNG_DRP_ON_OFF 0x4200, 0x1000, 12
#define Bf_109K_4_WNG_DRP_ON_OFF_AM 0x4200, 0x1000
#define CH_47F_ARC_186_FREQUENCY_MODE 0x9C00, 0x6000, 13
#define CH_47F_ARC_186_FREQUENCY_SELECTION 0x9C0C, 0x0003, 0
#define CH_47F_ARC_186_FREQ_HUNDREDTHS 0x9C10, 0x0003, 0
#define CH_47F_ARC_186_FREQ_HUNDREDTHS_VALUE_A 0x9C18
#define CH_47F_ARC_186_FREQ_ONES 0x9C0C, 0x0F00, 8
#define CH_47F_ARC_186_FREQ_ONES_VALUE_A 0x9C14
#define CH_47F_ARC_186_FREQ_TENS 0x9C0C, 0x00F0, 4
#define CH_47F_ARC_186_FREQ_TENS_VALUE_A 0x9C12
#define CH_47F_ARC_186_FREQ_TENTHS 0x9C0C, 0xF000, 12
#define CH_47F_ARC_186_FREQ_TENTHS_VALUE_A 0x9C16
#define CH_47F_ARC_186_LOAD 0x9C00, 0x8000, 15
#define CH_47F_ARC_186_LOAD_AM 0x9C00, 0x8000
#define CH_47F_ARC_186_PRESET 0x9C00, 0x1F00, 8
#define CH_47F_ARC_186_PRESET_A 0x9C0A
#define CH_47F_ARC_186_SQUELCH 0x9C0C, 0x000C, 2
#define CH_47F_ARC_186_VOLUME 0x9C0E, 0xFFFF, 0
#define CH_47F_ARC_186_VOLUME_A 0x9C0E
#define CH_47F_ASE_ARM 0x9C00, 0x0040, 6
#define CH_47F_ASE_ARM_AM 0x9C00, 0x0040
#define CH_47F_ASE_ARM_LAMP 0x9C08, 0xFFFF, 0
Expand Down
35 changes: 34 additions & 1 deletion Scripts/DCS-BIOS/lib/modules/aircraft_modules/CH-47F.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module("CH-47F", package.seeall)

local Functions = require("Scripts.DCS-BIOS.lib.common.Functions")
local Module = require("Scripts.DCS-BIOS.lib.modules.Module")

--- @class CH_47F: Module
Expand Down Expand Up @@ -113,7 +114,39 @@ CH_47F:definePotentiometer("ASE_RWR_VOLUME", devices.AN_ALE47, 3009, 1448, { 0,
CH_47F:defineFloat("ASE_ARM_LAMP", 1449, { 0, 1 }, ASE_PANEL, "Arm Lamp (Green)")

-- ARC-186 Control Panel
-- local ARC_186 = "ARC-186"
local ARC_186 = "ARC-186"

CH_47F:defineRadioWheel("ARC_186_PRESET", devices.ARC_186, 3001, 3001, { -0.01, 0.01 }, 1223, 0.01, { 0, 0.2 }, { " 1", " 2", " 3", " 4", " 5", " 6", " 7", " 8", " 9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20" }, ARC_186, "Preset Channel Selector")
CH_47F:defineMultipositionSwitch("ARC_186_FREQUENCY_MODE", devices.ARC_186, 3003, 1224, 3, 0.1, ARC_186, "Frequency Mode Dial")
CH_47F:defineMultipositionSwitch("ARC_186_FREQUENCY_SELECTION", devices.ARC_186, 3004, 1221, 4, 0.1, ARC_186, "Frequency Selection Dial")
CH_47F:definePotentiometer("ARC_186_VOLUME", devices.ARC_186, 3005, 1219, { 0, 1 }, ARC_186, "Volume")
CH_47F:definePushButton("ARC_186_LOAD", devices.ARC_186, 3006, 1222, ARC_186, "Load")
CH_47F:defineSpringloaded_3PosTumb("ARC_186_SQUELCH", devices.ARC_186, 3007, 3008, 1220, ARC_186, "Squelch / TONE") -- as of 2.9.7.59263, this control just doesn't work
CH_47F:defineRadioWheel("ARC_186_FREQ_TENS", devices.ARC_186, 3009, 3010, { -0.1, 0.1 }, 1225, 0.1, { 0, 1 }, nil, ARC_186, "Tens Frequency Selector")
CH_47F:defineRadioWheel("ARC_186_FREQ_ONES", devices.ARC_186, 3011, 3012, { -0.1, 0.1 }, 1226, 0.1, { 0, 1 }, nil, ARC_186, "Ones Frequency Selector")
CH_47F:defineRadioWheel("ARC_186_FREQ_TENTHS", devices.ARC_186, 3013, 3014, { -0.1, 0.1 }, 1227, 0.1, { 0, 1 }, nil, ARC_186, "Tenths Frequency Selector")
CH_47F:defineRadioWheel("ARC_186_FREQ_HUNDREDTHS", devices.ARC_186, 3015, 3016, { -0.25, 0.25 }, 1228, 0.25, { 0, 1 }, nil, ARC_186, "Hundredths Frequency Selector")

-- todo: sometimes this gets slightly out of sync with the model
CH_47F:defineString("ARC_186_FREQ_TENS_VALUE", function(dev0)
local val = dev0:get_argument_value(1229)
local output = Module.round(Module.valueConvert(val, { 0.125, 0.775 }, { 0, 13 }))
output = (output % 13) + 3
return Functions.pad_left(tostring(output), 2)
end, 2, ARC_186, "Tens Frequency")
CH_47F:defineString("ARC_186_FREQ_ONES_VALUE", function(dev0)
local val = dev0:get_argument_value(1230)
return tostring(Module.round(val * 10) % 10)
end, 1, ARC_186, "Ones Frequency")
CH_47F:defineString("ARC_186_FREQ_TENTHS_VALUE", function(dev0)
local val = dev0:get_argument_value(1231)
return string.format(".%d", Module.round(val * 10) % 10)
end, 2, ARC_186, "Tenths Frequency")
CH_47F:defineString("ARC_186_FREQ_HUNDREDTHS_VALUE", function(dev0)
local val = dev0:get_argument_value(1232)
local step = Module.round(val * 4) % 4
return string.format("%02d", step * 25)
end, 2, ARC_186, "Hundredths Frequency")

-- Steering Control Panel
-- local STEERING_PANEL = "Steering Control Panel"
Expand Down

0 comments on commit 51d499c

Please sign in to comment.