ESP 43 inch Display slow

Hi I have a 43 Display. The program work correctly but very slow. Sometimes it take 6 seconds to output a command. I send commands to 3 esp32's via ESP-now.
What did I do wrong. I spent a lot of time trying to speed it up by removing functions but only make it worse. Can you please suggest a fix please.

Tagged:

Comments

  • Hello, here are some optimization suggestions:

    Modification suggestion 1:

    Replace the delay function with the FreeRTOS time function.

    void loop() {
    lv_timer_handler(); // Handle LVGL tasks
    vTaskDelay(5 / portTICK_PERIOD_MS); // Non-blocking delay
    sendDataToAll(); // Send data to all devices
    
    // Process the slider value and update the label
    updateSliders();
    }
    

    Modification suggestion 2:

    Reduce the frequency of reading the DHT22 sensor to avoid reading it in every loop.

    unsigned long lastDHTReadTime = 0;
    const unsigned long dhtInterval = 2000; // Read every 2 seconds
    
    void loop() {
    lv_timer_handler(); // Handle LVGL tasks
    vTaskDelay(5 / portTICK_PERIOD_MS); // Non-blocking delay
    
    // Read DHT22 sensor every 2 seconds
    if (millis() - lastDHTReadTime > dhtInterval) {
    temp = dht.readTemperature();
    humid = dht.readHumidity();
    lastDHTReadTime = millis();
    }
    
    sendDataToAll();
    updateSliders();
    }
    

    Hope these can help you.

Sign In or Register to comment.