Jump to content
The simFlight Network Forums

VoltaCrew

new Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by VoltaCrew

  1. The encoding for this offset is Binary Coded Decimal which means you need to get the ToString() in hexadecimal, not decimal.

     

    If your transponder is showing 2406 then this offset will contain the value 9222. If you convert 9222 in to hexadecimal you get 0x2406 which is what you want.

     

    I've no idea why you are getting 4608. This is 0x1200. It might be that the aircraft you are testing on doesn't use the normal FSX transponder. Is it a 3rd party add-on? If so, try with a default FSX plane.

     

    This conversion should work:

    string Transponder = TransponderReq.Value.ToString("X4"); // X4 = Hex format padded to 4 characters
    

    Paul

     

    Working perfectly :D

     

    I was just worried by the Offset description and went in the wrong way, thanks !

  2. Hi!

     

    I have a problem with getting the Transponder code from FSX, my code looks actually like this :

    Offset<short> TransponderReq = new Offset<short>(0x0354);
    
    FSUIPCManager.ProcessFSUIPC(); //Processing FSUIPC
    
    double  Transponder2 = (double)TransponderReq.Value;
    string Transponder = Transponder2.ToString();
    
    

    And it returns "4608" for the transponder "2406".

    It not works with any different values.

     

    Thank you !

  3. Hi Noah,

     

    Error #15 means the FSUIPC memory file is full. The reason it's full is that you're declaring the offsets in the method body. Each time you run the method a new offset is declared. This will quickly fill up the FSUIPC memory file.

     

    All offsets should be declared only once during the lifetime of your program. The best way of doing this is to declare offsets at the class or form level.

     

    e.g.

    private Offset<long> altitudereq = new Offset<long>(0x0570);
    private Offset<short> FPMreq = new Offset<short>(0x0842);
    private Offset<double> headingreq = new Offset<double>(0x0580);
    private Offset<int> airspeedreq = new Offset<int>(0x02B8);
    
    public double getAltitude()
    {
    try { FSUIPCConnection.Process(); } catch (FSUIPCException ex) { }
    double altitude = (double)altitudereq.Value * 3.28084D / (65536D * 65536D);
    altitude = Math.Round(altitude);
    return altitude;
    } 
    
    public double getAirspeed()
    {
    try { FSUIPCConnection.Process(); } catch (FSUIPCException ex) { }
    double airspeed = (double)airspeedreq.Value / 128;
    airspeed = Math.Round(airspeed);
    return airspeed;
    }
     
    public double getHeading()
    {
    try { FSUIPCConnection.Process(); } catch (FSUIPCException ex) { }
    double heading = (double)headingreq.Value * 360 / (65536D * 65536D);
    heading = Math.Round(heading);
    return heading;
    }
    
    public double getFPM()
    {
    try { FSUIPCConnection.Process(); } catch (FSUIPCException ex) { }
    double FPM = (double)FPMreq.Value * 3.28084;
    FPM = Math.Round(FPM * -1);
    return FPM;
    }
    
    

    Paul

    Yes that was it, thank you so much :)

  4. Hello!

    I started using FSUIPC for developping and I feel stick about something which is annoying me since 3 hours.

    public double getAltitude()
            {
                Offset<long> altitudereq = new Offset<long>(0x0570);
                try { FSUIPCConnection.Process(); } catch (FSUIPCException ex) { }
                double altitude = (double)altitudereq.Value * 3.28084D / (65536D * 65536D);
                altitude = Math.Round(altitude);
                return altitude;
            }
    
            public double getAirspeed()
            {
                Offset<int> airspeedreq = new Offset<int>(0x02B8);
                try { FSUIPCConnection.Process(); } catch (FSUIPCException ex) { }
                double airspeed = (double)airspeedreq.Value / 128;
                airspeed = Math.Round(airspeed);
                return airspeed;
            }
    
            public double getHeading()
            {
                Offset<double> headingreq = new Offset<double>(0x0580);
                try { FSUIPCConnection.Process(); } catch (FSUIPCException ex) { }
                double heading = (double)headingreq.Value * 360 / (65536D * 65536D);
                heading = Math.Round(heading);
                return heading;
            }
            public double getFPM()
            {
                Offset<short> FPMreq = new Offset<short>(0x0842);
                try { FSUIPCConnection.Process(); } catch (FSUIPCException ex) { }
                double FPM = (double)FPMreq.Value * 3.28084;
                FPM = Math.Round(FPM * -1);
                return FPM;
            }
    

    I'm just getting an error 15 if I am removing the try/catch, and blank returns if I let them.

     

    All my code is working, but this part won't. FSUIPConnection.Open() works well too.

     

    Do somebody have an answer ?

    Noah

    (Sorry for the mistakes, I am not an english native speaker :/ )

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.