From 76c9036c96bc157046c3512e3c007a962596e38e Mon Sep 17 00:00:00 2001 From: Jeremy Date: Tue, 26 Sep 2023 17:07:33 -0400 Subject: [PATCH 1/2] Reduce ui priority --- UOSM-Dashboard/Core/Tasks/InternalCommsTask.c | 6 +-- UOSM-Dashboard/Core/Tasks/LVGLTimerTask.c | 39 ++++++++----------- 2 files changed, 19 insertions(+), 26 deletions(-) diff --git a/UOSM-Dashboard/Core/Tasks/InternalCommsTask.c b/UOSM-Dashboard/Core/Tasks/InternalCommsTask.c index 36485e7..8e7cae9 100644 --- a/UOSM-Dashboard/Core/Tasks/InternalCommsTask.c +++ b/UOSM-Dashboard/Core/Tasks/InternalCommsTask.c @@ -12,8 +12,8 @@ #include "CANCallbacks.h" -#define STACK_SIZE 1024*4 -#define INTERNAL_COMMS_TASK_PRIORITY (osPriority_t) osPriorityNormal +#define STACK_SIZE (1024*4) +#define INTERNAL_COMMS_TASK_PRIORITY (osPriority_t) osPriorityHigh #define TIMER_INTERNAL_COMMS_TASK 200UL const char ICT_TAG[] = "#ICT:"; @@ -39,7 +39,5 @@ PRIVATE void InternalCommsTask(void* argument) { osDelayUntil(cycleTick); IComms_PeriodicReceive(); - - CAN_Dummy_RPM(cycleTick % 3000); } } diff --git a/UOSM-Dashboard/Core/Tasks/LVGLTimerTask.c b/UOSM-Dashboard/Core/Tasks/LVGLTimerTask.c index c681b29..9429fda 100644 --- a/UOSM-Dashboard/Core/Tasks/LVGLTimerTask.c +++ b/UOSM-Dashboard/Core/Tasks/LVGLTimerTask.c @@ -10,38 +10,33 @@ #include "LVGLTimerTask.h" #include "lvgl/lvgl.h" -#define STACK_SIZE 1024*9 -#define LVGL_TIMER_TASK_PRIORITY (osPriority_t) osPriorityHigh +#define STACK_SIZE (1024*3) +#define LVGL_TIMER_TASK_PRIORITY (osPriority_t) osPriorityNormal #define TIMER_LVGL_TIMER_TASK 10UL const char LVGL_TIMER_TAG[] = "#LVGL_TIM:"; osThreadId_t LVGLTimerTaskHandle; const osThreadAttr_t LVGLTimerTask_attributes = { - .name = "LVGLTimerTask", - .stack_size = STACK_SIZE, - .priority = LVGL_TIMER_TASK_PRIORITY, + .name = "LVGLTimerTask", + .stack_size = STACK_SIZE, + .priority = LVGL_TIMER_TASK_PRIORITY, }; static DataAggregatorWrapper* wrapper; -PUBLIC void InitLVGLTimerTask(DataAggregatorWrapper* w) -{ +PUBLIC void InitLVGLTimerTask(DataAggregatorWrapper* w) { wrapper = w; - LVGLTimerTaskHandle = osThreadNew(LVGLTimerTask, NULL, &LVGLTimerTask_attributes); + LVGLTimerTaskHandle = osThreadNew(LVGLTimerTask, NULL, &LVGLTimerTask_attributes); } -PRIVATE void LVGLTimerTask(void *argument) -{ - uint32_t cycleTick = osKernelGetTickCount(); - DebugPrint("%s LVLG Timer Task", LVGL_TIMER_TAG); - for(;;) - { - DebugPrint("%s Executing Timer Task", LVGL_TIMER_TAG); - lv_timer_handler(); - - SetLapTime(wrapper, cycleTick); - - cycleTick += TIMER_LVGL_TIMER_TASK; - osDelayUntil(cycleTick); - } + +PRIVATE void LVGLTimerTask(void* argument) { + uint32_t cycleTick = osKernelGetTickCount(); + DebugPrint("%s LVLG Timer Task", LVGL_TIMER_TAG); + for (;;) { + lv_timer_handler(); + + cycleTick += TIMER_LVGL_TIMER_TASK; + osDelayUntil(cycleTick); + } } From ad03e0ff84e5cfc7e9fb20e9677ef74c7d00abb6 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Tue, 26 Sep 2023 17:26:49 -0400 Subject: [PATCH 2/2] Fix scrolling in can log --- UOSM-Dashboard/Core/Src/main.c | 4 ++-- UOSM-Dashboard/Core/UI/LogView.cpp | 3 ++- UOSM-Dashboard/Core/UI/application.cpp | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/UOSM-Dashboard/Core/Src/main.c b/UOSM-Dashboard/Core/Src/main.c index 6eebcac..58a6d90 100644 --- a/UOSM-Dashboard/Core/Src/main.c +++ b/UOSM-Dashboard/Core/Src/main.c @@ -144,8 +144,8 @@ int main(void) { // Init the screen tft_init(); touchpad_init(); - - DataAggregatorWrapper* wrapper = DataAggregator_Create(10, 10, 10, 10, 10, 10); +#define N_CAN_MESSAGES_IN_LOG 8 + DataAggregatorWrapper* wrapper = DataAggregator_Create(10, 10, 10, 10, 10, N_CAN_MESSAGES_IN_LOG); CAN_SetAggregator(wrapper); Application_Create(wrapper); diff --git a/UOSM-Dashboard/Core/UI/LogView.cpp b/UOSM-Dashboard/Core/UI/LogView.cpp index 3a585ab..5f9db3d 100644 --- a/UOSM-Dashboard/Core/UI/LogView.cpp +++ b/UOSM-Dashboard/Core/UI/LogView.cpp @@ -6,6 +6,7 @@ #include "StylesManager.hpp" #define LOG_VIEW_N_COLUMNS 1 +#define LOG_VIEW_PADDING 5 LogView::LogView(lv_obj_t* parent, DataAggregator& aggregator) : View(parent, aggregator) { Styles* styles = StylesManager::GetStyles(); @@ -19,7 +20,7 @@ LogView::LogView(lv_obj_t* parent, DataAggregator& aggregator) : View(parent, ag table = lv_table_create(container); lv_table_set_col_cnt(table, LOG_VIEW_N_COLUMNS); - lv_table_set_col_width(table, 0, lv_obj_get_width(container)); + lv_table_set_col_width(table, 0, lv_obj_get_width(container) - LOG_VIEW_PADDING); // The number of rows is equal to the theoretical max size of the can logs entry buffer. In practice, this buffer is almost always full. lv_table_set_row_cnt(table, getDataAggregator().canLogEntries.getSize()); diff --git a/UOSM-Dashboard/Core/UI/application.cpp b/UOSM-Dashboard/Core/UI/application.cpp index 20e955e..56f234d 100644 --- a/UOSM-Dashboard/Core/UI/application.cpp +++ b/UOSM-Dashboard/Core/UI/application.cpp @@ -81,7 +81,7 @@ void Application_Create(DataAggregatorWrapper* aggregatorWrapper) { lv_obj_set_size(statsView->getContainer(), SCREEN_WIDTH, SCREEN_HEIGHT); logView = new LogView(nullptr, aggregator); - lv_obj_set_size(logView->getContainer(), SCREEN_WIDTH / 2, SCREEN_HEIGHT); + lv_obj_set_size(logView->getContainer(), SCREEN_WIDTH, SCREEN_HEIGHT); lv_scr_load(homeView->getContainer());