Results 1 to 2 of 2
  1. #1
    New Member
    Join Date
    Mar 2016
    Location
    Australia
    Posts
    4
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Help with thrust reverse

    Hi

    Excuse me if this question has been asked and answered before, but I can't seem to find the solution for it.

    I'm trying to make a simple throttle quadrant using 4 potentiometer, 2 for each forward thrust and 2 for each reverser. The code is successful in inputting the value to link2fs (where negative is for reverse and positive is for forward), however I'm not entirely sure how to make it work with FSX. I've tried using the simconnect input setting AXIS_THROTTLE1_SET, but it doesn't work (it makes the throttle goes to around 50% throttle when the pot value is 0 or lower and 100% when the pot value is around 10000 or more). I also tried using THROTTLE1_SET and the forward thrust works flawlessly, but the reverser doesn't work (as it only takes value of 0-16383).

    Here is my code:
    Code:
    int CodeIn;// used on all serial reads
    //throttle control
    int sensorValue1 = 0;        
    int sensorValueOld1 = 55;
    long previousMillis = 0;    
    int sensorValueIn1 = 0;
    int sensorValue2 = 0;        
    int sensorValueOld2 = 55;      
    int sensorValueIn2 = 0;
    
    
    //throttle reverser control
    int sensorValue3 = 0;        
    int sensorValueOld3 = 55;
    int sensorValueIn3 = 0;
    int sensorValue4 = 0;        
    int sensorValueOld4 = 55;      
    int sensorValueIn4 = 0;
    
    
    int thrust1;
    int thrust2;
    
    
    
    
    void setup() {
       Serial.begin(115200);   
    }
    
    
    void loop(){
      throttle();
    }
    
    
    void throttle(){
      unsigned long currentMillis = millis();    // get processor running time in milli seconds
        if(currentMillis - previousMillis > 33) {  // check 33miliseconds has passed sinced last check(fiddle the 33 to suit)
        previousMillis = currentMillis; }
    
    
      for (int x=0;x<4;x++){                      // setup count of 5 for sampling increase for smoother averaging
        sensorValueIn1 = analogRead(A2);    // get sensor value input
        sensorValue1 = sensorValue1 + sensorValueIn1;
        sensorValueIn2 = analogRead(A3);    // get sensor value input
        sensorValue2 = sensorValue2 + sensorValueIn2;
        sensorValueIn3 = analogRead(A1);    // get sensor value input
        sensorValue3 = sensorValue3 + sensorValueIn3;
        sensorValueIn4 = analogRead(A4);    // get sensor value input
        sensorValue4 = sensorValue4 + sensorValueIn4;
        }
        
      sensorValue1 = sensorValue1/5;
      sensorValue3 = sensorValue3/5;
      if (((sensorValue1* 17)-500) <15750 || ((sensorValue1* 17)-500) >0) {(thrust1=((sensorValue1* 17)-500));}
      if (((sensorValue1* 17)-500) >=15750) {(thrust1 = 15750);}
      if (((sensorValue1* 17)-500) <=0 && (-1*(sensorValue3* 17)+1000) >=0) {(thrust1=0);}
      if (((sensorValue1* 17)-500) <=0 && (-1*(sensorValue3* 17)+1000) <0) {(thrust1=(-1*(sensorValue3* 17)+1000));}
      if (((sensorValue1* 17)-500) <=0 && (-1*(sensorValue3* 17)+1000) <=-15000) {(thrust1=-15000);}
    
    
      
      sensorValue2 = sensorValue2/5;
      sensorValue4 = sensorValue4/5;
      if (((sensorValue2* 17)-500) <15750 || ((sensorValue2* 17)-500) >0) {(thrust2=((sensorValue2* 17)-500));}
      if (((sensorValue2* 17)-500) >=15750) {(thrust2 = 15750);}
      if (((sensorValue2* 17)-500) <=0 && (-1*(sensorValue4* 17)+1000) >=0) {(thrust2=0);}
      if (((sensorValue2* 17)-500) <=0 && (-1*(sensorValue4* 17)+1000) <0) {(thrust2=(-1*(sensorValue4* 17)+1000));}
      if (((sensorValue2* 17)-500) <=0 && (-1*(sensorValue4* 17)+1000) <=-15000) {(thrust2=-15000);}
      
      if ((sensorValueOld1 > (thrust1 + 25)  ||  sensorValueOld1 < (thrust1 - 25))){       // is it different to last time? if yes do next lines
          Serial.print("Y08");
          Serial.println(thrust1);       // expans it to the correct range
        sensorValueOld1 = thrust1; 
      }
      
      if ((sensorValueOld2 > (thrust2 + 25)  ||  sensorValueOld2 < (thrust2 - 25))){       // is it different to last time? if yes do next lines
          Serial.print("Y09");
          Serial.println(thrust2);        // expans it to the correct range
        sensorValueOld2 = thrust2; 
      }
    }

    I've tested it on FSX Boeing 737 aircrafts, PMDG 777 aircrafts and PMDG 737 NG. All aircrafts behave similarly.

    Any help would be greatly appreciated
    Thanks

  2. #2
    New Member
    Join Date
    Mar 2016
    Location
    Australia
    Posts
    4
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Help with thrust reverse

    *bump*
    Anyone could help? Still trying to figure out this one