Adding TFT_eSPI breaks NeoPixel Task

After a few hours debugging and stripping back code, I’ve come across the weirdest issue I’ve ever seen.

As soon as I include #include <TFT_eSPI.h>into the file, the FreeRTOS task that is responsible for flashing the LEDs using the Adafruit_NeoPixel package stops executing as intended. The serial logging will mention that the LEDs are changing colour, but nothing physically happens on my desk. I don’t beleive it is a wiring issue.

I’m very new to the world of microprocessors, has anybody ever seen this happen before?

The full code (the display and GIF code is stripped out due to debugging) is supposed to do the following: When the door sensor state changes, the display wakes up, the lights flash and the sound plays. This happens until the door is closed again or until the elapsed time has passed.

I recently started using FreeRTOS as I was running into issues with running project components in parallel.

If anybody can shine some light on why this happens, and a potential solution I’d be very appreciative.

gist.githubusercontent.com/lewislarsen/e8928cc32a729316f419db93242c2bea/raw/58439393bc82fd365bdd16863bd3da95f1e48d10/code.ino

The first question to ask is that package designed to work with FreeRTOS, or is it designed for “bare metal” programming.

@afan - I bumped your forum privilege up a notch - see if you can post a link now.

I looked at your code and I have the following suggestions:

  1. The loop function is called from idle task hook and therefore, it must not block. Please remove the delay from the loop function.

     void loop() {
     unsigned long currentMillis = millis();
    
      if (currentMillis - lastLogTime >= LOG_INTERVAL) {
         logSystemStatus();
         lastLogTime = currentMillis;
      }
    
       if (systemState != ERROR) {
         checkPowerMode(currentMillis);
       }
     }
    
  2. Check the return value of FreeRTOS APIs (such as xQueueCreate, xTaskCreatePinnedToCore) to ensure that object creation is successful.

  3. Try increasing the delay in audioTask.