Ganeshka Posted November 10, 2017 Share Posted November 10, 2017 testing my new UFC and have problems with DcsBios::Switch3Pos ufcSel("UFC_SEL", PIN_A, PIN_B); and same on CSMP ... all other buttons on UFC and CMSP work perfect but when i try to use Switch3Pos value switching is not correct ,i press 1 time but in game it switch more , every time number is different sometime it go +2 , sometime more ... if i use same pin for other like MASTER CAUTION or ENT everythig is work fine . Can some one tell me why it wont work correctly ? :cry: Link to comment Share on other sites More sharing options...
FSFIan Posted November 11, 2017 Share Posted November 11, 2017 Your mechanical switch is likely bouncing. Right now there isn't a really good way to do proper per-control debouncing in the DCS-BIOS Arduino library, but here's a crude but effective way to do it for all inputs: add a call to delay() to your loop() function. I'd suggest starting with 10 milliseconds and increasing in steps of 5 ms until the behavior improves. void loop() { DcsBios::loop(); delay(10); } If you have a logic analyzer or an oscilloscope, you could also measure the duration of the bounce so you don't need to use trial and error to determine the delay. If you don't have a logic analyzer, I suggest typing the magic words "24Mhz 8Ch" into the search function of eBay or AliExpress and ordering a logic analyzer and some test clips. These work with the open-source sigrok software (http://sigrok.org). The clips are annoying to use on anything smaller than 0.1 inch pitch pins, and they might have issues with longer captures at the full 24 MHz, but they are still incredibly useful tools for debugging and learning about digital logic circuits and you can get one for about $10 :) DCS-BIOS | How to export CMSP, RWR, etc. through MonitorSetup.lua Link to comment Share on other sites More sharing options...
Hansolo Posted November 11, 2017 Share Posted November 11, 2017 Agree with Ian. In end of this short YT you can see the problem. 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...
Ganeshka Posted November 11, 2017 Author Share Posted November 11, 2017 thanks a lot ! with delay it is little bit better . But i decide to change this buttons on tactile 12x12 ... they show almost perfect result . Link to comment Share on other sites More sharing options...
Recommended Posts