Skip to content

Commit

Permalink
Fix scrolling in can log
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremycote committed Sep 26, 2023
1 parent 76c9036 commit ad03e0f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 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
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 ad03e0f

Please sign in to comment.