

No1sonuk
Members-
Posts
1595 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Everything posted by No1sonuk
-
I just looked at the Hub control ref - it has the [13] in it.
-
You could buy parts and build a bigger printer. Some models have extension/enlargement kits available.
-
Then that's why your LED is the lighting the wrong way round. DCS-BIOS assumes active high wiring for LEDs, but active low for switches (it uses the internal pullups). No idea on the pollinginput thing.
-
If that doesn't work (e.g. you're using Hub), you could try wiring the LED as "active low" (see attached image). The normal way to wire LEDs on the Arduino is the "active high" connection, where the LED is turned on when the pin turns on. However, the "active low" version would turn the LED on when the pin turns off.
-
I don't remember the code for interrogating a specific DCS parameter on demand without waiting for it to update. You could use the "onChange" code to set a global variable, then use that anywhere else in your code. e.g. Put this at the top under the defines: int rGenSwState = 0; // Right Generator Switch state for use in other routines That creates a global variable and defaults its value to 0. Then add this: void onRGenSwChange(unsigned int newValue) { rGenSwState = newValue; } DcsBios::IntegerBuffer rGenSwBuffer(0x74c4, 0x4000, 14, onRGenSwChange); That will change the rGenSwState variable's value to match the switch when it changes in DCS, and you can then use that in your other code routines to compare using if functions. You can access those "onChange" function descriptions in the control ref by switching to "advanced" view.
-
If you're using the latest version of the Flightpanels fork of DCS-BIOS, adding ",false" after the pin number should invert it. e.g. DcsBios::LED takeOffTrim(0x1026, 0x0400, PIN, false);
-
IIRC, the T/O trim LED should light when the button is pressed, after the trims have been reset. So if the trims were offset, the first time you press and hold the button, there'll be a pause while the trims move, then the light will come on. Release the button, and the light goes out. Press the button again, and the light should come on immediately as the trims are already reset.
-
There's a lot of conflicting info in this thread about which streaming software to use and how. What software and settings do you use with that setup?
-
WRT the magnet part: The LED code just simplifies what you wanted to do fornomal operation. There's possibly a way to use arduino code to synch everything, but I don't know what the bhaviouris supposed to be, so I can't write it for you. WRT the "other code": Change the number in line 19 to where your switch is. I messed up the digitalRead code... Change line 33 to int swState = digitalRead(SWITCHPIN); // Read the switch To tidy it up, move the constant and variable definitions (Lines 18-23) up to the beginning above line 8. You also might need to add this to the setup routine: pinMode (SWITCHPIN,INPUT_PULLUP);
-
No. You don't need line 7. You missed that there were parts at the top of the code I gave you that had those definitions. There wasn't just comments there: I copied and underscored the bits you missed. They were on separate lines from the // comments.
-
I forgot the names can't be the same. Change the LED one to ltdRSwCoil
-
Thanks. What about the software and settings? There's so much to and fro in this thread, I lost track of USB tethering, Wifi 6, USB 3.2, VD, SA, SteamVR, etc.
-
There's sometimes some synching needed. e.g. if I do cold/dark in the A-10C, I need to cycle the engine cutoff switches on the throttle before they'll work properly. IIRC, there is a way to use DCS-BIOS to specifically read memory locations (not just the normal on-change), but I don't remember how.
-
It goes in the loop. It's the basic command that all the other switch, pot, etc. library routines run to send the info to DCS, so you have to use it manually. i.e. // You should define constants that don't need to be changed by the code, such as pin numbers, like this so they don't consume program memory in the Arduino #define SWITCHPIN 3 // Use variables if the code needs to change the value. These use memory space in the device. int switchPrevState = 0; void loop() { DcsBios::loop(); readLTD_R_SW(); } void readLTD_R_SW(){ int swState = digitalRead,SWITCHPIN; // Read the switch if (swState != switchPrevState) { // Check if the value is different if (swState == 0) { sendDcsBiosMessage("LTD_R_SW", "0");} // If it's different and low, send "0" else {sendDcsBiosMessage("LTD_R_SW", "1");} // If it's different and high, send "1" switchPrevState = swState; // Change the previous state to the current value } } Now this particular example is a long way to do DcsBios::Switch2Pos ltdRSw("LTD_R_SW", SWITCHPIN); However, you might need to add conditions, or use multi-pin coded switches that the standard DCS-BIOS library doesn't account for. AND, in the case of the code I wrote, it won't send the message every time the loop is run unless the position has changed. Oh, and instead of this part: void onLtdRSwChange(unsigned int newCoilValue) { //Controls the output of pin 6 and turns on electromagnet switch (newCoilValue){ case 0: digitalWrite(Coil, LOW); break; case 1: digitalWrite(Coil, HIGH); break; } } DcsBios::IntegerBuffer ltdRSwBuffer(0x74c8, 0x4000, 14, onLtdRSwChange); Try this: DcsBios::LED ltdRSw(0x74c8, 0x4000, Coil); The long-hand way you used would be useful if you were going to reduce the magnet power to hold after the initial pull, but the LED code could probably be used for simple on/off. So to rewrite your original: #define DCSBIOS_IRQ_SERIAL #include "DcsBios.h" #define Coil 6 // Magnetic coil on pin DcsBios::Switch2Pos ltdRSw("LTD_R_SW", 2); //LTD ARM/SAFE // LTD hold magnet trigger DcsBios::LED ltdRSw(0x74c8, 0x4000, Coil); void setup() { DcsBios::setup(); pinMode (Coil, OUTPUT); } void loop() { DcsBios::loop(); } Also bear in mind that the "long-hand" way may use less program memory in the Arduino than the shorter DCS-BIOS commands. However, if this is a problem, it might be your device has too much to do anyway.
-
sendDcsBiosMessage(msg, argument); So: sendDcsBiosMessage("LTD_R_SW", "0") // This would send 0 to turn the switch off. sendDcsBiosMessage("LTD_R_SW", "1") // This would send 1 to turn the switch on.
-
How is this set up?
-
I don't have the F-18 to test it. What I don't quite understand, though, is why the address sequence is 100, 10000, 1000 and not 100, 1000, 10000.
-
The 1000ft count is at 0x74f8 on the control reference I have, which is within the range of addresses used by the standby altimeter. null
-
The way I'd do it is to use the switch to send a one-off siganl to DCS when you turn it on. Then, as separate code running in parallel, I'd have the switch position READ from DCS turn the magnet on or off. e.g. Assuming the switch is sprung to the off position: Read the physical switch position. If the switch is off, but was on, send OFF to DCS. If the switch is on, but was off, send ON to DCS. Read the switch position in DCS. If it's on, turn on the hold magnet. If it's off, turn off the hold magnet. The main issue, though, is that you need to make sure your magnet is strong enough to hold against the spring, but not so strong you can't overpower it to turn off the switch. You don't turn off the magnet to turn off the switch. You basically force it off and the electronics catches up. SendDcsBiosMessage could be used to send the switch position. If you use the standard Switch2Pos code line, the code gets read and switch position sent every loop, meaning DCS can't override it. This isn't normally a problem, but if you need feedback from DCS to affect the physical switch, you need to "disconnect" the switch from the game. The magnet part might be as simple as driving it from the LED code (switch the control reference view to "advanced" to get the other code lines): DcsBios::LED ltdRSw(0x74c8, 0x4000, PIN);
-
It should be Switch2Pos. Is that what the "simple" view on the control reference says?
-
Hub is the version of DCS-BIOS. The other version a lot of people use is called the Flightpanels fork.
-
You should have added that you're using Hub. It's important.
-
Yes. And no... It was "forked" from a version if DCS-BIOS earlier than Hub. As I understand it, it was originally made so that the Saitek flight panels could be used with DCS. The fork now consists of a version of DCS-BIOS as well as an additional app for the flight panels, and also the StreamDecks. You can use just the DCS-BIOS part if you want. Flightpanels is actively maintained, but Hub isn't.
-
I don't know about Hub, but the Flightpanels guys posted on their discord on the 17th that they're working on integrating the two in the same way as the A-10C and A-10C II are. I don't know if Hub is actively bugfixed at the moment. I know Flightpanels fork is actively maintained.
-
Three things: 1) Are you using the Hub or Flightpanels version of DCS-BIOS? 2) Have you tried the LST/NFLR switch code in case they're transposed? 3) For a magnetically held switch, you might need to use the "actionbutton" code for the switch, or even doing it longhand with "sendDcsbiosMessage". Then you can use the switch position read to turn the hold magnet on if DCS says the switch is on. I think that using "Switch2Pos" won't let DCS switch it off if the physical switch is on. I had such a problem with a Mosquito gear lever test.