rocketeer Posted February 27, 2015 Posted February 27, 2015 I did not have an export.lua file in scripts folder. When I set up dcs bios, I copied th export.lua file from the zip file, and copied the line 'dofile(lfs.writedir()..[[scripts\DCS-BIOS\BIOS.lua]])'. So the file only has this line of code. As for error dcs.log, please see attached.dcs.zip My A10C cockpit thread
FSFIan Posted February 28, 2015 Author Posted February 28, 2015 DCS-BIOS cannot bind to TCP port 7778 and proceeds to shit its pants because there is no appropriate error handling right now. Either a firewall is preventing DCS.exe from listening to TCP port 7778 or another process is already listening on that port. Try disabling the TCP server by editing BIOSConfig.lua in Notepad++ and commenting out line 3 (add "--" to the beginning) so it looks like this: BIOS.protocol_io.connections = { BIOS.protocol_io.DefaultMulticastSender:create(), --BIOS.protocol_io.TCPServer:create(), -- BIOS.protocol_io.UDPSender:create({ port = 7777, host = "192.168.1.177" }), BIOS.protocol_io.UDPListener:create({ port = 7778 }) } The only thing that uses the TCP server right now is the interactive control reference documentation. DCS-BIOS | How to export CMSP, RWR, etc. through MonitorSetup.lua
rocketeer Posted February 28, 2015 Posted February 28, 2015 the last line is already BIOS.protocol_io.UDPListener:create({ port = 7778 }) leaving it alone or commenting it out made no difference. My A10C cockpit thread
FSFIan Posted February 28, 2015 Author Posted February 28, 2015 the last line is already BIOS.protocol_io.UDPListener:create({ port = 7778 }) leaving it alone or commenting it out made no difference. I was not talking about the last line. Comment out (or remove) the TCPServer line. I think that the failing TCPServer is preventing the UDPListener from working properly. DCS-BIOS | How to export CMSP, RWR, etc. through MonitorSetup.lua
rocketeer Posted February 28, 2015 Posted February 28, 2015 ok, so I commented out the TCPServer line, and ... IT WORKS! HOLY COW! :shocking: :thumbup: :cheer3nc: Thank you Ian!!! I tried two toggles together, AAP CDU power and EGI power. Both works. But I noticed the first time I flick both of them nothing happens. From second flick onwards then they respond. Or maybe it takes a few seconds to sync. Anyhow, they work, that's good enough for me. :smilewink: My A10C cockpit thread
FSFIan Posted February 28, 2015 Author Posted February 28, 2015 If your physical switch starts out in the opposite position from your virtual cockpit switch, the first flick will tell DCS-BIOS to switch the virtual switch to a position it is already in -- so there is no observable effect. DCS-BIOS | How to export CMSP, RWR, etc. through MonitorSetup.lua
rocketeer Posted February 28, 2015 Posted February 28, 2015 Ian, In the environment Control Panel, the temp/press switch seems to be a three pos toggle. But I see your code as: const byte envcpTempPressPins[21] = {PIN_0, PIN_1, PIN_2, PIN_3, PIN_4, PIN_5, PIN_6, PIN_7, PIN_8, PIN_9, PIN_10, PIN_11, PIN_12, PIN_13, PIN_14, PIN_15, PIN_16, PIN_17, PIN_18, PIN_19, PIN_20}; DcsBios::SwitchMultiPos envcpTempPress("ENVCP_TEMP_PRESS", envcpTempPressPins, 21); Not using a variable and so many pins. What should I do here? My A10C cockpit thread
Warhog Posted February 28, 2015 Posted February 28, 2015 Ian, In the environment Control Panel, the temp/press switch seems to be a three pos toggle. But I see your code as: const byte envcpTempPressPins[21] = {PIN_0, PIN_1, PIN_2, PIN_3, PIN_4, PIN_5, PIN_6, PIN_7, PIN_8, PIN_9, PIN_10, PIN_11, PIN_12, PIN_13, PIN_14, PIN_15, PIN_16, PIN_17, PIN_18, PIN_19, PIN_20}; DcsBios::SwitchMultiPos envcpTempPress("ENVCP_TEMP_PRESS", envcpTempPressPins, 21); Not using a variable and so many pins. What should I do here? For each action such as a volume control, Ian has provided several options for you to choose from such as a potentiometer, a rotary encoder...even a push button. All of these components could cause the volume to increase/decrease and then code to make that happen is also provided. If in fact the "DcsBios::SwitchMultiPos" was the choice that came up in the "simple" category, switch over to "advanced "and see what other options are available. I think you will find the normal selection for that switch type listed there. It's probably a typo in the app that lists that switch as a fiirst choice selection instead of an option. Regards John W aka WarHog. My Cockpit Build Pictures... My Arduino Sketches ... https://drive.google.com/drive/folders/1-Dc0Wd9C5l3uY-cPj1iQD3iAEHY6EuHg?usp=sharing WIN 10 Pro, i8-8700k @ 5.0ghz, ASUS Maximus x Code, 16GB Corsair Dominator Platinum Ram, AIO Water Cooler, M.2 512GB NVMe, 500gb SSD, EVGA GTX 1080 ti (11gb), Sony 65” 4K Display VPC MongoosT-50, TM Warthog Throttle, TRK IR 5.0, Slaw Viper Pedals
FSFIan Posted February 28, 2015 Author Posted February 28, 2015 Ian, In the environment Control Panel, the temp/press switch seems to be a three pos toggle. But I see your code as: const byte envcpTempPressPins[21] = {PIN_0, PIN_1, PIN_2, PIN_3, PIN_4, PIN_5, PIN_6, PIN_7, PIN_8, PIN_9, PIN_10, PIN_11, PIN_12, PIN_13, PIN_14, PIN_15, PIN_16, PIN_17, PIN_18, PIN_19, PIN_20}; DcsBios::SwitchMultiPos envcpTempPress("ENVCP_TEMP_PRESS", envcpTempPressPins, 21); Not using a variable and so many pins. What should I do here? You found a bug. Fixed and released together with some other minor improvements as v0.2.5. A-10C: add UHF and FM LEDs on the NMSP panel A-10C: export rotation of VHF radio wheels as 8-bit integers A-10C: fix ENVCP_TEMP_PRESS switch UH-1H: Fix description of ADF_GAIN DCS-BIOS | How to export CMSP, RWR, etc. through MonitorSetup.lua
rocketeer Posted March 1, 2015 Posted March 1, 2015 Ian, thanks for all your help so far. Which pins cannot be used? I see 0 and 1 TX and RX, likewise 14 to 19. Then 20 and 21 says SDA, SCL. Do I avoid all these pins? Then for the Analog pins, can they be used as digital as well? My A10C cockpit thread
FSFIan Posted March 1, 2015 Author Posted March 1, 2015 (edited) In general, you can use every pin you have and all analog pins can also be used for digital I/O. There are a few exceptions: Pins 0 and 1 (RXI, TXO) are already used for the serial connection to talk to the PC Pin 13 has the built-in LED connected to it. You can use it for an output (but don't draw the full 40 mA, as the built-in LED will consume some of that), but if you want to use it as an input, you will have to disconnect that LED by cutting the trace to avoid problems. On some Arduino boards that use the ATMega328 in a small surface-mount TQFP package, pins A6 and A7 can only be used for analog input (e.g. on the Arduino Pro Mini) SCL and SDA are the pins for the I2C bus. If you don't plan to use I2C (e.g. to communicate with an I2C character display), you can use them for regular I/O. Edited March 1, 2015 by [FSF]Ian DCS-BIOS | How to export CMSP, RWR, etc. through MonitorSetup.lua
rocketeer Posted March 4, 2015 Posted March 4, 2015 Thanks for the info about the pins. Do you know how the following switches are supposed to behave in the HARS panel? 1. the push to sync seems to be a push button to me. but the code says switch2pos. then in the game, when i press the push button, I see it goes down and up quickly. But it works only once. After that when i press the physical push button, it does not respond in the game. Using the mouse click does make it go down and up. I tested it with two other push buttons. Same thing. Once works the first time. 2. The HARS heading is a pot. but when I turn it, I expect it to rotate the dial in the game. Instead, I noticed that it goes down slowly, and up slowly when I rotate the pot! Either I have a totally wrong expectation or it's acting weird. Using the mouse scroll wheel makes it rotate. DCS BIOS is great. I'm now testing fourth panel. More time is spent doing the physical wiring and soldering, joining the common ground etc. and then testing the respond on the COM port DOS prompt window. The code is straightforward copy and paste most of the time without much confusion. I think this is much easier than using those interface cards and then figuring out the lua script for them. Much appreciated Ian for your work! My A10C cockpit thread
FSFIan Posted March 4, 2015 Author Posted March 4, 2015 The command numbers for the HARS_HDG and HARS_PTS controls were swapped, which led to the weird behavior you described. It's now fixed in the current master branch. BTW, if you encounter something similar again, first test with the interactive control reference documentation. If you can reproduce the error with that, you know that it's not a fault in your Arduino code or hardware :) The Switch2Pos class is used for both push buttons and toggle switches, because electrically and logically they look exactly the same -- the only difference is in the latching behavior of the mechanical construction. DCS-BIOS | How to export CMSP, RWR, etc. through MonitorSetup.lua
rocketeer Posted March 4, 2015 Posted March 4, 2015 wow thanks for your quick response. Let me try it out. thanks as usual! My A10C cockpit thread
rocketeer Posted March 4, 2015 Posted March 4, 2015 the interactive control reference still doesn't work for me, or I don't know how to use it properly, but now with the latest download, the two switches, ie. the pot and the push button work like a charm! :thumbup: Four panels done and counting! My A10C cockpit thread
FSFIan Posted March 4, 2015 Author Posted March 4, 2015 the interactive control reference still doesn't work for me Right, that's because you had to disable the TCPServer part of DCS-BIOS. One more thing you could try is to run the TCP server on a different port (if port 7778 is already in use by something else). In BIOSConfig.lua, specify the port for the TCPServer like this: BIOS.protocol_io.connections = { BIOS.protocol_io.DefaultMulticastSender:create(), --BIOS.protocol_io.TCPServer:create({ port = 10123 }), BIOS.protocol_io.UDPListener:create({ port = 7778 }) } If that works, you can change the port that the control reference docs tries to connect to in line 109 of doc/js/dcs-bios-connection.js. DCS-BIOS | How to export CMSP, RWR, etc. through MonitorSetup.lua
Thick8 Posted March 5, 2015 Posted March 5, 2015 (edited) I ordered 360 degree servos and they came in today. I hooked 1 up to the VVI because it's the fastest gauge on the panel. It was precise through the whole range of motion. I did yoyos for about 20 minutes just to watch it move. Very cool. Is there code in DCS-bios to run stepper motors for the compass and such? I know I'll have to come up with some sort of feed back system. I'm looking into 360 degree repeating potentiometers that I can mount on micro steppers. If I can put together the hardware will you add the control command to DCS-bios if it doesn't yet exist? Thanks, John Edited March 5, 2015 by Thick8 All of my posted work, ideas and contributions are licensed under the Creative Commons - Attribution-NonCommercial 4.0 International (CC BY-NC 4.0,) which precludes commercial use but encourages sharing and building on for non-commercial purposes, ©John Muldoon
FSFIan Posted March 5, 2015 Author Posted March 5, 2015 There is no support for stepper motors in the DCS-BIOS Arduino library. Using steppers is like using displays: you need to add another Arduino library that knows how to talk to your stepper motor and write a few lines of glue code. DCS-BIOS | How to export CMSP, RWR, etc. through MonitorSetup.lua
Thick8 Posted March 5, 2015 Posted March 5, 2015 Hi Ian, Thanks for the reply. I am a TOTAL Arduino NOOB. If you program wasn't basically cut and paste I wouldn't have even attempted to try to build my own gauges. So when you say ''glue code" I'm looking for my bottle of Elmer's. How would I do gauges like altitude, compass, HSI, etc. using your wonderful cut and paste method? All of my posted work, ideas and contributions are licensed under the Creative Commons - Attribution-NonCommercial 4.0 International (CC BY-NC 4.0,) which precludes commercial use but encourages sharing and building on for non-commercial purposes, ©John Muldoon
Thick8 Posted March 5, 2015 Posted March 5, 2015 I found this for position feedback http://www.usdigital.com/products/ma3#description Would I just use a continuous rotation servo for the motion part of it? All of my posted work, ideas and contributions are licensed under the Creative Commons - Attribution-NonCommercial 4.0 International (CC BY-NC 4.0,) which precludes commercial use but encourages sharing and building on for non-commercial purposes, ©John Muldoon
FSFIan Posted March 5, 2015 Author Posted March 5, 2015 How would I do gauges like altitude, compass, HSI, etc. using your wonderful cut and paste method? You won't. Maybe someone else will develop a separate Arduino library that makes it easy to use a specific type of stepper motor or continuous rotation servo with DCS-BIOS. The DCS-BIOS Arduino library does what I want it to do: it makes simple things simple (buttons, switches, LEDs) and complex things possible (by giving you the raw data to send to a display/stepper/whatever using a third-party Arduino library of your choice). The internals need an overhaul to make it more reliable when handling a lot of controls and I want to have a standard way of connecting multiple Arduinos over an RS-485 bus. After that, while I will continue to maintain DCS-BIOS and fix bugs in the A-10C and UH-1H export modules, I plan to focus my attention on building a DCS Witchcraft-powered mission. The target audience of DCS-BIOS (when used for powering physical panels) was always "people who can or are learning to program Arduino code". DCS-BIOS | How to export CMSP, RWR, etc. through MonitorSetup.lua
rocketeer Posted March 5, 2015 Posted March 5, 2015 I'm not sure if you guys have this experience. Pots seem to be rather inconsistent. Sometimes they don't work at all. Not sure if I'm doing something wrong. They used to work, but now each time I launch DCS, they'd turn just once and stop responding. I tried assigning to different dials in different panels. I tried different physical pots. All of them, physical pots, different analog pins, different assigned pots in the panels, just stop responding after the first turn. My A10C cockpit thread
FSFIan Posted March 5, 2015 Author Posted March 5, 2015 I haven't tested the potentiometer code much at all (only threw it in because the naive implementation was quick to do, tested it with a single pot without any other controls connected). The problem with the current approach is that even a slightly jittery pot will constantly send data, so it may make other controls unresponsive -- but the expected effect is that the pot itself should continue to react. Merging in this pull request may already improve things somewhat (I need to find time to prepare, test and release a new version of the Arduino library). If they used to work and there are problems now, the obvious question is: what has changed? Did you add more controls to your sketch? Did you update the Arduino library or DCS-BIOS? Does it work again after you reset the Arduino? DCS-BIOS | How to export CMSP, RWR, etc. through MonitorSetup.lua
rocketeer Posted March 6, 2015 Posted March 6, 2015 I've isolated everything-just one physical pot at a time, one line of code the rest commented out. tested the same physical pot on different analog pins, assigned to different panels. Also tried pinning to different ground pins, different physical pots. All same behavior, turning a bit then stop. maybe my arduino card has gone bad. i'd try with another card. My A10C cockpit thread
rocketeer Posted March 6, 2015 Posted March 6, 2015 Tried a new mega. Got the pot to respond. For a while! Then same thing. Quit game. Started game again. Respond for a while. Changing physical pots or pins or even arduino cards and still the pots seem to respond only for a while in the game. Even isolating all or switches and just having one pot and nothing else connected and code for all other switches commented out. If any of you managed to get pots working consistently without failing please share your two cents. I've wired and tested six panels so far. Toggles, push buttons, rotary switches are all fine, except pots. My A10C cockpit thread
Recommended Posts