Fit more tasks in SystemInfo

This commit is contained in:
Riku Isokoski 2021-07-21 14:41:29 +03:00
parent 57b3397078
commit 93893511f1

View file

@ -210,11 +210,14 @@ bool SystemInfo::sortById(const TaskStatus_t& lhs, const TaskStatus_t& rhs) {
}
std::unique_ptr<Screen> SystemInfo::CreateScreen4() {
TaskStatus_t tasksStatus[7];
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, 3);
lv_table_set_row_cnt(infoTask, 8);
lv_obj_set_pos(infoTask, 10, 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, 50);
@ -223,8 +226,9 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen4() {
lv_table_set_cell_value(infoTask, 0, 2, "Free");
lv_table_set_col_width(infoTask, 2, 90);
auto nb = uxTaskGetSystemState(tasksStatus, 7, nullptr);
auto nb = uxTaskGetSystemState(tasksStatus, maxTaskCount, nullptr);
std::sort(tasksStatus, tasksStatus + nb, sortById);
for (uint8_t i = 0; i < nb; i++) {
lv_table_set_cell_value(infoTask, i + 1, 0, std::to_string(tasksStatus[i].xTaskNumber).c_str());