Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
toxoscorp committed Sep 26, 2023
2 parents 5f30b68 + ad03e0f commit 22ea9cd
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 30 deletions.
4 changes: 2 additions & 2 deletions UOSM-Dashboard/Core/Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
6 changes: 2 additions & 4 deletions UOSM-Dashboard/Core/Tasks/InternalCommsTask.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:";
Expand All @@ -39,7 +39,5 @@ PRIVATE void InternalCommsTask(void* argument) {
osDelayUntil(cycleTick);

IComms_PeriodicReceive();

CAN_Dummy_RPM(cycleTick % 3000);
}
}
39 changes: 17 additions & 22 deletions UOSM-Dashboard/Core/Tasks/LVGLTimerTask.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
3 changes: 2 additions & 1 deletion UOSM-Dashboard/Core/UI/LogView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion UOSM-Dashboard/Core/UI/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down

0 comments on commit 22ea9cd

Please sign in to comment.