Results 1 to 2 of 2
  1. #1
    25+ Posting Member
    Join Date
    Dec 2010
    Location
    Canada
    Posts
    26
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    How to switch between signals displayed on LCD- having trouble

    I wasn't sure if I should stick this in my existing pressure panel post- but figured it should be on its own in case it helps others someday. I spent 5 hours last night trying to get this thing to work with zero luck.

    Basically what I have is 3 values displayed on the LCD during normal operation. What I need is the display to switch over to another screen showing Landing Altitude when the encoder is moved. This works somewhat in the code below- but takes a few seconds to change the display after starting to roll the encoder- then it does not show any changing values when rolling- then waits again a few seconds- shows the updated number and waits again a few seconds before reverting to my normal screen with the 3 data points.

    Does anyone have any idea why this would be? Its odd because the serialprint for the landing alt works perfect in the monitor- it is super fast and responsive- just the display doesn't update/change in the encoders section.

    Code:
    /
      
      void ENCODER(){
      R =(quad1.position()/1); //The /2 is to suit the encoder(See my website)
      if (R != Rold) { // checks to see if it different
        (Rdif = (R-Rold));// finds out the difference
       if (Rdif == 1) (la= (landalt++)*25);  //updates landing alt by multiples- change this if user likes a different interval
       //Serial.println ("A01");//Com1 Mhz down
       if (Rdif == -1) (la= (landalt--)*25);    //updates landing alt by multiples- change this if user likes a different interval
       //Serial.println ("A02"); //Com1 Mhz up
       Serial.println (la);
       
    // Fix this section!------------------------------------------------------------------------   
     display.clearDisplay();   // clears the screen and buffer
     display.setCursor(0,0);
     display.setTextSize(2);  // Set text size
     display.println ("   ");
     display.println (la);
     display.println ("   ");
    // Fix this section!------------------------------------------------------------------------    
       
    la=landalt; // overwrites the old reading with the new one EG
    Rold = R; // overwrites the old reading with the new one.
    
    
    
    
      
     // R2 =(quad2.position());
    //  if (R2 != Rold2) {
     //   (Rdif2 = (R2-Rold2));
     //   if (Rdif2 == 1) Serial.println ("A03"); // Com1 Khz down
     //   if (Rdif2 == -1) Serial.println ("A04");//Com1 Khz up
    //    Rold2 = R2;
    //  }
    //  R3 =(quad3.position());
    //  if (R3 != Rold3) {
     //   (Rdif3 = (R3-Rold3));
     //   if (Rdif3 == 1) Serial.println ("A55"); // VOR bug down
     //   if (Rdif3 == -1) Serial.println ("A56"); //VOR bug up
     //   Rold3 = R3;
      //}
      }
    }

  2. #2
    25+ Posting Member
    Join Date
    Dec 2010
    Location
    Canada
    Posts
    26
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: How to switch between signals displayed on LCD- having trouble

    OMG- Man I should have just walked away sooner. After I posted this I actually went back and watched a couple Youtube videos which I saw a reminder of how display.display works (writes the buffer to the LCD). *sigh* I was simply missing this in the encoder section.

    Rookie mistake

    Thanks to all you guys for all your hard work!