Jump to content

DCS-BIOS Discussion Thread


FSFIan

Recommended Posts

Hello,

I still have problems displaying the radio of the Gazelle.

 

I look in the lua console to find the indication number and the function for the display.

 

mini_670918Witchcraft.png

 

I use this code in my lib

local function getUHFFrequency()
   local ind = list_indication(5)
   if ind == nil then return "       " end
   local freqStatus = ind["UHF_Freq"] -- e.g. "251000"
   return freqStatus:sub(0,3) .. "." .. freqStatus:sub(4,6)
end

defineString("UHF_FREQUENCY", getUHFFrequency, 7, "UHF RADIO", "UHF Frequency Display")

 

But it does not work

 

I dont anderstand,

 

Thanks for your help

Link to comment
Share on other sites

Have you ever considered a multi aircraft use ?

 

It's on the roadmap for DCS-BIOS 2.0.

 

Hello,

local function getUHFFrequency()
   local ind = list_indication(5)
   if ind == nil then return "       " end
   local freqStatus = ind["UHF_Freq"] -- e.g. "251000"
   return freqStatus:sub(0,3) .. "." .. freqStatus:sub(4,6)
end

defineString("UHF_FREQUENCY", getUHFFrequency, 7, "UHF RADIO", "UHF Frequency Display")

 

The list_indication function returns a string, so 'list_indication(5)["UHF_Freq"]' does not make sense. Try using BIOS.util.parse_indication instead:

 

local function getUHFFrequency()
   local ind = BIOS.util.parse_indication(5)
   if ind == nil then return "       " end
   local freqStatus = ind["UHF_Freq"] -- e.g. "251.000"
   return freqStatus
end

defineString("UHF_FREQUENCY", getUHFFrequency, 7, "UHF RADIO", "UHF Frequency Display")

Link to comment
Share on other sites

Hi [fsf] Ian

 

just a wonder really, do you think ED would ever consider DCS BIOS as an official utility, or is it likely to remain a non ED supported software?

 

Neal

Desktop PC:

Intel i7 14700K, MSI Z790 MAG Tomahawk MOBO, 64Gb RAM , GPU Nvidia RTX 3080ti

Windows 11, VPC joystick, Crosswind rudder peddles, HP Reverb G2, VPC Collective, DOF Reality H2, Gametrix seat, WinWing panels.

Link to comment
Share on other sites

ED provides the Export.lua interface as the official way for third-party software to interact with the simulator. That interface is pretty stable. DCS-BIOS has existed for more than two years now, and I can think of only two occasions where something broke in DCS-BIOS because ED changed something. When the multiplayer integrity check was added (which came with more fine-grained export options), disabling ownship_export ("Allow Player's Export") would break DCS-BIOS because it also disabled the function that tells you the current aircraft type; I filed a bug with ED and they made the current aircraft type available regardless of the export settings. Two months ago, the internals of how the TACAN panel in the A-10C works were changed; this required a minor adjustment to the A10C.lua file in DCS-BIOS.

 

In that sense, ED does support DCS-BIOS and other third-party software by providing a stable foundation to build on.

 

I don't think DCS-BIOS will ever be considered an "official utility", whatever that might mean. ED certainly does not have the time and man power to help people write and debug Arduino sketches.

 

If you want more modules to be supported in DCS-BIOS, the solution is to make it easier to add a module to DCS-BIOS, which is something I am working on for DCS-BIOS 2.0. Right now the process is a mess that requires knowledge of Lua and DCS internals and does not provide good debugging tools -- mostly because I was still figuring everything out and had no idea what I was doing when I created DCS-BIOS two years ago.

Link to comment
Share on other sites

Thanks Ian,

 

It works in the control reference but it make conflicts with somme led??? They no longer work

 

Any idea??

 

Thanks

 

I need more information. Which LED? What were the contents of your Lua file when it worked, and what are the contents of the 'broken' file? How did you assert that the LEDs worked (i.e. where is the LED in the cockpit and what buttons do I have to push to make it turn on or off)?

 

Remember, I can't see your files (unless you post them somewhere) and I have no idea how to fly the Gazelle :)

Link to comment
Share on other sites

Sorry,

Data from clickable elements i took from clickable_data.lua., but when i need to take data for indicators.

So, for string (from MIG-21)

defineIndicatorLight("AC_GEN_LIGHT", 511, "Main Warning Lights", "AC Generator Light") ? i can t find parametrs.

 

P.S. Craft Mig-15

Link to comment
Share on other sites

Sorry,

Data from clickable elements i took from clickable_data.lua., but when i need to take data for indicators.

So, for string (from MIG-21)

defineIndicatorLight("AC_GEN_LIGHT", 511, "Main Warning Lights", "AC Generator Light") ? i can t find parametrs.

 

P.S. Craft Mig-15

 

For the Gazelle the indicator information are in the arg_int.lua

Link to comment
Share on other sites

Ian;3102196']I need more information. Which LED? What were the contents of your Lua file when it worked, and what are the contents of the 'broken' file? How did you assert that the LEDs worked (i.e. where is the LED in the cockpit and what buttons do I have to push to make it turn on or off)?

 

Remember, I can't see your files (unless you post them somewhere) and I have no idea how to fly the Gazelle :)

 

Thanks for your help Ian :thumbup:

 

Here is my code where the LED work

 

BIOS.protocol.beginModule("SA342", 0x4200)
BIOS.protocol.setExportModuleAircrafts({"SA342M", "SA342L", "SA342Mistral"})


local document = BIOS.util.document
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("Voyant_DEM", 300, "Front Panel", "Voyant Start engine")
defineIndicatorLight("Voyant_RLT", 301, "Front Panel", "Voyant RLT")
defineIndicatorLight("Voyant_BLOC", 302, "Front Panel", "Voyant BLOC")
defineIndicatorLight("Voyant_ALARME", 303, "Front Panel", "Voyant Alarme")
defineIndicatorLight("Voyant_RSUPP", 320, "Front Panel", "Voyant RSUPP")
defineIndicatorLight("Voyant_RCONV", 321, "Front Panel", "Voyant RCONV")
defineIndicatorLight("Voyant_FILTAS", 322, "Front Panel", "Voyant Sand Filter")

 

If I add the code for the radio display

 

local function getUHFFrequency()
   local ind = BIOS.util.parse_indication(5)
   if ind == nil then return "       " end
  local freqStatus = ind["UHF_Freq"] -- e.g. "251.000"
   return freqStatus
end

defineString("UHF_FREQUENCY", getUHFFrequency, 7, "UHF RADIO", "UHF Frequency Display")

 

The display work in the control reference but the Sand filter led stay on and the Ralenti, Bloc, RSUP and RCONV dont work in my panel but are right in the control reference.

If i turn on the radio, the BLOC and RCONV led goes on.

 

In game to test the LED simply pusch the test button near the DEM, RLT, BLOC LED. The Sand Filter must equip the gazelle via emport in the mission editor and simply put the switch bellow the LED on. wait a few second and the LED must be on to.

 

mini_988701Gazelle.png

 

Here my arduino squetch for the first MEGA

 

/* use '#define DCSBIOS_DEFAULT_SERIAL' instead if your Arduino board
*  does not feature an ATMega328 or ATMega2650 controller.
*/
#define DCSBIOS_IRQ_SERIAL
#include "DcsBios.h"

/* Declare a Master Caution Reset button on pin 10 */
DcsBios::RotaryEncoder labelsPtr("LABELS_PTR", "-3200", "+3200", 22, 23);
DcsBios::Switch3Pos paModePtr("PA_MODE_PTR", 24, 25);
DcsBios::Switch2Pos paLacetPtr("PA_LACET_PTR", 26);
DcsBios::Switch2Pos paRoulisPtr("PA_ROULIS_PTR", 27);
DcsBios::Switch2Pos paTangagePtr("PA_TANGAGE_PTR", 28);
DcsBios::Switch2Pos paMasterPtr("PA_MASTER_PTR", 29);
DcsBios::Switch3Pos interMaPtr("INTER_MA_PTR", 30, 31);
DcsBios::Switch2Pos fuelPumpFrontPtr("FUEL_PUMP_FRONT_PTR", 32);
DcsBios::Switch2Pos clockStartstopPtr("CLOCK_STARTSTOP_PTR", 33);
DcsBios::Switch2Pos clockResetPtr("CLOCK_RESET_PTR", 34);
DcsBios::Switch2Pos rsuppPtr("RSUPP_PTR", 35);
DcsBios::Switch2Pos rconvPtr("RCONV_PTR", 36);
DcsBios::Switch2Pos filtasPtr("FILTAS_PTR", 37);
DcsBios::Switch2Pos fmagPtr("FMAG_PTR", 38);

DcsBios::LED voyantFiltas(0x4254, 0x0020, 41);
DcsBios::LED voyantRconv(0x4254, 0x0010, 40);
DcsBios::LED voyantRsupp(0x4254, 0x0008, 39);

void setup() {
 DcsBios::setup();
}

void loop() {
 DcsBios::loop();
}

 

And the second UNO in RS485

 

#define DCSBIOS_RS485_SLAVE 5

/*
 The Arduino pin that is connected to the
 /RE and DE pins on the RS-485 transceiver.
*/
#define TXENABLE_PIN 2

#include "DcsBios.h"

/* paste code snippets from the reference documentation here */
DcsBios::Switch2Pos trimPtr("TRIM_PTR", 3);
DcsBios::ActionButton vatestPtrToggle("VATEST_PTR", "TOGGLE", 4);
DcsBios::Switch2Pos batteriePtr("BATTERIE_PTR", 5);
DcsBios::Switch2Pos alterPtr("ALTER_PTR", 6);
DcsBios::Switch2Pos genePtr("GENE_PTR", A0);
const byte artvisvhfdopPtrPins[4] = {7, 8, 9, 10};
DcsBios::SwitchMultiPos artvisvhfdopPtr("ArtVisVhfDop_PTR", artvisvhfdopPtrPins, 4);
DcsBios::Switch3Pos egPilotePtr("EG_PILOTE_PTR", 11, 12);
DcsBios::LED voyantBloc(0x4254, 0x0002, A1);
DcsBios::LED voyantRlt(0x4254, 0x0001, A2);
DcsBios::LED voyantDem(0x4252, 0x8000, A3);


void setup() {
 DcsBios::setup();
}

void loop() {
 DcsBios::loop();
}

 

I think it uses the same Buffer or adress 4254 ???

 

Here the info in control reference for the display

 

Output Type: string Address: 0x4254 Max. Length: 7 Description: UHF Frequency Display

 

I hope you have enough information.

 

Thanks again


Edited by Ruahatu
Link to comment
Share on other sites

Dear Ruahatu

Where you take that "Voyant_FILTAS" and 322

defineIndicatorLight("Voyant_FILTAS", 322, "Front Panel", "Voyant Sand Filter")

 

and

where you take address 0x4254, mask 0x0020 and 41 ?

DcsBios::LED voyantFiltas(0x4254, 0x0020, 41);

Maybe you can show you arg_int.lua, from which you take those data (Please)

 

I have mainpannel lua

with strings


----------`BLA BLA BLA

-- controls
-- Throttle
EngineThrottle				= CreateGauge()
EngineThrottle.arg_number	= 205
EngineThrottle.input		= {0.0, 1.0}
EngineThrottle.output		= {0.0, 1.0}
EngineThrottle.controller	= controllers.EngineThrottle

----------`BLA BLA BLA

-- Lamps
dofile(LockOn_Options.script_path.."Devices_specs/MainPanel/lamps.lua")

 

And lamps.lua

 

function create_default_lamp(arg_, controller_) 
local _lamp	= CreateGauge()
_lamp.arg_number = arg_
_lamp.input	= {-1.0, 1.0}
_lamp.output = {-1.0, 1.0}
_lamp.controller = controller_
return _lamp
end



-- electric system

lamp_GeneratorOff	= create_default_lamp(57, controllers.lamp_GeneratorOff)
lamp_Ignition		= create_default_lamp(58, controllers.lamp_Ignition)

--BLA BLA BLA

-- Gun Camera
lamp_GunCamera		= create_default_lamp(55, controllers.lamp_GunCamera)

 

Maybe arg =57 .... , but msg?

 

So, I don't inderstand where i need take address,mask, msg,arg

for strings

 

defineIndicatorLight( msg , arg, )

and

DcsBios::LED lampgen(addr,mask sub);

Link to comment
Share on other sites

If you want more modules to be supported in DCS-BIOS, the solution is to make it easier to add a module to DCS-BIOS, which is something I am working on for DCS-BIOS 2.0. Right now the process is a mess that requires knowledge of Lua and DCS internals and does not provide good debugging tools -- mostly because I was still figuring everything out and had no idea what I was doing when I created DCS-BIOS two years ago.

 

This is something I have wanted for ages!

 

Version 2.0!

 

I will add more aircraft when this version is ready.

 

How far along is the Update?

 

Thank you for this utility.

 

It is a perfect fit with DCS and my controls.

 

Best wishes,

Hawkeye

"Yeah, and though I work in the valley of Death, I will fear no Evil. For where there is one, there is always three. I preparest my aircraft to receive the Iron that will be delivered in the presence of my enemies. Thy ALCM and JDAM they comfort me. Power was given unto the aircrew to make peace upon the world by way of the sword. And when the call went out, Behold the "Sword of Stealth". And his name was Death. And Hell followed him. For the day of wrath has come and no mercy shall be given."

Link to comment
Share on other sites

clickabledata.lua contains msg and arg number and its easy calculate address, but mainpanel_init.lua contains only arg_number. Its enought for standart export

local panel = GetDevice(0)

if panel then

panel :update_arguments()

local AC_GEN_LAMP = panel:get_argument_value(57)

end

but its not enought for DCS-BIOS

 

I hope this is not a dead end?


Edited by jazzymanserg
Link to comment
Share on other sites

So, I don't inderstand where i need take address,mask, msg,arg

for strings

 

defineIndicatorLight( msg , arg, )

and

DcsBios::LED lampgen(addr,mask sub);

 

The "msg" parameter is just an identifier for DCS-BIOS, you can pick whatever you like (keep it below about 20 characters and use all caps and underscores to follow the existing convention).

 

You use the "defineIndicatorLight" function (with the identifier you came up with for the "msg' parameter and the argument number you got from somewhere in your cockpit's Lua files) to add the lamp to DCS-BIOS. Then you have to hop into a Mig-15 in DCS so DCS-BIOS updates the metadata for your module. Now your new lamp should show up in the interactive control reference.

 

The control reference will show you the code snippet that includes the address and bitmask that were assigned to your new lamp (these are assigned sequentially in the order that your controls are defined in the Lua file for your DCS-BIOS module).

Link to comment
Share on other sites

Ian;3103286']

The control reference will show you the code snippet that includes the address and bitmask that were assigned to your new lamp (these are assigned sequentially in the order that your controls are defined in the Lua file for your DCS-BIOS module).

 

COOL ! Its working THNX IAN !!!!

Link to comment
Share on other sites

Ian;3103248']Ruhatu: Are you adding the display code at the end of your file? If you add it in the middle' date=' the addresses of anything after it will change, so you'd have to adjust your Arduino sketches accordingly.[/quote']

 

You are the king :thumbup:

 

I am now busy with the AM radio and I would certainly come back to you :smilewink:

 

1000 Thanks Ian

Link to comment
Share on other sites

:music_whistling: I am back for the VHF AM for the Gazelle :cry:

 

mini_503775radio1.png

 

The radio have 6 digits

 

AM_Radio_freq_cent = 133,

AM_Radio_freq_dix = 134,

AM_Radio_freq_unite = 136,

AM_Radio_freq_dixieme = 138,

AM_Radio_freq_centieme = 139,

 

The frequency increases by 0.025

 

mini_719098radio2.png

 

When i use this code

local function getVhfNavFreq()
local function a(n) return GetDevice(0):get_argument_value(n) end
return string.format("%.0f%.0f%.0f", a(133)*10, a(134)*10, a(136)*10) .. "." .. string.format("%.0f%.0f", a(138)*10, a(139)*10)
end
defineString("VHFNAV_FREQ", getVhfNavFreq, 7, "VHF NAV Radio", "VHF NAV Frequency")

 

I can see in the controle reference the frequency but the 2 last digit are wrong

 

0.000 = 0

0.025 = 3

0.050 = 5

0.075 = 8

 

I understand that i have to use this type of code

 

local vhf_lut1 = {
   ["0.00"] = "0",
["0.25"] = "3",
   ["0.50"] = "5",
   ["0.75"] = "8"
}

local function getVhfAmFreqency()
   local freq1 = string.format("%.0f",GetDevice(0):get_argument_value(133)):sub(3)
   local freq2 = string.format("%.0f", GetDevice(0):get_argument_value(134)):sub(3)
   local freq3 = string.format("%.0f", GetDevice(0):get_argument_value(136)):sub(3)
   local freq4 = string.format("%.0f", GetDevice(0):get_argument_value(138)):sub(3)
   local freq5 = vhf_lut1[string.format("%.2f",GetDevice(0):get_argument_value(139))]
return freq1 .. freq2 .. freq3 "." .. freq3 .. freq4 .. freq5
end

defineString("AM_DISPLAY", getVhfAmFreqency, 7, "VHFAM Panel", "VHFAM Display")

 

But it does not work and once again i dont understand :cry:

 

Thanks for your help

Link to comment
Share on other sites

FIRST problem with compass solved

LUA- defineRotary("compass", 21, 3001, 34, "Heading Knob", "compass rotate")

ARDUINO- DcsBios::RotaryEncoder compass ("compass", "-3200", "+3200", 18, 19);

MISTAKE - DcsBios::RotaryEncoder compass ("compass", "DEC", "INC", 18, 19);

 

I think, that it will be ready new module MIG-15, soon.. now it have 46 buttons , 10 encoders


Edited by jazzymanserg
Link to comment
Share on other sites

Somebody knows how to do this realize

springloaded_3_pos_tumb on encoder ?

 

for example trimmer

springloaded_3_pos_tumb(_("Aileron Trimmer Switch, LEFT/OFF/RIGHT"),        devices.CONTROL_INTERFACE,    control_commands.Mig15_Command_TrimAileron,    control_commands.Mig15_Command_TrimAileron,    142)

code from clickabledata.lua

function springloaded_3_pos_tumb(hint_, device_, command1_, command2_, arg_, val1_, val2_, val3_)
   local val1 = val1_ or -1.0
   local val2 = val2_ or 0.0
   local val3 = val3_ or 1.0
   return  {    
               class         = {class_type.BTN,class_type.BTN},
               hint          = hint_,
               device         = device_,
               action         = {command1_,command2_},
               stop_action = {command1_,command2_},
               arg           = {arg_,arg_},
               arg_value     = {val1,val3}, 
               arg_lim       = {{val1,val2},{val2,val3}},
               updatable     = true, 
               use_OBB     = true,
               use_release_message = {true,true},
               sound        = {{SOUND_SW1}, {SOUND_SW1}}
           }
end

The only func I found is defineRockerSwitch

 

then i wrote in wrote in lu defineRockerSwitch("TrimAilerons",3,3002,3002,3002,3002,142,"Heading Knob","Aileron Trimmer Switch, LEFT/OFF/RIGHT")

in Arduino

DcsBios::Switch3Pos TrimAilerons("TrimAilerons",2,3);

2,3 its encoder pins

 

Its woking, BUT no correct.

Sometimes not return to the center position, and sometime moving between left and central or right and centrall

 

Socat protecol :

Rotate left :

TrimAilerons 0

TrimAilerons 2

TrimAilerons 1

Rotate right :

TrimAilerons 2

TrimAilerons 0

TrimAilerons 1


Edited by jazzymanserg
Link to comment
Share on other sites

Alright. A small question.

 

I have just installed DCS-BIOS folder v 0.5.2 into my \Saved Games\DCS.openalpha\Scripts and added the .zip Arduino Libary v0.2.9.

 

I have trying to get the Anti-Collision light switch up and runningusing two digital inputs via

const byte lcpAnticollisionPins[2] = {3, 4}; //off, on
DcsBios::SwitchMultiPos lcpAnticollision("LCP_ANTICOLLISION", lcpAnticollisionPins, 2);

 

However when I then insert the status LED

DcsBios::LED lcpAnticollision(0x1144, 0x0080, 12);

I get a compiller error;

A10C_Slave4_Light_control_panel_ver_2:28: error: conflicting declaration 'DcsBios::SwitchMultiPos lcpAnticollision'

 

DcsBios::SwitchMultiPos lcpAnticollision("LCP_ANTICOLLISION", lcpAnticollisionPins, 2);

 

^

..\Dokumenter\Arduino\DCS-BIOS\A10C_Slave4_Light_control_panel\A10C_Slave4_Light_control_panel_ver_2\A10C_Slave4_Light_control_panel_ver_2.ino:25:14: note: previous declaration as 'DcsBios::LED lcpAnticollision'

 

DcsBios::LED lcpAnticollision(0x1144, 0x0080, 12);

 

^

 

exit status 1

conflicting declaration 'DcsBios::SwitchMultiPos lcpAnticollision'

 

Full sketch;

/*
 The following #define tells DCS-BIOS that this is a RS-485 slave device.
 It also sets the address of this slave device. The slave address should be
 between 1 and 126 and must be unique among all devices on the same bus.
*/
#define DCSBIOS_RS485_SLAVE 4

/*
 The Arduino pin that is connected to the
 /RE and DE pins on the RS-485 transceiver.
*/
#define TXENABLE_PIN 2

#include "DcsBios.h"

/* paste code snippets from the reference documentation here */
DcsBios::LED masterCaution(0x1012, 0x0800, 13);
DcsBios::Potentiometer lcpFormation("LCP_FORMATION", A0);
DcsBios::Potentiometer lcpAuxInst("LCP_AUX_INST", A1);
DcsBios::Potentiometer lcpEngInst("LCP_ENG_INST", A2);
DcsBios::Potentiometer lcpFlightInst("LCP_FLIGHT_INST", A3);
DcsBios::Potentiometer lcpConsole("LCP_CONSOLE", A4);
DcsBios::Potentiometer lcpFlood("LCP_FLOOD", A5);

DcsBios::LED lcpAnticollision(0x1144, 0x0080, 12);

//const byte lcpAnticollisionPins[2] = {3, 4}; //off, on
//DcsBios::SwitchMultiPos lcpAnticollision("LCP_ANTICOLLISION", lcpAnticollisionPins, 2);



void setup() {
 DcsBios::setup();
}

void loop() {
 DcsBios::loop();
}

 

Anyone got an idea why this is happening??

 

I admit that last time I tried it I used

DcsBios::Switch2Pos lcpAnticollision("LCP_ANTICOLLISION", PIN);

to activate the anti-collission switch but using that instead of the SwitchMultiPos also gives compiler error.

 

Cheers

Hans

Link to comment
Share on other sites

  • Recently Browsing   0 members

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