Tekkx Posted August 13, 2015 Share Posted August 13, 2015 Hey agrasyuk. Nice to meet you. I think, I red already almost all of your posts. Your CDU-Project has been one of my inspirations. THX alot :) My problem is a special DCS-BIOS-question. My CDU was already working (as I wrote), I want just to reflash it with new, real life. I don't want (and can) to move a single srew nor solder anything. Take a short look at, If you want. http://forums.eagle.ru/showpost.php?p=2411684&postcount=3 The missing link is: How to bring my centipede to talk to DCS-BIOS or v.v.. I tried some (wellknown) ways, but the outcome is silence :( Is there a special(?) library additional to Centipede's? Manual for my version of RS485-Hardware, contact: tekkx@dresi.de Please do not PM me with DCS-BIOS-related questions. If the answer might also be useful to someone else, it belongs in a public thread where it can be discovered by everyone using the search function. Thank You. Link to comment Share on other sites More sharing options...
Tekkx Posted August 13, 2015 Share Posted August 13, 2015 (edited) ... and simultan another question: I searched the reference and can't find output-code ("...LED..." maybe) for Instrument- or Panel-Backlighting. So I could synchronize my CDU-Backlighting with other Instruments. This would be the only one DCS-BIOS-Output in this CDU-Project. Edited August 13, 2015 by Tekkx Manual for my version of RS485-Hardware, contact: tekkx@dresi.de Please do not PM me with DCS-BIOS-related questions. If the answer might also be useful to someone else, it belongs in a public thread where it can be discovered by everyone using the search function. Thank You. Link to comment Share on other sites More sharing options...
agrasyuk Posted August 13, 2015 Share Posted August 13, 2015 Phone glitched and I lost the long reply I wrote... To bummed to type up again, will type up my thoughts on driving backlighting when home. I did find a link to library on product page http://docs.macetech.com/doku.php/centipede_shield . seems very standard . is it not it? Anton. My pit build thread . Simple and cheap UFC project Link to comment Share on other sites More sharing options...
Hansolo Posted August 13, 2015 Share Posted August 13, 2015 Hi Anton, I did get the centipede library to work but that was back in the DCS-BIOS experimental version. I didn't get the centipede library to work straight out of the box with later version of DCS-BIOS but I seem to recall Ian saying that it should be a fairly simple. But my simple programming understanding did get me to get it to work though :-D cheers Hans 132nd Virtual Wing homepage & 132nd Virtual Wing YouTube channel My DCS-BIOS sketches & Cockpit Album Link to comment Share on other sites More sharing options...
FSFIan Posted August 14, 2015 Author Share Posted August 14, 2015 The missing link is: How to bring my centipede to talk to DCS-BIOS or v.v.. Take a look at the implementation of DcsBios::Switch2Pos, especially the pollInput() method which will be executed once every loop(). We use digitalRead to check the current button state, and if it has changed, we use sendDcsBiosMessage() to update the switch state in DCS. That is what you have to implement in your sketch, but instead of digitalRead(), you use whatever piece of code you need to read the pin state from your centipede shield. I searched the reference and can't find output-code ("...LED..." maybe) for Instrument- or Panel-Backlighting. The CDU backlight is controlled by the "Console Lights" rotary. In the "Advanced" view of the control reference, you can see that this control has an output. The code snippet is meant to be incorporated into your onDcsBiosWrite() method (future versions of the Arduino library will handle this in a more consistent way): void onDcsBiosWrite(unsigned int address, unsigned int value) { if (address == 0x1150) { unsigned int lcpConsoleValue = (value & 0xffff) >> 0; /* your code here */ } } The value will probably range from 0 to 65535. Translate that to a brightness (0..255) with map(), use analogWrite() to output it to a PWM-capable pin connected to the MOSFET that switches your LED backlight, and there you go. DCS-BIOS | How to export CMSP, RWR, etc. through MonitorSetup.lua Link to comment Share on other sites More sharing options...
Tekkx Posted August 14, 2015 Share Posted August 14, 2015 Hey Hans. Could you tell (to me and community), HOW you got centipede to work? Maybe Ian is right to say, "it should be fairly simple"... But his brain glows much brighter than mine ;) Edit: Uuups. Ian was more quick :) Manual for my version of RS485-Hardware, contact: tekkx@dresi.de Please do not PM me with DCS-BIOS-related questions. If the answer might also be useful to someone else, it belongs in a public thread where it can be discovered by everyone using the search function. Thank You. Link to comment Share on other sites More sharing options...
Tekkx Posted August 14, 2015 Share Posted August 14, 2015 but instead of digitalRead(), you use whatever piece of code you need to read the pin state from your centipede shield. So, if I think right, I have to create a new function ... I can't recite, how Centipede's pins to poll, but I wrote it somewhere at home. So I'll try tonight. Thank you. Manual for my version of RS485-Hardware, contact: tekkx@dresi.de Please do not PM me with DCS-BIOS-related questions. If the answer might also be useful to someone else, it belongs in a public thread where it can be discovered by everyone using the search function. Thank You. Link to comment Share on other sites More sharing options...
Hansolo Posted August 14, 2015 Share Posted August 14, 2015 (edited) Dear Tekkx, I should be home in a few hours. I will see if I can find the code :) Cheers Hans Edit. Arduino code attached. Did only work with DCS-BIOS in experimental versionMasterCaution_by_Ian_HMA_modded_CENTIPEDE_2014-12-25.rar Edited August 14, 2015 by Hansolo 132nd Virtual Wing homepage & 132nd Virtual Wing YouTube channel My DCS-BIOS sketches & Cockpit Album Link to comment Share on other sites More sharing options...
Tekkx Posted August 14, 2015 Share Posted August 14, 2015 (edited) Thank you, Hans. I found it. Even if it doesn't work so it could be a light to show the way :) Right now (before I found Your edit) I created a new class in DcsBios.cpp (sorry, Ian, for raping your code) void ButtonCS::init_(char* msg, char pin, bool reverse) { msg_ = msg; pin_ = pin; pinMode(pin_, INPUT_PULLUP); lastState_ = CS.digitalRead(pin_); reverse_ = reverse; } void ButtonCS::pollInput() { char state = CS.digitalRead(pin_); if (reverse_) state = !state; if (state != lastState_) { sendDcsBiosMessage(msg_, state == HIGH ? "0" : "1"); } lastState_ = state; } But it works not yet. While compiling comes this error: 'CS' was not declared in this scope lastState_ = CS.digitalRead(pin_); Due to lack of experiences (and knowledge) it'll take a while to debug. I suggest - if this of public interest - to open a new Thread. I did it: http://forums.eagle.ru/showpost.php?p=2452352&postcount=1 Edited August 15, 2015 by Tekkx added link Manual for my version of RS485-Hardware, contact: tekkx@dresi.de Please do not PM me with DCS-BIOS-related questions. If the answer might also be useful to someone else, it belongs in a public thread where it can be discovered by everyone using the search function. Thank You. Link to comment Share on other sites More sharing options...
FSFIan Posted August 14, 2015 Author Share Posted August 14, 2015 Your CS object is not declared in DcsBios.cpp. Start by putting the new class at the top of your Arduino sketch, right after the #include statements and the declaration of the CS object. Once you get it working, you can read up on how #include works, the difference between .cpp and .h files, and make the whole thing reuseable as a separate Arduino library. You probably want to call "CS.pinMode" instead of the normal "pinMode", too. DCS-BIOS | How to export CMSP, RWR, etc. through MonitorSetup.lua Link to comment Share on other sites More sharing options...
Wayan Posted August 15, 2015 Share Posted August 15, 2015 Hi Guys :) does anybody have a slight idea how to use a binary encoder? I used them for the 2 rotary knobs of the AAP and their output is binary. They have 4 outputs counting up e.g. 0000 - pos 1 0001 - pos 2 0010 - pos 3 0011 - pos 4 0100 - pos 5 and so on.... (only listing for the people who don't know what I mean) An added difficulty is that I am using only every 2nd step (they are 22.5 deg encoder, the steps on the AAP are 45 deg). I would guess there is no current implemented method and I have to prog it myself. Or does anybody know better? Greetings and a great evening Wayan Link to comment Share on other sites More sharing options...
FSFIan Posted August 15, 2015 Author Share Posted August 15, 2015 I would guess there is no current implemented method and I have to prog it myself. Correct. Start by reading through the code for the existing SwitchMultiPos class. You need to adapt the readState() method to something along these lines: // assume pins_ is an array of size 4 unsigned char switchPos = 0; unsigned char i; for (i=0; i<4; i++) switchPos |= (digitalRead(pins_[i]) << i); switchPos = switchPos / 2; // only using every second position // you could instead ignore the least significant bit in the first place and save a pin return switchPos; DCS-BIOS | How to export CMSP, RWR, etc. through MonitorSetup.lua Link to comment Share on other sites More sharing options...
metalnwood Posted August 18, 2015 Share Posted August 18, 2015 Ian;2445915']To those asking for a donation button: I am looking into it. But I live in Germany, and we love our bureaucracy! I just called our equivalent of the IRS to ask them some questions. It's pretty clear that for tax purposes, money I get through a donation button counts as income (in that it is not a tax-deductible donation), because (a) helping others hook up electronics to their flight sims does not count as charity and (b) it's an exchange of money vs. goods (DCS-BIOS), it does not matter that you can also choose to exchange no money for the same thing. What goes in paypal, stays in paypal... Dont transfer it to your bank account and pay for a few items with paypal, who will know... :music_whistling: Link to comment Share on other sites More sharing options...
FSFIan Posted August 20, 2015 Author Share Posted August 20, 2015 What goes in paypal, stays in paypal... Dont transfer it to your bank account and pay for a few items with paypal, who will know... :music_whistling: Why do something illegal if there is no disadvantage (other than a bit of paperwork) doing it legally? Also, if you apply for BAföG (student loans, only half of which you have to pay back later), confidentiality in banking does not apply, so the authorities have the right to look at my bank accounts if they suspect something (and PayPal is just another bank). From my perspective, I trade some paperwork for the ability to order from all of the big electronics distributors (who will only deliver to business customers in Germany). DCS-BIOS | How to export CMSP, RWR, etc. through MonitorSetup.lua Link to comment Share on other sites More sharing options...
Gadroc Posted August 23, 2015 Share Posted August 23, 2015 I've found a bug in the CMSP on/off/menu switches. I have not looked further but the same problem probably exists in all switches with a momentary position. If you look at the lines from the clickabledata.lua file here is how they defines the CMSP MWS switches (all four are identical in definition outside of button ids and text). elements["PNT-TMB-CMSP-MWS"] = { class = {class_type.TUMB, class_type.BTN}, hint = _("Missile Warning System (MWS). Left mouse - ON/OFF, Right mouse - MENU (No Function)"), device = devices.CMSP, action = {device_commands.Button_10, device_commands.Button_11}, stop_action = {0, device_commands.Button_11}, arg = {360, 360}, stop_value = {nil,0.1}, arg_value = {0.1, 0.2}, arg_lim = {{0, 0.1}, {0.1, 0.2}}, use_release_message = {false, false} } Notice that class is actually listing two classes not one. The switch (type TUMB) sends button 10 with values of 0.0 when entered and 0.1 when exited. While the momentary position sends Button 11 with 0.2 when entered and 0.1 when exited. Currently DCS-BIOS defines the same line this way defineTumb("CMSP_MWS", 4, 3010, 360, 0.1, {0.0, 0.2}, nil, false, "CMSP", "Missile Warning System OFF - ON - (MENU)") It only sends Button 10 with all three values 0.0, 0.1 and 0.2. On initial testing this will seem to work, but will lead to some very weird behaviors of the CMSP in real world use. I made the same mistake early on with Helios as well. I'm still trying to fully grok the DCS-BIOS code for a proper fix to this. Link to comment Share on other sites More sharing options...
Gadroc Posted August 23, 2015 Share Posted August 23, 2015 I have a suggestion for magnetically held switches. Currently magnetically held switch expose three inputs. { interface = "action", argument = "PUSH", description = "push and hold the switch in the ON position" }, { interface = "action", argument = "RELEASE", description = "release the switch" }, { interface = "action", argument = "OFF", description = "put the switch in the OFF position" } The separate PUSH/RELEASE are good for keyboard or button interactions, but if you have a real mag switch there is no trigger for the RELEASE. You can setup the device to send PUSH and RELEASE actions but that takes up valuable bandwidth with trying to manage 400+ inputs across the cockpit. I'd like to change it to the following: { interface = "action", argument = "PUSH", description = "push and release the switch from the ON position" }, { interface = "action", argument = "HOLD", description = "push and hold the switch in the ON position" }, { interface = "action", argument = "RELEASE", description = "release the switch from the ON position" }, { interface = "action", argument = "OFF", description = "put the switch in the OFF position" } This would allow setting up either a simulated or real switch with only one input definition in the arduino library. If people think it makes sense I'll submit a pull request for it. 1 Link to comment Share on other sites More sharing options...
Hansolo Posted August 24, 2015 Share Posted August 24, 2015 That would be awesome Gadroc if this would make for easier implementation of real mag switches :thumbup: Thanks a lot for your effort. Cheers Hans 132nd Virtual Wing homepage & 132nd Virtual Wing YouTube channel My DCS-BIOS sketches & Cockpit Album Link to comment Share on other sites More sharing options...
Warhog Posted August 24, 2015 Share Posted August 24, 2015 Why don't you setup a new thread for the mag switches so we can all comment and contribute to coming up with an easier solution than spending mega bucks to buy them. Anything related to the code should stay here. Does that sound like a reasonable approach? 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 Link to comment Share on other sites More sharing options...
Tekkx Posted August 24, 2015 Share Posted August 24, 2015 (edited) Right now I make a Rough and Ready solution with lighted buttons. The code will be just the same as Gadroc's new approach. It doesn't matter if a LED or a Magnetic Coil is fired. Difference is only needed Power. So maybe I'll be one of your (Gadroc) first Test Pilots :) Gadroc: Thank you so much for your efforts in DCS-BIOS and also HELIOS (I love it). Break a leg! Tekkx PS: I already opened a Thread for brainstorming DIY Magnetic Hold Switches. Edited August 25, 2015 by Tekkx Manual for my version of RS485-Hardware, contact: tekkx@dresi.de Please do not PM me with DCS-BIOS-related questions. If the answer might also be useful to someone else, it belongs in a public thread where it can be discovered by everyone using the search function. Thank You. Link to comment Share on other sites More sharing options...
FSFIan Posted August 24, 2015 Author Share Posted August 24, 2015 I'd like to change it to the following: { interface = "action", argument = "PUSH", description = "push and release the switch from the ON position" }, { interface = "action", argument = "HOLD", description = "push and hold the switch in the ON position" }, { interface = "action", argument = "RELEASE", description = "release the switch from the ON position" }, { interface = "action", argument = "OFF", description = "put the switch in the OFF position" } This would allow setting up either a simulated or real switch with only one input definition in the arduino library. If people think it makes sense I'll submit a pull request for it. I like it. I am not that worried about saving input bandwidth here (after all, the pilot only has two hands), but it does not hurt either. It also decreases implementation complexity on the Arduino side and does not add any significant complexity on the Lua side. DCS-BIOS | How to export CMSP, RWR, etc. through MonitorSetup.lua Link to comment Share on other sites More sharing options...
Gadroc Posted August 24, 2015 Share Posted August 24, 2015 Bandwidth is pretty important for RS-485 version that needs to poll 10-21 input boards. I've got it working well right now with timings of 3-5 polls per second, but that's with packet sizes of 31 bytes. The full text protocol is pretty heavy weight and separate push and release messages are over 31 bytes. I've bumped the packet size to 64 bytes, but that starts to eat a lot of memory on a 2k ram chip. It's bordering having to use my own serial routines to bypass their buffers, as dynamic memory space is getting really tight. Link to comment Share on other sites More sharing options...
hossamzayed Posted September 2, 2015 Share Posted September 2, 2015 Hi I'm trying to build a sim pit based on DCS , and I have read the DCS BIOS documentation , but couldn't quite understand how to get simple row data from DCS like pitch and roll. Below is a standard arduino DCS code. I just want to know what to write in the dotted space in front of the pitch and roll to get their values from DCS. Thank you #include <DcsBios.h> #include <Servo.h> DcsBios:: ProtocolParser parser; void setup() { Serial.begin(9600); } void loop() { // feed incoming data to the parser while (Serial.available()) { parser.processChar(Serial.read()); } double roll = ................... ; double pitch = ................... ; // poll inputs DcsBios:: PollingInput::pollInputs(); } void onDcsBiosWrite(unsigned int address, unsigned int value) { } Link to comment Share on other sites More sharing options...
hannibal Posted September 2, 2015 Share Posted September 2, 2015 im looking into making a airspeed gauge for all DCS aircraft... with arduino and DCS-BIOS, is this possible? i just started to watch youtube videos on arduino... find me on steam! username: Hannibal_A101A http://steamcommunity.com/profiles/76561197969447179 Link to comment Share on other sites More sharing options...
FSFIan Posted September 2, 2015 Author Share Posted September 2, 2015 Hi I'm trying to build a sim pit based on DCS , and I have read the DCS BIOS documentation , but couldn't quite understand how to get simple row data from DCS like pitch and roll. Below is a standard arduino DCS code. I just want to know what to write in the dotted space in front of the pitch and roll to get their values from DCS. Look at this thread, it's the same principle. Look up the value you want to display in the control reference documentation. DCS-BIOS does not export general pitch and bank info at this time, so you'd have to rely on the ADI (or submit a pull request that adds these to CommonData.lua). im looking into making a airspeed gauge for all DCS aircraft... with arduino and DCS-BIOS, is this possible? i just started to watch youtube videos on arduino... To make this work for all aircraft, you'd need to add airspeed to the CommonData export module. As mentioned above, pull requests are welcome (or remind me in a few months when my exams are over and I'll have moved into a new place). DCS-BIOS | How to export CMSP, RWR, etc. through MonitorSetup.lua Link to comment Share on other sites More sharing options...
hossamzayed Posted September 2, 2015 Share Posted September 2, 2015 (edited) Hi Ian , I have read what you said. And as I said I'm not a pro developer. So I went to few friends that could help me out with the matter. Unfortunatly no one could get the idea of how to make pitch and roll included in the general exported info. If someone who understands could help me out by adjusting the Lua file and give just the line of code arduino to read these 2 data ( pitch and roll ) I would really really apreciate that. Btw kindly find a link that documents my project on X-Plane platform where I succeded in exporting same data and syncronizing 2 motors with them. I just want to migrate my project to DCS http://forums.x-plane.org/index.php?showtopic=88536&st=0&p=944535#entry944535 Edited September 2, 2015 by hossamzayed Link to comment Share on other sites More sharing options...
Recommended Posts