Jump to content

Gradist

Members
  • Posts

    10
  • Joined

  • Last visited

Everything posted by Gradist

  1. Well that is what I was trying to figure out. No1Sonuk gave a good hardware based solution but I'd love to learn the concept behind this too. I can see how you can set that global variable, just put it in the "Your Code Here" section. But how would you use it? The code that bulls the data isn't in the loop function, it's up at the beginning. Can you use if/then statements there? Seems like I tried it and it didn't work
  2. Thank you, this helped things finally click... so "newValue" is whatever the value that DCS-BIOS is reporting, the number that you can see on the webpage.. I had it in my head that it was the output value of the function which made no sense. I tried the switch idea and it works great, but I'm glad I got the more complete answer so I understand the code part. Thanks again!
  3. Thank you for responding. I was able to find the examples with the "Your code here" but I don't really understand what I can put in there. Is it the code equivalent of the LED coming on? Meaning that whatever code you put in there will run when the state changes? I noticed the name makes it sound like it would run when it changes meaning turn on or off. Is there a way to distinguish which direction or more generally what kind of change? Let me explain a little more about what I am trying to do with the Viggen and that may help. AFK mode is basically an auto throttle for landing, it will physically move the throttle to stay at a proper airspeed for the landing mode selected elsewhere. The typical flow is: Turning AFK Mode ON Mouse Click or use mapped button to lower AFK lever The lever moves down in the cockpit, makes a clicking sound When it is all he way down (about a second) a cockpit light illuminates indicating it is enabled The autopilot takes control of moving the throttle to maintain landing speed. Turning AFK Mode OFF Mouse Click or use mapped button to raise AFK lever The lever moves UP in the cockpit, makes a clicking sound Cockpit light goes out as soon as the lever starts going up The autopilot stops moving the throttle From the code in the OP: DcsBios::Switch2Pos afkLever("AFK_LEVER", 4); The code above is for pin 4 which would be connected to a contact switch that would close when the physical AFK lever is lowered to turn that mode on when desired. When that mode is on a the cockpit light turns on which is picked up by this code which then turns on an LED connected to pin 5 per this code: DcsBios::LED afkLight(0x460e, 0x0400, 5); Independent of all that, this code operates a servo that moves in relation to actual throttle position with the servo being operated by pin 3 DcsBios::ServoOutput throttle(0x4628,3, 544, 2400); I am hoping to use the servo to move the physical throttle but the default behavior is for the servo to always move along with the throttle. I am trying to find some way to disable the servo in normal flight operations so I need to make the servo movement conditional on the AFK mode being on which would be when the pin 4 switch is closed or the LED from pin 5 is is on. (Both of those should always be true at the same time) So if I could use those statements about something like this: if(DcsBios::LED afkLight(0x460e, 0x0400, 5) == on) { DcsBios::ServoOutput throttle(0x4628,3, 544, 2400);} or in simpler terms: if (AFK Light is on) then operate servo That clearly doesn't work but I am assuming there is something correct to fill that in and get the desired result. Thanks again
  4. Normally I can search and find the answer pretty well but I'm having trouble finding a clear answer to this. It might just be because I'm new to most of this. I am trying to understand how to use the data from DCS-BIOS in my own code. I have been able to figure out how to get buttons, LED, servo's, etc. to work along with coding in general but I'm stuck. If it helps the current thing I'm trying to figure out is for the Viggen. I've figured out how to toggle the AFK handle, Turn on an LED when it's down, and even have a servo move along with the throttle. (code below) But there are two things I want to add. I want the servo to only move if the AFK lever is down, which is the only time it would move the throttle and it would be nice to add a little bit of delay so that the AFK light comes on when the cockpit light comes on. It seems like there isn't a way to use the actual light, you have to use the AFK handle status which is a little off. My main goal though is to understand the general concept. From the things I've found it seems like there is something with newVal and the map function but I'm missing something. #define DCSBIOS_IRQ_SERIAL #include <Servo.h> #include "DcsBios.h" DcsBios::Switch2Pos afkLever("AFK_LEVER", 4); DcsBios::LED afkLight(0x460e, 0x0400, 5); // Had to rename this one to afkLight to avoid duplicate declaration error DcsBios::ServoOutput throttle(0x4628,3, 544, 2400); void setup() { DcsBios::setup(); } void loop() { DcsBios::loop(); if(pinst) }
  5. Majinbot had a better match for the afterburner but this was still a good idea, it made me think of sonic booms as well so thanks :)
  6. Thank you, I was able to get this to work well when DCS cooperates anyway. Sometimes it matches the throttle position perfectly sometimes it doesn't seem to want to recognize it but that still works for me as I was just wanting to add the risk of somebody spotting the burner trail
  7. I guess I didn't think it would matter but F/A-18
  8. Gotcha, that makes sense. Thanks :)
  9. I'm working on a night mission and I'd like to include a risk of being spotted and ID as a military aircraft if afterburner is used. I've been searching but I can't seem to find a way to find out if afterburner is engaged or not, can anybody help? BTW, this is for the player's aircraft
  10. I've been struggling with carrier landings and I noticed one of the LSO notes is Not Enough Right Rudder. I am assuming if there is jargon for it, then it's a thing but I don't usually use much rudder... so the natural question is, what is the proper use of right rudder and how much is enough?
×
×
  • Create New...