summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJF <JF002@users.noreply.github.com>2021-10-16 14:10:09 +0200
committerGitHub <noreply@github.com>2021-10-16 14:10:09 +0200
commit77e73fea327476931cea3794d4dda01efe25860e (patch)
tree3b297786a88ff3177730c55ebbb11ca9338358e5 /src
parentfafb998b8cda05be07921c7e66e4bfa0c8cb5561 (diff)
parentc78177eedf0d08b7fef5771f694487d08658b557 (diff)
Merge pull request #507 from Riksu9000/fit_more_tasks
Fit more tasks in SystemInfo
Diffstat (limited to 'src')
-rw-r--r--src/displayapp/screens/SystemInfo.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/displayapp/screens/SystemInfo.cpp b/src/displayapp/screens/SystemInfo.cpp
index cda0a487..343b72bf 100644
--- a/src/displayapp/screens/SystemInfo.cpp
+++ b/src/displayapp/screens/SystemInfo.cpp
@@ -206,11 +206,14 @@ bool SystemInfo::sortById(const TaskStatus_t& lhs, const TaskStatus_t& rhs) {
}
std::unique_ptr<Screen> SystemInfo::CreateScreen4() {
- TaskStatus_t tasksStatus[10];
+ static constexpr uint8_t maxTaskCount = 9;
+ TaskStatus_t tasksStatus[maxTaskCount];
+
lv_obj_t* infoTask = lv_table_create(lv_scr_act(), NULL);
lv_table_set_col_cnt(infoTask, 4);
- lv_table_set_row_cnt(infoTask, 8);
- lv_obj_set_pos(infoTask, 0, 10);
+ lv_table_set_row_cnt(infoTask, maxTaskCount + 1);
+ lv_obj_set_style_local_pad_all(infoTask, LV_TABLE_PART_CELL1, LV_STATE_DEFAULT, 0);
+ lv_obj_set_style_local_border_color(infoTask, LV_TABLE_PART_CELL1, LV_STATE_DEFAULT, LV_COLOR_GRAY);
lv_table_set_cell_value(infoTask, 0, 0, "#");
lv_table_set_col_width(infoTask, 0, 30);
@@ -221,9 +224,9 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen4() {
lv_table_set_cell_value(infoTask, 0, 3, "Free");
lv_table_set_col_width(infoTask, 3, 90);
- auto nb = uxTaskGetSystemState(tasksStatus, sizeof(tasksStatus) / sizeof(tasksStatus[0]), nullptr);
+ auto nb = uxTaskGetSystemState(tasksStatus, maxTaskCount, nullptr);
std::sort(tasksStatus, tasksStatus + nb, sortById);
- for (uint8_t i = 0; i < nb && i < 7; i++) {
+ for (uint8_t i = 0; i < nb && i < maxTaskCount; i++) {
lv_table_set_cell_value(infoTask, i + 1, 0, std::to_string(tasksStatus[i].xTaskNumber).c_str());
char state[2] = {0};