diff --git a/lib/gui/src/mainScr.cpp b/lib/gui/src/mainScr.cpp index 422bba95..d688893d 100644 --- a/lib/gui/src/mainScr.cpp +++ b/lib/gui/src/mainScr.cpp @@ -183,10 +183,6 @@ void updateMainScreen(lv_timer_t *t) switch (activeTile) { case COMPASS: - #ifdef ENABLE_COMPASS - if (!waitScreenRefresh) - heading = getHeading(); - #endif lv_obj_send_event(compassHeading, LV_EVENT_VALUE_CHANGED, NULL); @@ -205,11 +201,6 @@ void updateMainScreen(lv_timer_t *t) break; case MAP: - // if (GPS.location.isUpdated()) - #ifdef ENABLE_COMPASS - if (!waitScreenRefresh) - heading = getHeading(); - #endif lv_obj_send_event(mapTile, LV_EVENT_REFRESH, NULL); break; diff --git a/lib/tasks/tasks.cpp b/lib/tasks/tasks.cpp index ff999b47..f49b5495 100644 --- a/lib/tasks/tasks.cpp +++ b/lib/tasks/tasks.cpp @@ -13,13 +13,13 @@ time_t local, utc = 0; TaskHandle_t LVGLTaskHandler; /** - * @brief Task1 - LVGL Task + * @brief LVGL Task * * @param pvParameters */ void lvglTask(void *pvParameters) { - log_v("Task1 - LVGL Task - running on core %d", xPortGetCoreID()); + log_v("LVGL Task - running on core %d", xPortGetCoreID()); log_v("Stack size: %d", uxTaskGetStackHighWaterMark(NULL)); while (1) { @@ -29,7 +29,7 @@ void lvglTask(void *pvParameters) } /** - * @brief Init Task1 LVGL Task + * @brief Init LVGL Task * */ void initLvglTask() @@ -39,15 +39,15 @@ void initLvglTask() } /** - * @brief Task 2 - Read GPS data + * @brief Read GPS data * * @param pvParameters */ void gpsTask(void *pvParameters) { - log_v("Task 2 - GPS Task - running on core %d", xPortGetCoreID()); + log_v("GPS Task - running on core %d", xPortGetCoreID()); log_v("Stack size: %d", uxTaskGetStackHighWaterMark(NULL)); - for (;;) + while (1) { while (gps->available() > 0) { @@ -81,7 +81,7 @@ void gpsTask(void *pvParameters) } /** - * @brief Init Task 2 GPS task + * @brief Init GPS task * */ void initGpsTask() @@ -90,14 +90,54 @@ void initGpsTask() delay(500); } +/** + * @brief CLI task + * + * @param param + */ #ifndef DISABLE_CLI -void cliTask(void *param) { - for (;;) { +void cliTask(void *param) +{ + while(1) + { wcli.loop(); vTaskDelay(60 / portTICK_PERIOD_MS); } vTaskDelete(NULL); } +/** + * @brief Init CLI task + * + */ void initCLITask() { xTaskCreatePinnedToCore(cliTask, "cliTask ", 4000, NULL, 1, NULL, 1); } + +#endif + +#ifdef ENABLE_COMPASS +/** + * @brief Read Compass data task + * + * @param pvParameters + */ +void compassTask(void *pvParameters) +{ + log_v("Compass Task - running on core %d", xPortGetCoreID()); + log_v("Stack size: %d", uxTaskGetStackHighWaterMark(NULL)); + while (1) + { + heading = getHeading(); + vTaskDelay(200); + } +} + +/** + * @brief Init Compass data task + * + */ +void initCompassTask() +{ + xTaskCreatePinnedToCore(compassTask, PSTR("Compass Task"), 8192, NULL,tskIDLE_PRIORITY , NULL, 1); + delay(500); +} #endif diff --git a/lib/tasks/tasks.hpp b/lib/tasks/tasks.hpp index 7325a194..0a4f57aa 100644 --- a/lib/tasks/tasks.hpp +++ b/lib/tasks/tasks.hpp @@ -39,5 +39,7 @@ void initLvglTask(); void gpsTask(void *pvParameters); void initGpsTask(); void initCLITask(); +void compassTask(void *pvParameters); +void initCompassTask(); #endif diff --git a/platformio.ini b/platformio.ini index 24f4a3fa..5ade62d4 100644 --- a/platformio.ini +++ b/platformio.ini @@ -24,7 +24,7 @@ monitor_filters = esp32_exception_decoder extra_scripts = pre:prebuild.py build_flags = - -D CORE_DEBUG_LEVEL=0 + -D CORE_DEBUG_LEVEL=5 -D USE_LINE_BUFFER=1 -D DISABLE_RADIO=1 -D BAUDRATE=115200 diff --git a/src/main.cpp b/src/main.cpp index a1aafe19..47533c24 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -90,6 +90,7 @@ void setup() lv_screen_load(searchSatScreen); #endif initLvglTask(); + initCompassTask(); #ifndef DISABLE_CLI initCLI();