mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-24 19:56:44 +00:00
Add guiTask
This commit is contained in:
parent
c5db446925
commit
f9fd78bcce
@ -3,11 +3,11 @@
|
|||||||
|
|
||||||
#if !(defined(WINDOWS) || defined(POSIX))
|
#if !(defined(WINDOWS) || defined(POSIX))
|
||||||
|
|
||||||
|
#include "Arduino.h"
|
||||||
#include "hasplib.h"
|
#include "hasplib.h"
|
||||||
#include "hasp_oobe.h"
|
#include "hasp_oobe.h"
|
||||||
#include "sys/net/hasp_network.h"
|
#include "sys/net/hasp_network.h"
|
||||||
#include "dev/device.h"
|
#include "dev/device.h"
|
||||||
// #include "drv/old/hasp_drv_touch.h"
|
|
||||||
#include "ArduinoLog.h"
|
#include "ArduinoLog.h"
|
||||||
|
|
||||||
#if HASP_USE_CONFIG > 0
|
#if HASP_USE_CONFIG > 0
|
||||||
@ -28,6 +28,40 @@ unsigned long mainLastLoopTime = 0;
|
|||||||
uint8_t statLoopCounter = 0; // measures the average looptime
|
uint8_t statLoopCounter = 0; // measures the average looptime
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
|
SemaphoreHandle_t xSemaphore_lvgl = NULL;
|
||||||
|
|
||||||
|
void guiTask(void* parameter)
|
||||||
|
{
|
||||||
|
xSemaphoreTake(xSemaphore_lvgl, portMAX_DELAY);
|
||||||
|
guiSetup();
|
||||||
|
|
||||||
|
#if HASP_USE_CONFIG > 0
|
||||||
|
if(!oobeSetup())
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
xSemaphoreGive(xSemaphore_lvgl); // oobeSetup not running
|
||||||
|
haspSetup();
|
||||||
|
} else {
|
||||||
|
xSemaphoreGive(xSemaphore_lvgl); // oobeSetup complete
|
||||||
|
}
|
||||||
|
|
||||||
|
for(;;) {
|
||||||
|
if(xSemaphoreTake(xSemaphore_lvgl, 0) == pdTRUE) {
|
||||||
|
lv_task_handler(); // process animations
|
||||||
|
xSemaphoreGive(xSemaphore_lvgl);
|
||||||
|
vTaskDelay(2 / portTICK_PERIOD_MS);
|
||||||
|
} else {
|
||||||
|
vTaskDelay(1 / portTICK_PERIOD_MS);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if TOUCH_DRIVER == 911
|
||||||
|
guiLoop(); // update 911 Touch Driver
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
// hal_setup();
|
// hal_setup();
|
||||||
@ -57,14 +91,19 @@ void setup()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
dispatchSetup(); // before hasp and oobe, asap after logging starts
|
dispatchSetup(); // before hasp and oobe, asap after logging starts
|
||||||
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
|
xSemaphore_lvgl = xSemaphoreCreateMutex();
|
||||||
|
xTaskCreatePinnedToCore(guiTask, "guiTask", 4096, (void*)1, 1, NULL, 0);
|
||||||
|
#else
|
||||||
guiSetup();
|
guiSetup();
|
||||||
|
|
||||||
#if HASP_USE_CONFIG > 0
|
#if HASP_USE_CONFIG > 0
|
||||||
if(!oobeSetup())
|
if(!oobeSetup())
|
||||||
#endif
|
#endif // HASP_USE_CONFIG
|
||||||
{
|
{
|
||||||
haspSetup();
|
haspSetup();
|
||||||
}
|
}
|
||||||
|
#endif // ARDUINO_ARCH_ESP32
|
||||||
|
|
||||||
/****************************
|
/****************************
|
||||||
* Apply User Configuration
|
* Apply User Configuration
|
||||||
@ -113,8 +152,10 @@ void setup()
|
|||||||
|
|
||||||
IRAM_ATTR void loop()
|
IRAM_ATTR void loop()
|
||||||
{
|
{
|
||||||
|
#ifndef ARDUINO_ARCH_ESP32
|
||||||
guiLoop();
|
guiLoop();
|
||||||
// haspLoop();
|
// haspLoop();
|
||||||
|
#endif
|
||||||
|
|
||||||
networkLoop();
|
networkLoop();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user