Jump to content

Creating Mi-8 module for DCS-BIOS


ArturDCS

Recommended Posts

Doing my very first steps here and added Generator 1 & 2 Switch

If I toggle these in the cockpit the changes do show in DCS-BIOS Control Reference page. But not vice versa, cannot manipulate them in the ctrl-ref page and have the changes in the cockpit.

 

Looking at local cb_start_cmd which is used in already existing modules, is it just an unique number? Signature from Util.lua:defineToggleSwitch states it is "command"?

 

 

Mi8MT.lua :

BIOS.protocol.beginModule("Mi-8MT", 0x2600)
BIOS.protocol.setExportModuleAircrafts({"Mi-8MT"})

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

local cb_start_cmd = 3021

defineToggleSwitch("GEN1_SWITCH", 1, cb_start_cmd + 1, 538, "Circuit Breakers", "Generator 1 Switch, ON/OFF")
defineToggleSwitch("GEN2_SWITCH", 1, cb_start_cmd + 2, 539, "Circuit Breakers", "Generator 2 Switch, ON/OFF")
BIOS.protocol.endModule()

Link to comment
Share on other sites

How do I figure out ranges, what are the end values?

From clickabledata.lua

elements["PTR-EEP-LVR-MODE"]        = multiposition_switch(_("AC Voltmeter Selector"), devices.ELEC_INTERFACE, device_commands.Button_17, 535, 11, 0.1)

It has 11 positions and after a few tries it seems like the range is 0 - 1.1. Is it possible to see those values somewhere? Some log?

 

So what seems to work is then in DCS-BIOS :

defineTumb("AC_VOLT_SEL", 1, cb_start_cmd + 17, 535, 0.1, {0, 1.1}, nil, false, "Circuit Breakers", "AC Voltmeter Selector")

Link to comment
Share on other sites

In general, argument values are somewhere in the range of -1.0 to 1.0 (inclusive). So far I haven't seen an argument value outside of this range.

 

If you have 11 possible values and they start at 0, the range would be {0, 1}:

0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0

 

If you are not sure what values are used by the sim, you can execute "return GetDevice(0):get_argument_value(n)" where n in the argument number. That will return the current value of that cockpit argument; you just have to manually set the switch to a few different positions and call that function again.

 

I don't know what "Tumb" stands for, it's just a term I adopted from ED's Lua files. Might be shorthand for something in Russian for all I know. It seems to refer to a control with several discrete positions.

 

To reload your Mi-8 Lua file, all you need to do is to execute the dofile(...) line that you added to BIOS.lua. That will work in most cases. You may still run into the occasional situation where you need to reload the sim, for example if you introduce an error in an inconvenient place and things only partially load, or if the state of the simulator gets confused because you tried to send commands to the simulator that it did not expect, but this is quite rare.

 

To execute Lua snippets in the sim, you can use the Lua console feature in DCS Witchcraft.

Link to comment
Share on other sites

Strange behavior from one of the controls.

If you have any idea it would be great, otherwise I'll leave it be.

defineTumb("BATT_HEAT_SWITCH", 1, cb_start_cmd + 75, 522, 1, {0, 1}, nil, false, "Electrical system", "Battery Heating Switch, ON/OFF")

--default_2_position_tumb(_("Battery Heating Switch, ON/OFF"), devices.ELEC_INTERFACE, cb_start_cmd + 75, 522)

This changes in the ctrl-ref page when switched in the cockpit but again, can't change it from the ctrl-ref page to make changes in the cockpit. Strange. Looks just like any other of the previous controls.

 

EDIT:

Problem found, it was the sequence cb_start_cmd + 75 that changed. I didn't notice it at first. Once I changed it to the correct number it works. That sequence and the former can be found in command_defs.lua for the Mi-8.


Edited by ArturDCS
Found the problem.
Link to comment
Share on other sites

DCS-BIOS bug?

 

Those controls that return to their off position once released, like reset toggle can't be manipulated from the DCS-BIOS ctrl-ref page. I compared to UH-1H, see screenshots.

I was trying to get the Group <n> On Buttons for the panels in the Mi-8 to work when I discovered this.

 

So it shows in the ctrl-ref page when I toggle them in the cockpit but vice versa does not work.

I can define them as defineToggleSwitch() for the Mi-8 but then they stay in the "unnatural" on position until toggled a 2nd time.

The UH-1H toggles are defined using defineRockerSwitch().

uh1h_returning_switch.jpg.d9fe73504d43b00786ad1561273bacce.jpg

mi-8_azs_grp_buttons.thumb.jpg.8030830261f4755ca041fb3cae6d2280.jpg

Link to comment
Share on other sites

Assuming the switch starts in the OFF position, if you click the "toggle" button in the control reference once, it will toggle the state of the switch from OFF to ON. It will stay in that position until you send another command. There is nothing "unnatural" about this, the same thing happens if you click and hold the mouse button in the cockpit.

 

Once you send a second "toggle" command (or an "off" command), the switch returns to the OFF position. In the virtual cockpit, this happens as soon as you release the mouse button.

Link to comment
Share on other sites

OK.

In the Mi-8 the group buttons get stuck behind the switches if you click a switch off while the group button (bar) is on. Looks awkward but if that is how it then no problemos. I'll just continue. Thanks!

 

Ian;3226369']Assuming the switch starts in the OFF position, if you click the "toggle" button in the control reference once, it will toggle the state of the switch from OFF to ON. It will stay in that position until you send another command. There is nothing "unnatural" about this, the same thing happens if you click and hold the mouse button in the cockpit.

 

Once you send a second "toggle" command (or an "off" command), the switch returns to the OFF position. In the virtual cockpit, this happens as soon as you release the mouse button.

Link to comment
Share on other sites

Following this with interest, will you be able to merg your Mi-8 updates so we can all enjoy them?

 

Keep up the good work Ian and Arthur!

Merge with DCS-BIOS? Certainly hope so. I am working on the radios now. That and a few other controls remain. The rest is done (99%) and somewhat tested. Will most certainly be bugs like DCS-BIOS shows OFF when it is ON and vice versa.

AND not least, naming standard of the components, that is perhaps something to work on, I don't know how important it is. Can be difficult to be consistent when there are hundreds of components to name.

Artur without the h. ;)

  • Like 1
Link to comment
Share on other sites

Out of curiosity, what will you do with Mi-8 in DCS-BIOS?

Not my real name anyways. :) My prefer not to use my real name in English contexts for obvious reasons. :music_whistling:

 

Excellent, it'll be fantastic to have the Mi-8 available in DCS BIOS.

Although you would need lots of room to build a full cockpit!

 

PS apologies for the spelling of you name, I blame my dyslexia!

Link to comment
Share on other sites

I've already made a generic panel I use for the other modules available in DCS BIOS.

It has features like warning lights, fire extinguishers, drop tanks, landing and nav lights etc

Currently working on another generic panel that will handle radio and nav.

When I want to use a different module with a panel I just load the sketch I made for it.

eg. mig-21 :

https://www.dropbox.com/s/hdwptze66n9fs4w/Generic_MiG-21_001.ino?dl=0

 

But I digress.

Once the Mi-8 is in DCS BIOS I will add it to those panels and perhaps even make a weapons control panel for the Mi-8.

Link to comment
Share on other sites

So I think I am 99.99% done. Ian how do we proceed? I think one way would be if you had a glance at the file before any git actions. Naming and such.

 

I have to figure out how to get radio frequencies to string outputs. That is basically what is left from what I can tell.

 

Lua file attached.

 

EDIT:

Lamps added

Mi8MT.lua


Edited by ArturDCS
Lua updated for faulty lamp entries
Link to comment
Share on other sites

  • Recently Browsing   0 members

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