Jump to content

Lowlyslows

Members
  • Posts

    96
  • Joined

  • Last visited

Posts posted by Lowlyslows

  1. 7 hours ago, Paladin71 said:

    For the #2 two digit screens, I was looking at some 2 digit 7 segment LCD's. I'm re-thinking that idea because they won't display alphabetic characters. For the top display #1, I was trying to find a 16 x 1 lcd, but unable to find one. my second choice was a 16 x 2 lcd. I haven't looked for the lcd's for the ones located at #3.

    I found the correct ones from tek creations for the ODU

  2. Hello,

     

    This used to work: 

     

    But due to an update on how the points are created in the F10 map and they belong to a particular unit, you can no longer do this. Would it be possible to add in a "Mark to Unit" feature of the mission editor? Not 100% sure this will fix this but regardless being able to setup a target list within the mission editor would be great. 

     

    OR create a way for mission designers to load pre planned targets for the harrier to use. 

  3. On 3/21/2023 at 2:26 PM, Boogie Mitchell said:

    I was saddened to hear about your experiences using the HUD only view. I've ordered my MIP and this was a HUGE consideration. Absolutely no need to see the units on screen if you have them in front of you. Really bummer ED doesn't implement an easy solution for this, considering the large home-pit types.

     

    Are you still having this issue with UFCs locking up in HUD-only view?

    How was your experience with the MIP?

  4. Hello,

    When I host a multiplayer server and we cold start F18s and follow the guidance from the deck crew to get attached to a catapult, the plane will get thrown into the air and trashed. This only happens to the guys that join my server, not me.

     

    If we start hot and are on the catapult from the start we can launch.

  5. added this to the Mods\aircraft\FA-18C\Input\FA-18C\joystick\default.lua just below line 840

    Now the switch turns on and off with a single command on/off toggle switch (single pole). Now I need to figure out how to make the command to be momentary and not hold the bind.

    --added 1 line below 03JAN23 
    {    down = tgp_commands.LtdrArm,                up = tgp_commands.LtdrArm,                        cockpit_device_id = devices.TGP_INTERFACE,        value_down =  1.0,    value_up = 0.0,    name = _('LTD/R Switch (special) - ON/OFF'),                    category = {_('Special For Joystick'), _('Right Console'), _('Sensor Panel')}},

  6. @No1sonuk Got the pro micro working. I thought it would help but not in this case and I think I figured out what is going on. BLUF: I need code that makes the switch act like a button press and release instead of a button press and hold.

     

    Issue is: I can only get the LTD switch to move to ARM. When I move the physical switch back from ARM to Safe, it stays at ARM. Also, I noticed something. When I use the physical switch to move the LTD game switch to ARM and then move the FLIR to STBY, the LTD electromagnet doesn't de-energize. If I use the keyboard and bind the ARM position to the S key, press the S key which moves the LTD game switch to ARM and release the S key, moving the FLIR switch to STBY will de-energize the LTD electromagnet. However, if I hold the S key down and then move the FLIR switch to STBY, the electromagnet stays energized. This leads me to believe that my physical switch is HOLDING the bind active and not allowing the logic to de-energize the electromagnet.

  7. 20 hours ago, No1sonuk said:

    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.

     

    ok, I added the code. If the right gen is OFF then the electromagnet doesn't energize. If the right gen is NORM (ON) then the electromagnet energizes when the LTD/R switch is moved up to ARM. The issue I am having now which is odd in 2 ways.

    1) When I turn the right gen off the electromagnet stays energized.

    2) If I shut the Main Battery OFF now with the below code, the electromagnet de-energizes. It doesn't do that with the original code, just since I added the above new code.

    Update 31DEC22: I swapped the generator code over to the LST switch. Works correctly. Why would the R Gen code work differently than the LST code? 

    #define DCSBIOS_IRQ_SERIAL
     
    #include "DcsBios.h"
     
    #define Coil 6    // Magnetic coil
    #define ltdsw 2
    #define flrsw1 5
    int rGenSwState = 0; // Right Generator Switch state for use in other routines
     
     
    DcsBios::Switch2Pos ltdRSw("LTD_R_SW", 2); //LTD ARM/SAFE
    DcsBios::Switch2Pos lstNflrSw("LST_NFLR_SW", 3); //LST ON/OFF
    DcsBios::Switch3Pos flirSw("FLIR_SW", 4, 5); //FLIR ON/STBY/OFF
     
    void setup() {
      DcsBios::setup();
      pinMode (Coil, OUTPUT);
     
    }
     
    void loop() {
      DcsBios::loop();  
       
    }
     
    //LTD Electromagnet Control
    void onLtdRSwChange(unsigned int altCoilValue) {
      switch (altCoilValue){
          case 0:
          digitalWrite(Coil, LOW);
          break;
          case 1:
          int swState = digitalRead(flrsw1);
          if (swState == HIGH){
          digitalWrite(Coil, LOW);}
          else if (rGenSwState == 0) {
          digitalWrite(Coil, LOW);
          }
          else {digitalWrite(Coil, HIGH);}
          break;
        }
     
     
    }
    DcsBios::IntegerBuffer ltdRSwBuffer(0x74c8, 0x4000, 14, onLtdRSwChange);
     
    void onRGenSwChange(unsigned int newValue) {
        rGenSwState = newValue;
    }
    DcsBios::IntegerBuffer rGenSwBuffer(0x74c4, 0x4000, 14, onRGenSwChange);
  8. 2 hours ago, No1sonuk said:

    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.

     

    Awesome! I’ll give it a shot tonight. 
     

    cheers

  9. Ok, so I went back to the basics. I don't fully understand why we were doing the code the way you suggested and that's because I am so new to coding. But I did learn a ton!

    I have figured out how to make the switch state of the FLIR switch drive when the LTD/R switch can power up the electromagnet. When the FLIR is ON and the LTD/R switch is moved to ARM the electromagnet energizes. When I moved either the  FLIR to STBY or the LTD/R switch to SAFE the electromagnet de-energizes. 

    Two Things:

    1) I still have no idea how to get the logic from the F18 module to drive this. The A10 with the same code I started with works just fine but the F18 doesn't for some reason. I am not any closer to figuring out how to get the LTD/R switch to move to SAFE after an auto lasing bombing run.

    2) How do I get the code to read the status of something. Example would be Right Generator Control Switch set to NORM (output integer 1) which would allow the LTD/R switch to energize the electromagnet.

    3) How would I tie that code into what I have that's working except for #1 above?

    Code below:

     

    #define DCSBIOS_IRQ_SERIAL
     
    #include "DcsBios.h"
     
    #define Coil 6    // Magnetic coil
    #define ltdsw 2
    #define flrsw1 4
     
     
    DcsBios::Switch2Pos ltdRSw("LTD_R_SW", 2); //LTD ARM/SAFE
    DcsBios::Switch2Pos lstNflrSw("LST_NFLR_SW", 3); //LST ON/OFF
    DcsBios::Switch3Pos flirSw("FLIR_SW", 4, 5); //FLIR ON/STBY/OFF
     
    void setup() {
      DcsBios::setup();
      pinMode (Coil, OUTPUT);
     
    }
     
    void loop() {
      DcsBios::loop();  
       
    }
     
    //LTD Electromagnet Control
    void onFlirSwChange(unsigned int altCoilValue) {
      switch (altCoilValue){
          case 0:
          digitalWrite(Coil, LOW);
          break;
          case 1:
          digitalWrite(Coil, LOW);
          break;
          case 2:
          int swState = digitalRead(ltdsw);
          if (swState == HIGH){
          digitalWrite(Coil, LOW);}
          else {digitalWrite(Coil, HIGH);}
          break;
        }
     
     
    }
    DcsBios::IntegerBuffer flirSwBuffer(0x74c8, 0x3000, 12, onFlirSwChange);

     

  10. 10 hours ago, No1sonuk said:

    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);

    Got the INPUT_PULLUP code to work which is awesome!

    I'm thinking that maybe the code should see the status of all the things that effect the switch. Question is, how do I pull the status of a switch to use within an if, if else, and else statement?

    For example, what is the status of the FLIR switch. If it's in the correct position (ON) then allow the electromagnet to energize when the physical LTD/R is moved to ARM. If the FLIR is in STBY or OFF then the electromagnet can't energize.

  11. 1 hour ago, No1sonuk said:

    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);

    I’ll try out your suggestions tonight!

     

    I was able to do some stuff this morning, see below.

     

    I was able to get the code to function with the modifications in the image. 
    #1 I created a standard switch circuit with 10 being the input which tells the code that the switch has moved
     
    #2 I still can't figure this one out so I "removed" it from the code. #define SWITCHPIN 3 always fails
     
    #3 I had to change the code from  
     
    int swState = digitalRead,SWITCHPIN; 
    to
    int swState = digitalRead(10);
     
    otherwise I couldn't get the switch to function due to it failing test.
     
    Behavior: The switch in the game moves correctly as it relates to switch position when I move the physical switch. However, the "trick" no longer works and when I set the FLIR to STBY the LTD remains on ARM due to the electromagnet staying energized.
     
     
     
  12. Ok, tried the other code. I think I am running into the same naming issue as before. 

    Questions:

    1) Is everything above line 17 correct to use this code (See image)?

    2) Line 19: the switch is wired to digital pin 2 on the board and the switch completes the circuit by going to GND. Is this correct per the suggested code? Line 19 has #define SWITCHPIN 3, not 2.

    3) Line 33: has the same name in it as line 19, SWITCHPIN. It's not passing the "test" if the names are the same. If I change the name on either line (19 or 33) then it passes the test but the switch doesn't move in the game.

     

    null

    image.png

  13. 6 hours ago, No1sonuk said:

    I forgot the names can't be the same.

    Change the LED one to ltdRSwCoil

    Ok, didn't realize I could change the name like that, and it makes sense that the error would pop because of it. Learning!

    The code works but I get exactly the same behavior using the LED code as the prior code. The game won't logically turn the physical electromagnet off if I set the physical LTD switch to ARM first. If I "trick" it by first setting the game LTD switch to ARM first and then setting the physical LTD switch to ARM, the game will logically de-energize the physical electromagnet.

    Going to attempt to get the other suggested code to function next!

  14. With the other suggested code, I am not sure how to implement it. I assume I still need a line to define the switch so line #7 needs to be there. I am not sure what to do with line 25,26, and 30 as no matter what I try I get errors.

     

    Sorry for my noobness. I am trying to learn this stuff.

     

    null

    image.png

  15. 27 minutes ago, No1sonuk said:

    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. 🤣

    When I run this code I get the attached error. Compilation error: conflicting declaration 'DcsBios::LED ltdRSw'

     

    What would cause this?

     

    Thanks for the help!

    null

    image.png

  16. 27 minutes ago, No1sonuk said:

    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.

    Where does this live in the code? Above void setup(), in void setup(), or in void loop()??

     

    Also, how do I tie that to a switch (physical switch)?

     

     

    #define DCSBIOS_IRQ_SERIAL
     
    #include "DcsBios.h"
     
    int Coil = 6;    // Magnetic coil on


     
    DcsBios::Switch2Pos ltdRSw("LTD_R_SW", 2); //LTD ARM/SAFE


     
    // LTD
    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);
     
    void setup() {
      DcsBios::setup();
      pinMode (Coil, OUTPUT);
     
    }
     
    void loop() {
      DcsBios::loop();
       
    }
  17. On 12/24/2022 at 12:18 PM, No1sonuk said:

    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);

    The electromagnet switch works as you suggest. It’s pretty cool. Yes it springs back to SAFE(off). I am using the Switch2pos code.

    I learned by accident that the switch will function properly (electromagnet de-energizes) if I first set the LTD game switch to ARM (this also energizes the physical electromagnet) and then set my physical switch to ARM. Then, if I set the FLIR to STBY (in the game) the physical electromagnet will turn off and release the physical switch back to SAFE.

     

    What would that one off code look like so I can test it? Sorry to ask but I’m still learning how to do basic code like turn on an LED.

     

    Thanks for the help! Hope you had a great Christmas!

  18. On 12/22/2022 at 8:11 PM, No1sonuk said:

    It should be Switch2Pos. Is that what the "simple" view on the control reference says?

    I put this code in the library F18 LUA on line 1112 (replace the code that's there with it): 

    defineToggleSwitchToggleOnly2("LTD_R_SW", 62, 3002, 441, "Sensor Panel", "LTD/R Switch, ARM/SAFE") 

    This solved the toggling issue, now I need to get the physical switch to de-energize the electromagnet with the FLIR is set to STBY or when an Auto Bombing run is finished.

    I have been working with these guys as well: F18 LTD/R 2position Switch Bugged · Issue #134 · DCSFlightpanels/dcs-bios (github.com)

  19. 7 hours ago, No1sonuk said:

    Hub is the version of DCS-BIOS.

    The other version a lot of people use is called the Flightpanels fork. 

    flightpanels bios worked! I am now having issues figuring out the coding that I need. How are you at coding? I am trying to get a SPST switch when turned off turns the LTD in the F18 to safe. Currently I have to move it twice to do so.

×
×
  • Create New...