Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: FlightSimControls proper detection of connect/disconnect to XpLane

  1. #1

    FlightSimControls proper detection of connect/disconnect to XpLane

    I am doing my first attempts to use FlightSimControls.

    At first , I was using a single FlightSim.update() at the beginning of loop().
    Worked so far in case XPlane is already running.

    But the typical situation is, that my Teensy Board is already running for a while until XPlane comes up and the communication may start.

    As the the next attempt, I tried this code which does not work:

    Code:
    void loop() {
      bool FSactive=false;
      
      // put your main code here, to run repeatedly:
      FlightSim.update();
      delay(400);
      Serial.println("After initial FlightSim.update()");
    
      while(1)
      {
        if ((FlightSim.isEnabled()==true) && (FSactive==false))
        {
          Serial.println("Xplaen is ONLINE now");
          FSactive=true;
          FlightSim.update();
          delay(500);
          updateGearLEDs();
          
        }
    
        if((FlightSim.isEnabled()==false) && (FSactive==true))
        {
          FSactive=false;
          Serial.println("XPlane now OFFLINE");
        }
    
        if((FlightSim.isEnabled()==false) && (FSactive==false))
        {
          FSactive=false;
          Serial.println("XPlane now OFFLINE");
        }
       } //while
    }
    Is there a reliable method to detect whether XPlane is running or not and/or initiate a reconnect in case the connection is lost?

  2. #2
    Junior Member
    Join Date
    Mar 2020
    Location
    Southampton UK
    Posts
    7
    Hi, did you resolve this and if so could you post the solution, thanks Bob

  3. #3
    No real progress. It works with some problems-

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •