Skip to content

Commit

Permalink
OH-58D: Add Standby Altimeter (#884)
Browse files Browse the repository at this point in the history
Fixes #753
  • Loading branch information
charliefoxtwo authored Jul 24, 2024
1 parent c09ffa4 commit 371e301
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
7 changes: 7 additions & 0 deletions Scripts/DCS-BIOS/doc/Addresses.h
Original file line number Diff line number Diff line change
Expand Up @@ -28943,6 +28943,13 @@
#define OH_58D_AIR_VENT_CPLT_A 0x8B3E
#define OH_58D_AIR_VENT_PLT 0x8B3C, 0xFFFF, 0
#define OH_58D_AIR_VENT_PLT_A 0x8B3C
#define OH_58D_ALTIMETER_KNOB 0x8C5E, 0xFFFF, 0
#define OH_58D_ALTIMETER_KNOB_A 0x8C5E
#define OH_58D_ALTIMETER_NEEDLE 0x8C60, 0xFFFF, 0
#define OH_58D_ALTIMETER_NEEDLE_A 0x8C60
#define OH_58D_ALTIMETER_PRESSURE_A 0x8C62
#define OH_58D_ALTIMETER_TEN_THOUSANDS_FLAG 0x8C4A, 0x00C0, 6
#define OH_58D_ALTIMETER_VALUE_A 0x8C66
#define OH_58D_ARMAMENT_ARMED 0x8A46, 0x0100, 8
#define OH_58D_ARMAMENT_ARMED_AM 0x8A46, 0x0100
#define OH_58D_ARMAMENT_GUN 0x8A46, 0x0060, 5
Expand Down
38 changes: 37 additions & 1 deletion Scripts/DCS-BIOS/lib/modules/aircraft_modules/OH-58D.lua
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,40 @@ OH_58D:definePotentiometer("RWR_BRIGHTNESS", devices.SYNC, 3001, 36, { 0, 0.8 },
OH_58D:defineToggleSwitch("RWR_DAY_NIGHT", devices.SYNC, 3002, 37, RWR, "Day/Night Switch")

-- Standby Altimeter
-- local STANDBY_ALTIMETER = "Standby Altimeter"
local STANDBY_ALTIMETER = "Standby Altimeter"

OH_58D:defineRotary("ALTIMETER_KNOB", devices.SENSORS, 3001, 62, STANDBY_ALTIMETER, "Barometric Knob")

OH_58D:defineFloat("ALTIMETER_NEEDLE", 61, { 0, 1 }, STANDBY_ALTIMETER, "Needle") -- this goes -1 to 1 in modelviewer, but in testing the value never drops below 0
OH_58D:defineString("ALTIMETER_PRESSURE", function(dev0)
return tostring(Module.build_gauge_from_arguments(dev0, { 66, 65, 64, 63 }))
end, 4, STANDBY_ALTIMETER, "Pressure Setting (inHg)")

OH_58D:defineString("ALTIMETER_VALUE", function(dev0)
local value = Module.round(dev0:get_argument_value(68) * 10) % 10

local ten_thousands = Module.round(dev0:get_argument_value(67) * 10) % 10

if ten_thousands >= 2 then
value = value + ((ten_thousands - 1) * 10)
end

return Functions.pad_left(tostring(value) .. "000", 5)
end, 5, STANDBY_ALTIMETER, "Barometric Altitude")

OH_58D:defineIntegerFromGetter("ALTIMETER_TEN_THOUSANDS_FLAG", function(dev0)
local ten_thousands = Module.round(dev0:get_argument_value(67) * 10) % 10

if ten_thousands == 0 then
return 2
end

if ten_thousands == 1 then
return 1
end

return 0
end, 2, STANDBY_ALTIMETER, "Ten Thousands Flag (0 = no flag, 1 = yellow, 2 = red)")

-- Standby Airspeed Indicator
-- local STANDBY_AIRSPEED_INDICATOR = "Standby Airspeed Indicator"
Expand All @@ -998,6 +1031,9 @@ OH_58D:defineToggleSwitch("RWR_DAY_NIGHT", devices.SYNC, 3002, 37, RWR, "Day/Nig
-- MMS Control Panel
-- local MMS_CONTROL_PANEL = "MMS Control Panel"

-- PDU
-- local PDU = "Pilot Display Unit"

-- CMWS
-- local CMWS = "CMWS"
-- indication 10
Expand Down

0 comments on commit 371e301

Please sign in to comment.