Jump to content

Implementing the NS430 in DCS-Bios


Capt Zeen

Recommended Posts

..

 

 

In case you want/need to control the Garmin NS430 across DCS-Bios, i created the lines you need to add to your DCS-bios airplane file.

 

Using those lines in the MI-8 DCS-bios file, i managed to implement the Garmin controls using DCSFlightpanels.

 

 

 

How to add the lines:

 

As always, first, make a backup copy of your files, just in case!

 

Look for the airplane file you want to add the Garmin controls in:

Saved Games\DCS.openbeta\scripts\DCS-BIOS\lib

 

Copy those lines at the end of the DCS-bios airplane file, but just before the line:

BIOS.protocol.endModule()

This one need to be the last one!

 

Save the file and run DCS, and start a mision. The Json file is created automatically.

 

Now you can acces to the new NS430 commands in your favorite tool.

 

 

the lines:

 

 



--NS430 added by Capt Zeen------------------------------------------------------------------------------
definePushButton("NS430_PWR-VOL_PUSH-SQ_POW", 257, 3001, 1, "NS430", "PWR-VOL_PUSH-SQ COM Power")
defineRotary("NS430_PWR-VOL_PUSH-SQ_VOL", 257, 3002, 0, "NS430", "PWR-VOL_PUSH-SQ COM Volume")
definePushButton("NS430_VOL_PUSH-ID_PUSH", 257, 3004, 3, "NS430", "VOL_PUSH-ID VLOC Push")
defineRotary("NS430_VOL_PUSH-ID_VOL", 257, 3005, 2, "NS430", "VOL_PUSH-ID VLOC volume")
defineRotary("NS430_BIG_LEFT_BTN", 257, 3007, 4, "NS430", "NS430_BIG_LEFT_BTN")
definePushButton("NS430_SMALL_LEFT_BTN_PUSH", 257, 3009, 5, "NS430", "SMALL_LEFT_BTN Push")
defineRotary("NS430_SMALL_LEFT_BTN_ROT", 257, 3010, 6, "NS430", "SMALL_LEFT_BTN rotate")
definePushButton("NS430_COM_FLIP_FLOP", 257, 3012, 7, "NS430", "COM flip-flop")
definePushButton("NS430_VLOC_FLIP_FLOP", 257, 3013, 8, "NS430", "VLOC flip-flop")
definePushButton("NS430_CDI", 257, 3014, 9, "NS430", "CDI")
definePushButton("NS430_OBS", 257, 3015, 10, "NS430", "OBS")
definePushButton("NS430_MSG", 257, 3016, 11, "NS430", "MSG")
definePushButton("NS430_FPL", 257, 3017, 12, "NS430", "FPL")
definePushButton("NS430_PROC", 257, 3018, 13, "NS430", "PROC")
definePushButton("NS430_RNG-UP", 257, 3019, 14, "NS430", "RNG-UP")
definePushButton("NS430_RNG-DOWN", 257, 3020, 14, "NS430", "RNG-DOWN")
definePushButton("NS430_DIRECT-TO", 257, 3021, 15, "NS430", "DIRECT-TO")
definePushButton("NS430_MENU", 257, 3022, 16, "NS430", "MENU")
definePushButton("NS430_CLR", 257, 3023, 17, "NS430", "CLR")
definePushButton("NS430_ENT", 257, 3024, 18, "NS430", "ENT")
defineRotary("NS430_BIG_RIGHT_BTN", 257, 3025, 19, "NS430", "BIG_RIGHT_BTN")
definePushButton("NS430_SMALL_RIGHT_BTN_PUSH", 257, 3027, 20, "NS430", "SMALL_RIGHT_BTN Push")
defineRotary("NS430_SMALL_RIGHT_BTN_ROT", 257, 3028, 21, "NS430", "SMALL_RIGHT_BTN rotate")
definePushButton("NS430_PWR-VOL_PUSH-SQ_POW_STOP_ACTION", 257, 3030, 1, "NS430", "PWR-VOL_PUSH-SQ COM Power stop action command")
definePushButton("NS430_VOL_PUSH-ID_PUSH_STOP_ACTION", 257, 3031, 3, "NS430", "VOL_PUSH-ID VLOC Push stop action command")
definePushButton("NS430_SMALL_LEFT_BTN_PUSH_STOP_ACTION", 257, 3032, 5, "NS430", "SMALL_LEFT_BTN Push stop action command")
definePushButton("NS430_COM_FLIP_FLOP_STOP_ACTION", 257, 3033, 7, "NS430", "COM flip-flop stop action command")
definePushButton("NS430_VLOC_FLIP_FLOP_STOP_ACTION", 257, 3034, 8, "NS430", "VLOC flip-flop stop action command")
definePushButton("NS430_CDI_STOP_ACTION", 257, 3035, 9, "NS430", "CDI stop action command")
definePushButton("NS430_OBS_STOP_ACTION", 257, 3036, 10, "NS430", "OBS stop action command")
definePushButton("NS430_MSG_STOP_ACTION", 257, 3037, 11, "NS430", "MSG stop action command")
definePushButton("NS430_FPL_STOP_ACTION", 257, 3038, 12, "NS430", "FPL stop action command")
definePushButton("NS430_PROC_STOP_ACTION", 257, 3039, 13, "NS430", "PROC stop action command")
definePushButton("NS430_RNG-UP_STOP_ACTION", 257, 3040, 14, "NS430", "RNG-UP stop action command")
definePushButton("NS430_RNG-DOWN_STOP_ACTION", 257, 3041, 14, "NS430", "RNG-DOWN stop action command")
definePushButton("NS430_DIRECT-TO_STOP_ACTION", 257, 3042, 15, "NS430", "DIRECT-TO stop action command")
definePushButton("NS430_MENU_STOP_ACTION", 257, 3043, 16, "NS430", "MENU stop action command")
definePushButton("NS430_CLR_STOP_ACTION", 257, 3044, 17, "NS430", "CLR stop action command")
definePushButton("NS430_ENT_STOP_ACTION", 257, 3045, 18, "NS430", "ENT stop action command")
definePushButton("NS430_SMALL_RIGHT_BTN_PUSH_STOP_ACTION", 257, 3046, 20, "NS430", "SMALL_RIGHT_BTN Push stop action command")
-- end of NS430 added by Capt Zeen----------------------------------------------------------------------


 

Hope you like it, and let me know how it goes !

 

 

 

..


Edited by Capt Zeen
Link to comment
Share on other sites

F-5E dcs bios

 

hi

thinks for for your help your informations , but i have some points to understand

i found a F-5E.lua it seems not contain all switches and gauge ....

 

--------------------------------------------------------------

BIOS.protocol.beginModule("F-5E", 0x3000)

BIOS.protocol.setExportModuleAircrafts({"F-5E-3"})

 

 

local inputProcessors = moduleBeingDefined.inputProcessors

local documentation = moduleBeingDefined.documentation

 

local document = BIOS.util.document

 

local parse_indication = BIOS.util.parse_indication

 

 

local defineIndicatorLight = BIOS.util.defineIndicatorLight

local definePushButton = BIOS.util.definePushButton

local definePotentiometer = BIOS.util.definePotentiometer

local defineRotary = BIOS.util.defineRotary

local defineSetCommandTumb = BIOS.util.defineSetCommandTumb

local defineTumb = BIOS.util.defineTumb

local defineToggleSwitch = BIOS.util.defineToggleSwitch

local defineToggleSwitchToggleOnly = BIOS.util.defineToggleSwitchToggleOnly

local defineFixedStepTumb = BIOS.util.defineFixedStepTumb

local defineVariableStepTumb = BIOS.util.defineVariableStepTumb

local defineString = BIOS.util.defineString

local defineRockerSwitch = BIOS.util.defineRockerSwitch

local defineMultipositionSwitch = BIOS.util.defineMultipositionSwitch

local defineElectricallyHeldSwitch = BIOS.util.defineElectricallyHeldSwitch

local defineFloat = BIOS.util.defineFloat

local define8BitFloat = BIOS.util.define8BitFloat

 

 

 

 

defineIndicatorLight("TACAN_TEST", 260, "TACAN Panel", "TACAN Test Indicator Light")

defineIndicatorLight("GW_LIGHT", 96, "CautionLights","GearWarning")

defineIndicatorLight("NOSE_LIGHT", 54, "Green Light","Gear Nose")

defineIndicatorLight("LEFT_LIGHT", 53, "Green Light","Gear Left")

defineIndicatorLight("RIGHT_LIGHT", 55, "Green Light","Gear Right")

defineIndicatorLight("MC_LIGHT", 169, "Warning, Caution and IndicatorLights","MasterCaution Lamp")

definePushButton("MC_RESET_BTN", 12, 3011, 172,"Warning, Caution and IndicatorLights" , "MasterCaution reset")

definePushButton("DRAG_CHUTE", 10, 3002, 91,"Brake System" , "Chute Handle")

defineToggleSwitch("LG_LEVER_SWITCH", 7, 3001, 83,"Gear Interface" , "Gear Lever")

defineToggleSwitch("L_GENERATOR", 3, 3002, 338,"Electric" , "Gen Left")

defineToggleSwitch("SW_BATTERY", 3, 3001, 387,"Electric" , "Battery")

defineToggleSwitch("R_GENERATOR", 3, 3004, 339,"Electric" , "Gen Right")

defineToggleSwitch("LG_LIGHT", 11, 3010, 353,"Light" , "Landing Light")

defineToggleSwitch("NS_STRUCT", 7, 3017, 250,"System" , "Landing Gear")

defineToggleSwitch("PITOT_HEATER", 3, 3006, 375,"Electric" , "Pitot Heater")

defineToggleSwitch("INLET_HEATER", 6, 3001, 376,"Engine Interface" , "Heater")

defineMultipositionSwitch("RADAR_MODE", 17, 3002, 316, 4, 0.1, "Radar", "Off/Stby/Oper/test")

defineRotary("ALT_SET_PRESSURE", 35, 3001, 62, "Altimeter", "Set Pressure")

definePotentiometer("TACAN_VOL", 74, 3005, 261, {0, 1}, "TACAN Panel", "TACAN Signal Volume")

defineFloat("FLAP_INDICATOR", 51, {0.0, 0.4}, "INSTRUMENTS", "FLAP_POSITION")

 

BIOS.protocol.endModule()

---------------------------------------------------------------------------------+

how can i get a conplete F-5e.lua file

and haw to add F-5E.json F-5E.jsonp is required on dcs bios

Link to comment
Share on other sites

  • 1 month later...

Thanks for the list Capt Zeen.

 

For anybody who wants to use the NS430 in more than one aircraft, it might be worth it to put those commands in a separate DCS BIOS module, like this:

 

NS430.lua

BIOS.protocol.beginModule("NS430", 0x5400)
BIOS.protocol.setExportModuleAircrafts({"Mi-8MT", "L-39ZA"})

local documentation = moduleBeingDefined.documentation

local document = BIOS.util.document  

local parse_indication = BIOS.util.parse_indication

local defineFloat = BIOS.util.defineFloat
local defineIndicatorLight = BIOS.util.defineIndicatorLight
local definePushButton = BIOS.util.definePushButton
local definePotentiometer = BIOS.util.definePotentiometer
local defineRotary = BIOS.util.defineRotary
local defineSetCommandTumb = BIOS.util.defineSetCommandTumb
local defineTumb = BIOS.util.defineTumb
local defineToggleSwitch = BIOS.util.defineToggleSwitch
local defineToggleSwitchToggleOnly = BIOS.util.defineToggleSwitchToggleOnly
local defineFixedStepTumb = BIOS.util.defineFixedStepTumb
local defineFixedStepInput = BIOS.util.defineFixedStepInput
local defineVariableStepTumb = BIOS.util.defineVariableStepTumb
local defineString = BIOS.util.defineString
local defineRockerSwitch = BIOS.util.defineRockerSwitch
local defineMultipositionSwitch = BIOS.util.defineMultipositionSwitch

--NS430 added by Capt Zeen------------------------------------------------------------------------------
definePushButton("NS430_PWR-VOL_PUSH-SQ_POW", 257, 3001, 1, "NS430", "PWR-VOL_PUSH-SQ COM Power")
defineRotary("NS430_PWR-VOL_PUSH-SQ_VOL", 257, 3002, 0, "NS430", "PWR-VOL_PUSH-SQ COM Volume")
definePushButton("NS430_VOL_PUSH-ID_PUSH", 257, 3004, 3, "NS430", "VOL_PUSH-ID VLOC Push")
defineRotary("NS430_VOL_PUSH-ID_VOL", 257, 3005, 2, "NS430", "VOL_PUSH-ID VLOC volume")
defineRotary("NS430_BIG_LEFT_BTN", 257, 3007, 4, "NS430", "NS430_BIG_LEFT_BTN")
definePushButton("NS430_SMALL_LEFT_BTN_PUSH", 257, 3009, 5, "NS430", "SMALL_LEFT_BTN Push")
defineRotary("NS430_SMALL_LEFT_BTN_ROT", 257, 3010, 6, "NS430", "SMALL_LEFT_BTN rotate")
definePushButton("NS430_COM_FLIP_FLOP", 257, 3012, 7, "NS430", "COM flip-flop")
definePushButton("NS430_VLOC_FLIP_FLOP", 257, 3013, 8, "NS430", "VLOC flip-flop")
definePushButton("NS430_CDI", 257, 3014, 9, "NS430", "CDI")
definePushButton("NS430_OBS", 257, 3015, 10, "NS430", "OBS")
definePushButton("NS430_MSG", 257, 3016, 11, "NS430", "MSG")
definePushButton("NS430_FPL", 257, 3017, 12, "NS430", "FPL")
definePushButton("NS430_PROC", 257, 3018, 13, "NS430", "PROC")
definePushButton("NS430_RNG-UP", 257, 3019, 14, "NS430", "RNG-UP")
definePushButton("NS430_RNG-DOWN", 257, 3020, 14, "NS430", "RNG-DOWN")
definePushButton("NS430_DIRECT-TO", 257, 3021, 15, "NS430", "DIRECT-TO")
definePushButton("NS430_MENU", 257, 3022, 16, "NS430", "MENU")
definePushButton("NS430_CLR", 257, 3023, 17, "NS430", "CLR")
definePushButton("NS430_ENT", 257, 3024, 18, "NS430", "ENT")
defineRotary("NS430_BIG_RIGHT_BTN", 257, 3025, 19, "NS430", "BIG_RIGHT_BTN")
definePushButton("NS430_SMALL_RIGHT_BTN_PUSH", 257, 3027, 20, "NS430", "SMALL_RIGHT_BTN Push")
defineRotary("NS430_SMALL_RIGHT_BTN_ROT", 257, 3028, 21, "NS430", "SMALL_RIGHT_BTN rotate")
definePushButton("NS430_PWR-VOL_PUSH-SQ_POW_STOP_ACTION", 257, 3030, 1, "NS430", "PWR-VOL_PUSH-SQ COM Power stop action command")
definePushButton("NS430_VOL_PUSH-ID_PUSH_STOP_ACTION", 257, 3031, 3, "NS430", "VOL_PUSH-ID VLOC Push stop action command")
definePushButton("NS430_SMALL_LEFT_BTN_PUSH_STOP_ACTION", 257, 3032, 5, "NS430", "SMALL_LEFT_BTN Push stop action command")
definePushButton("NS430_COM_FLIP_FLOP_STOP_ACTION", 257, 3033, 7, "NS430", "COM flip-flop stop action command")
definePushButton("NS430_VLOC_FLIP_FLOP_STOP_ACTION", 257, 3034, 8, "NS430", "VLOC flip-flop stop action command")
definePushButton("NS430_CDI_STOP_ACTION", 257, 3035, 9, "NS430", "CDI stop action command")
definePushButton("NS430_OBS_STOP_ACTION", 257, 3036, 10, "NS430", "OBS stop action command")
definePushButton("NS430_MSG_STOP_ACTION", 257, 3037, 11, "NS430", "MSG stop action command")
definePushButton("NS430_FPL_STOP_ACTION", 257, 3038, 12, "NS430", "FPL stop action command")
definePushButton("NS430_PROC_STOP_ACTION", 257, 3039, 13, "NS430", "PROC stop action command")
definePushButton("NS430_RNG-UP_STOP_ACTION", 257, 3040, 14, "NS430", "RNG-UP stop action command")
definePushButton("NS430_RNG-DOWN_STOP_ACTION", 257, 3041, 14, "NS430", "RNG-DOWN stop action command")
definePushButton("NS430_DIRECT-TO_STOP_ACTION", 257, 3042, 15, "NS430", "DIRECT-TO stop action command")
definePushButton("NS430_MENU_STOP_ACTION", 257, 3043, 16, "NS430", "MENU stop action command")
definePushButton("NS430_CLR_STOP_ACTION", 257, 3044, 17, "NS430", "CLR stop action command")
definePushButton("NS430_ENT_STOP_ACTION", 257, 3045, 18, "NS430", "ENT stop action command")
definePushButton("NS430_SMALL_RIGHT_BTN_PUSH_STOP_ACTION", 257, 3046, 20, "NS430", "SMALL_RIGHT_BTN Push stop action command")
-- end of NS430 added by Capt Zeen----------------------------------------------------------------------


BIOS.protocol.endModule()

 

the first line contains the module name and the base address (take care not to overlap with addresses from other modules). The second line lists all the modules you want to use with the NS430.

 

Then you also have to include the module in BIOS.lua by adding:

 

dofile(lfs.writedir()..[[scripts\dcs-bios\lib\NS430.lua]])

 

before

 

dofile(lfs.writedir()..[[scripts\DCS-BIOS\BIOSConfig.lua]])

 

If your aircraft of choice is not in the AircraftList.lua, you will also have to add it there.

Link to comment
Share on other sites

No problem. Thank YOU for matching all those numbers to functions. I wasn't looking forward to doing it myself ;).

 

To be honest, I haven't tried the last bit yet (adding an aircraft to the AircraftList.lua list) but I have made it work with the Mi-8 and L-39ZA, as in my example.

 

There's one other bit of experience I can share that might be helpful to you or somebody else. I haven't yet tested all the buttons, but I used the FPL button for my initial tests. When I mapped it like this in my Arduino sketch:

 

DcsBios::Switch2Pos fpl("NS430_FPL", 2);

 

It clicked in game on the button press and again on the button release. I fixed it by mapping it like this instead:

 

DcsBios::ActionButton fpl("NS430_FPL", "TOGGLE", 2);

 

This way it only registers once in the game.

 

Also a small delay (50 - 100ms) between the DcsBios::loop(); calls seems to be needed to debounce tact switches. I don't believe the DCS BIOS Arduino library has any "built in" debouncing?

 

Sorry if this is basic stuff to you, I only started playing with DCS BIOS yesterday evening ;).

Link to comment
Share on other sites

  • 7 months later...

How do you use the STOP_ACTION commands? I can use the ActionButton class to make the press work, but when I use it the in game button graphic changes to the pressed version, but never changes back to the unpressed version. I'm guessing that the unpressing of the graphical button is what is controlled by the STOP_ACTION commands? Is there a way to call those on button release? I'm using the RealSimGear hardware, for reference.

If you disapprove of this post, please feel free to give me negative rep. If you approve of this post, please feel free to give me negative rep.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...