0 votes
in ESP8266 OLED Starter Kit by (150 points)
Hello,

 I've been successfully running the OLED SSD1306 library on my ESP32 project.  Due to the timing of the main loop() on CORE1, I'd like to move the code that updates the OLED display to CORE0. (I'm only sending text updates to the display).  If I leave it running in CORE1, it slows down the timing of my code on CORE1 every time it updates the display.  

But if I use xTaskCreatePinnedToCore to create a process that runs on CORE0, updating the OLED no longer interrupts the main loop timing, but the OLED displays mostly garbage.

Can anyone suggest how to get the OLED library to properly update the display when pinned to CORE0?  I'm using the Arduino IDE.

Thank you,

-Hank
by (150 points)
Hello,

 I searched all over for help before posting, but I never found that thread. Thank you!
 I saw in that thread that someone suggested re-initializing the display in CORE0 (not the main loop() core), and that did the trick.

 I set up a boolean to track if the OLED had been initialized in the CORE0 loop, and only initialize it the first time, otherwise, just send the data normally.

code (called from CORE0):
volatile boolean OLEDinit=false;
if (!OLEDinit) {
    display.init();
    display.flipScreenVertically();
    OLEDinit=true;
}

And it works like a charm!

1 Answer

0 votes
by (16.4k points)
 
Best answer
Solved by pointing to GH

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

https://thingpulse.com

...