0 votes
asked in ESP8266 OLED Starter Kit by (120 points)

I want to jump to a specific ui frame when a button is pressed. I have tried several approaches but all seem to wait until the normal frame transition is complete before moving to the selected frame. Here is one approach that does not work:

using an ESP32 with Arduino IDE:

void loop(){

unsigned int touchThreshold = 15;
unsigned int TVright = 0;  // right rear

 int remainingTimeBudget = ui.update();
 if (
remainingTimeBudget > 0) {

    int TVright = touchRead(rightPad) ;

    if ( TVright < touchThreshold ) {
      ui.disableAutoTransition();
      ui.switchToFrame(3);
      delay(5000);
      ui.enableAutoTransition();
   }
   delay( remainingTimeBudget );
  }

1 Answer

0 votes
answered by (2.7k points)
Isn't this because it's a hardware scroll of the display buffer so you have to wait for the current frame buffer to be displayed/shifted before the next (your selected) is displayed. You'd need to (probably stop the scroll) update the display buffer and then switch to the updated the display. A compromise is to update the frames-per-second maybe.
commented by (120 points)
I thought I was stopping the scroll with disableAutoTransition(). What do you suggest? switchToFrame() swaps in the previous rendered buffer. Why should I update it? About framers per second - should I raise the number, reduce the number, or set it to 0?
commented by (2.7k points)
Increasing the frame rate will speed up transitions the ESP8266 can go to about 30 fps, needs some experimentation, it looks like you have to wait for at least the current frame to complete before your transition takes place.

Welcome to ThingPulse Q&A, where you can ask questions and receive answers from other members of the community.

https://thingpulse.com

...