From 40c8f2001d2274dd34868d2e83ba65a09bcfba17 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 16 Jan 2021 20:43:46 -0600 Subject: [PATCH] Apply bool to some MKS UI --- .../lib/mks_ui/draw_acceleration_settings.cpp | 8 ++-- .../src/lcd/extui/lib/mks_ui/draw_dialog.cpp | 42 ++++++++-------- .../extui/lib/mks_ui/draw_filament_change.cpp | 4 +- .../lib/mks_ui/draw_filament_settings.cpp | 8 ++-- .../mks_ui/draw_manual_level_pos_settings.cpp | 8 ++-- .../lib/mks_ui/draw_max_feedrate_settings.cpp | 8 ++-- Marlin/src/lcd/extui/lib/mks_ui/draw_set.cpp | 2 +- .../extui/lib/mks_ui/draw_step_settings.cpp | 8 ++-- .../lib/mks_ui/draw_tmc_current_settings.cpp | 8 ++-- .../mks_ui/draw_tmc_step_mode_settings.cpp | 8 ++-- Marlin/src/lcd/extui/lib/mks_ui/draw_tool.cpp | 2 +- Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp | 16 +++---- Marlin/src/lcd/extui/lib/mks_ui/draw_ui.h | 48 +++++++++---------- .../lcd/extui/lib/mks_ui/draw_wifi_list.cpp | 2 +- .../lib/mks_ui/tft_lvgl_configuration.cpp | 12 ++--- .../src/lcd/extui/lib/mks_ui/wifi_module.cpp | 8 ++-- 16 files changed, 96 insertions(+), 96 deletions(-) diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_acceleration_settings.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_acceleration_settings.cpp index 560f5460f..04c5ee77c 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_acceleration_settings.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_acceleration_settings.cpp @@ -50,7 +50,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { if (event != LV_EVENT_RELEASED) return; switch (obj->mks_obj_id) { case ID_ACCE_RETURN: - uiCfg.para_ui_page = 0; + uiCfg.para_ui_page = false; lv_clear_acceleration_settings(); draw_return_ui(); break; @@ -95,12 +95,12 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { lv_draw_number_key(); break; case ID_ACCE_UP: - uiCfg.para_ui_page = 0; + uiCfg.para_ui_page = false; lv_clear_acceleration_settings(); lv_draw_acceleration_settings(); break; case ID_ACCE_DOWN: - uiCfg.para_ui_page = 1; + uiCfg.para_ui_page = true; lv_clear_acceleration_settings(); lv_draw_acceleration_settings(); break; @@ -110,7 +110,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { void lv_draw_acceleration_settings() { scr = lv_screen_create(ACCELERATION_UI, machine_menu.AccelerationConfTitle); - if (uiCfg.para_ui_page != 1) { + if (!uiCfg.para_ui_page) { sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.acceleration); lv_screen_menu_item_1_edit(scr, machine_menu.PrintAcceleration, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_ACCE_PRINT, 0, public_buf_l); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp index e2a24f78e..95077d09f 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp @@ -160,14 +160,14 @@ static void btn_ok_event_cb(lv_obj_t *btn, lv_event_t event) { if (!do_draw_cal) draw_return_ui(); } else if (DIALOG_IS(WIFI_CONFIG_TIPS)) { - uiCfg.configWifi = 1; + uiCfg.configWifi = true; clear_cur_ui(); draw_return_ui(); } else if (DIALOG_IS(TYPE_FILAMENT_HEAT_LOAD_COMPLETED)) - uiCfg.filament_heat_completed_load = 1; + uiCfg.filament_heat_completed_load = true; else if (DIALOG_IS(TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED)) - uiCfg.filament_heat_completed_unload = 1; + uiCfg.filament_heat_completed_unload = true; else if (DIALOG_IS(TYPE_FILAMENT_LOAD_COMPLETED, TYPE_FILAMENT_UNLOAD_COMPLETED)) { clear_cur_ui(); draw_return_ui(); @@ -198,11 +198,11 @@ static void btn_cancel_event_cb(lv_obj_t *btn, lv_event_t event) { else if (DIALOG_IS(TYPE_FILAMENT_LOADING, TYPE_FILAMENT_UNLOADING)) { queue.enqueue_one_P(PSTR("M410")); uiCfg.filament_rate = 0; - uiCfg.filament_loading_completed = 0; - uiCfg.filament_unloading_completed = 0; - uiCfg.filament_loading_time_flg = 0; + uiCfg.filament_loading_completed = false; + uiCfg.filament_unloading_completed = false; + uiCfg.filament_loading_time_flg = false; uiCfg.filament_loading_time_cnt = 0; - uiCfg.filament_unloading_time_flg = 0; + uiCfg.filament_unloading_time_flg = false; uiCfg.filament_unloading_time_cnt = 0; thermalManager.temp_hotend[uiCfg.curSprayerChoose].target = uiCfg.desireSprayerTempBak; clear_cur_ui(); @@ -493,22 +493,22 @@ void filament_dialog_handle() { filament_sprayer_temp(); temps_update_flag = false; } - if (uiCfg.filament_heat_completed_load == 1) { - uiCfg.filament_heat_completed_load = 0; + if (uiCfg.filament_heat_completed_load) { + uiCfg.filament_heat_completed_load = false; lv_clear_dialog(); lv_draw_dialog(DIALOG_TYPE_FILAMENT_LOADING); planner.synchronize(); - uiCfg.filament_loading_time_flg = 1; + uiCfg.filament_loading_time_flg = true; uiCfg.filament_loading_time_cnt = 0; sprintf_P(public_buf_m, PSTR("T%d\nG91\nG1 E%d F%d\nG90"), uiCfg.curSprayerChoose, gCfgItems.filamentchange_load_length, gCfgItems.filamentchange_load_speed); queue.inject(public_buf_m); } - if (uiCfg.filament_heat_completed_unload == 1) { - uiCfg.filament_heat_completed_unload = 0; + if (uiCfg.filament_heat_completed_unload) { + uiCfg.filament_heat_completed_unload = false; lv_clear_dialog(); lv_draw_dialog(DIALOG_TYPE_FILAMENT_UNLOADING); planner.synchronize(); - uiCfg.filament_unloading_time_flg = 1; + uiCfg.filament_unloading_time_flg = true; uiCfg.filament_unloading_time_cnt = 0; sprintf_P(public_buf_m, PSTR("T%d\nG91\nG1 E-%d F%d\nG90"), uiCfg.curSprayerChoose, gCfgItems.filamentchange_unload_length, gCfgItems.filamentchange_unload_speed); queue.inject(public_buf_m); @@ -516,31 +516,31 @@ void filament_dialog_handle() { if (((abs((int)((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius - gCfgItems.filament_limit_temper)) <= 1) || ((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius > gCfgItems.filament_limit_temper)) - && (uiCfg.filament_load_heat_flg == 1) + && (uiCfg.filament_load_heat_flg) ) { - uiCfg.filament_load_heat_flg = 0; + uiCfg.filament_load_heat_flg = false; lv_clear_dialog(); lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_LOAD_COMPLETED); } - if (uiCfg.filament_loading_completed == 1) { + if (uiCfg.filament_loading_completed) { uiCfg.filament_rate = 0; - uiCfg.filament_loading_completed = 0; + uiCfg.filament_loading_completed = false; lv_clear_dialog(); lv_draw_dialog(DIALOG_TYPE_FILAMENT_LOAD_COMPLETED); } if (((abs((int)((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius - gCfgItems.filament_limit_temper)) <= 1) || ((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius > gCfgItems.filament_limit_temper)) - && (uiCfg.filament_unload_heat_flg == 1) + && uiCfg.filament_unload_heat_flg ) { - uiCfg.filament_unload_heat_flg = 0; + uiCfg.filament_unload_heat_flg = false; lv_clear_dialog(); lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED); } - if (uiCfg.filament_unloading_completed == 1) { + if (uiCfg.filament_unloading_completed) { uiCfg.filament_rate = 0; - uiCfg.filament_unloading_completed = 0; + uiCfg.filament_unloading_completed = false; lv_clear_dialog(); lv_draw_dialog(DIALOG_TYPE_FILAMENT_UNLOAD_COMPLETED); } diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_filament_change.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_filament_change.cpp index 017b7120f..cff99119e 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_filament_change.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_filament_change.cpp @@ -49,7 +49,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { if (event != LV_EVENT_RELEASED) return; switch (obj->mks_obj_id) { case ID_FILAMNT_IN: - uiCfg.filament_load_heat_flg = 1; + uiCfg.filament_load_heat_flg = true; if ((abs(thermalManager.temp_hotend[uiCfg.curSprayerChoose].target - thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius) <= 1) || (gCfgItems.filament_limit_temper <= thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius)) { lv_clear_filament_change(); @@ -65,7 +65,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { } break; case ID_FILAMNT_OUT: - uiCfg.filament_unload_heat_flg=1; + uiCfg.filament_unload_heat_flg = true; if ((thermalManager.temp_hotend[uiCfg.curSprayerChoose].target > 0) && ((abs((int)((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target - thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius)) <= 1) || ((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius >= gCfgItems.filament_limit_temper)) diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_filament_settings.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_filament_settings.cpp index 4dcd9b8b1..128989a27 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_filament_settings.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_filament_settings.cpp @@ -46,7 +46,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { if (event != LV_EVENT_RELEASED) return; switch (obj->mks_obj_id) { case ID_FILAMENT_SET_RETURN: - uiCfg.para_ui_page = 0; + uiCfg.para_ui_page = false; lv_clear_filament_settings(); draw_return_ui(); break; @@ -76,12 +76,12 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { lv_draw_number_key(); break; case ID_FILAMENT_SET_UP: - uiCfg.para_ui_page = 0; + uiCfg.para_ui_page = false; lv_clear_filament_settings(); lv_draw_filament_settings(); break; case ID_FILAMENT_SET_DOWN: - uiCfg.para_ui_page = 1; + uiCfg.para_ui_page = true; lv_clear_filament_settings(); lv_draw_filament_settings(); break; @@ -91,7 +91,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { void lv_draw_filament_settings() { scr = lv_screen_create(FILAMENT_SETTINGS_UI, machine_menu.FilamentConfTitle); - if (uiCfg.para_ui_page != 1) { + if (!uiCfg.para_ui_page) { sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.filamentchange_load_length); lv_screen_menu_item_1_edit(scr, machine_menu.InLength, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_FILAMENT_SET_IN_LENGTH, 0, public_buf_l); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_manual_level_pos_settings.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_manual_level_pos_settings.cpp index 554c32be9..6cbd703f9 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_manual_level_pos_settings.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_manual_level_pos_settings.cpp @@ -52,7 +52,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { if (event != LV_EVENT_RELEASED) return; switch (obj->mks_obj_id) { case ID_MANUAL_POS_RETURN: - uiCfg.para_ui_page = 0; + uiCfg.para_ui_page = false; lv_clear_manual_level_pos_settings(); draw_return_ui(); return; @@ -87,12 +87,12 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { value = level_pos_y5; break; case ID_MANUAL_POS_UP: - uiCfg.para_ui_page = 0; + uiCfg.para_ui_page = false; lv_clear_manual_level_pos_settings(); lv_draw_manual_level_pos_settings(); return; case ID_MANUAL_POS_DOWN: - uiCfg.para_ui_page = 1; + uiCfg.para_ui_page = true; lv_clear_manual_level_pos_settings(); lv_draw_manual_level_pos_settings(); return; @@ -106,7 +106,7 @@ void lv_draw_manual_level_pos_settings() { scr = lv_screen_create(MANUAL_LEVELING_POSIGION_UI, machine_menu.LevelingParaConfTitle); - if (uiCfg.para_ui_page != 1) { + if (!uiCfg.para_ui_page) { sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.levelingPos[0][0]); sprintf_P(buf2, PSTR("%d"), gCfgItems.levelingPos[0][1]); lv_screen_menu_item_2_edit(scr, leveling_menu.position1, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_MANUAL_POS_Y1, 0, buf2, ID_MANUAL_POS_X1, public_buf_l); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_max_feedrate_settings.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_max_feedrate_settings.cpp index 393d4736e..47bd906a5 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_max_feedrate_settings.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_max_feedrate_settings.cpp @@ -49,7 +49,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { lv_clear_max_feedrate_settings(); switch (obj->mks_obj_id) { case ID_FEED_RETURN: - uiCfg.para_ui_page = 0; + uiCfg.para_ui_page = false; draw_return_ui(); return; case ID_FEED_X: @@ -68,11 +68,11 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { value = E1MaxFeedRate; break; case ID_FEED_UP: - uiCfg.para_ui_page = 0; + uiCfg.para_ui_page = false; lv_draw_max_feedrate_settings(); return; case ID_FEED_DOWN: - uiCfg.para_ui_page = 1; + uiCfg.para_ui_page = true; lv_draw_max_feedrate_settings(); return; } @@ -82,7 +82,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { void lv_draw_max_feedrate_settings() { scr = lv_screen_create(MAXFEEDRATE_UI, machine_menu.MaxFeedRateConfTitle); - if (uiCfg.para_ui_page != 1) { + if (!uiCfg.para_ui_page) { sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[X_AXIS]); lv_screen_menu_item_1_edit(scr, machine_menu.XMaxFeedRate, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_FEED_X, 0, public_buf_l); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_set.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_set.cpp index f6702b559..6b06793f2 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_set.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_set.cpp @@ -88,7 +88,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { lv_draw_wifi(); } else { - if (uiCfg.command_send == 1) { + if (uiCfg.command_send) { uint8_t cmd_wifi_list[] = { 0xA5, 0x07, 0x00, 0x00, 0xFC }; raw_send_to_wifi(cmd_wifi_list, COUNT(cmd_wifi_list)); last_disp_state = SET_UI; diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_step_settings.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_step_settings.cpp index 0f66e5e62..c5cf45143 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_step_settings.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_step_settings.cpp @@ -48,7 +48,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { lv_clear_step_settings(); switch (obj->mks_obj_id) { case ID_STEP_RETURN: - uiCfg.para_ui_page = 0; + uiCfg.para_ui_page = false; draw_return_ui(); return; case ID_STEP_X: @@ -67,11 +67,11 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { value = E1step; break; case ID_STEP_UP: - uiCfg.para_ui_page = 0; + uiCfg.para_ui_page = false; lv_draw_step_settings(); return; case ID_STEP_DOWN: - uiCfg.para_ui_page = 1; + uiCfg.para_ui_page = true; lv_draw_step_settings(); return; } @@ -81,7 +81,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { void lv_draw_step_settings() { scr = lv_screen_create(STEPS_UI, machine_menu.StepsConfTitle); - if (uiCfg.para_ui_page != 1) { + if (!uiCfg.para_ui_page) { sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.axis_steps_per_mm[X_AXIS]); lv_screen_menu_item_1_edit(scr, machine_menu.X_Steps, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_STEP_X, 0, public_buf_l); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_current_settings.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_current_settings.cpp index 3d503b211..61ee3be1c 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_current_settings.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_current_settings.cpp @@ -49,7 +49,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { lv_clear_tmc_current_settings(); switch (obj->mks_obj_id) { case ID_TMC_CURRENT_RETURN: - uiCfg.para_ui_page = 0; + uiCfg.para_ui_page = false; draw_return_ui(); return; #if AXIS_IS_TMC(X) @@ -79,11 +79,11 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { #endif case ID_TMC_CURRENT_UP: - uiCfg.para_ui_page = 0; + uiCfg.para_ui_page = false; lv_draw_tmc_current_settings(); return; case ID_TMC_CURRENT_DOWN: - uiCfg.para_ui_page = 1; + uiCfg.para_ui_page = true; lv_draw_tmc_current_settings(); return; } @@ -95,7 +95,7 @@ void lv_draw_tmc_current_settings() { scr = lv_screen_create(TMC_CURRENT_UI, machine_menu.TmcCurrentConfTitle); float milliamps; - if (uiCfg.para_ui_page != 1) { + if (!uiCfg.para_ui_page) { #if AXIS_IS_TMC(X) milliamps = stepperX.getMilliamps(); #else diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_step_mode_settings.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_step_mode_settings.cpp index 51108dedc..08d442f8a 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_step_mode_settings.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_step_mode_settings.cpp @@ -63,7 +63,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { switch (obj->mks_obj_id) { case ID_TMC_MODE_RETURN: - uiCfg.para_ui_page = 0; + uiCfg.para_ui_page = false; lv_clear_tmc_step_mode_settings(); draw_return_ui(); break; @@ -95,12 +95,12 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { #endif case ID_TMC_MODE_UP: - uiCfg.para_ui_page = 0; + uiCfg.para_ui_page = false; lv_clear_tmc_step_mode_settings(); lv_draw_tmc_step_mode_settings(); break; case ID_TMC_MODE_DOWN: - uiCfg.para_ui_page = 1; + uiCfg.para_ui_page = true; lv_clear_tmc_step_mode_settings(); lv_draw_tmc_step_mode_settings(); break; @@ -129,7 +129,7 @@ void lv_draw_tmc_step_mode_settings() { stealth_E1 = stepperE1.get_stealthChop(); #endif - if (uiCfg.para_ui_page != 1) { + if (!uiCfg.para_ui_page) { buttonXState = lv_screen_menu_item_onoff(scr, machine_menu.X_StepMode, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_TMC_MODE_X, 0, stealth_X); buttonYState = lv_screen_menu_item_onoff(scr, machine_menu.Y_StepMode, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_TMC_MODE_Y, 1, stealth_Y); buttonZState = lv_screen_menu_item_onoff(scr, machine_menu.Z_StepMode, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_TMC_MODE_Z, 2, stealth_Z); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_tool.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_tool.cpp index 23acbb4f8..682d40858 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_tool.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_tool.cpp @@ -63,7 +63,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { public_buf_m[sizeof(public_buf_m)-1] = 0; queue.inject_P(PSTR(public_buf_m)); #else - uiCfg.leveling_first_time = 1; + uiCfg.leveling_first_time = true; lv_draw_manualLevel(); #endif break; diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp index 50282536e..8abedfe0d 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp @@ -181,22 +181,22 @@ void ui_cfg_init() { uiCfg.curTempType = 0; uiCfg.curSprayerChoose = 0; uiCfg.stepHeat = 10; - uiCfg.leveling_first_time = 0; - uiCfg.para_ui_page = 0; + uiCfg.leveling_first_time = false; + uiCfg.para_ui_page = false; uiCfg.extruStep = 5; uiCfg.extruSpeed = 10; uiCfg.move_dist = 1; uiCfg.moveSpeed = 3000; uiCfg.stepPrintSpeed = 10; - uiCfg.command_send = 0; + uiCfg.command_send = false; uiCfg.dialogType = 0; - uiCfg.filament_heat_completed_load = 0; + uiCfg.filament_heat_completed_load = false; uiCfg.filament_rate = 0; - uiCfg.filament_loading_completed = 0; - uiCfg.filament_unloading_completed = 0; - uiCfg.filament_loading_time_flg = 0; + uiCfg.filament_loading_completed = false; + uiCfg.filament_unloading_completed = false; + uiCfg.filament_loading_time_flg = false; uiCfg.filament_loading_time_cnt = 0; - uiCfg.filament_unloading_time_flg = 0; + uiCfg.filament_unloading_time_flg = false; uiCfg.filament_unloading_time_cnt = 0; #if ENABLED(MKS_WIFI_MODULE) diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.h index 2728a07ef..ded6bc782 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.h @@ -194,37 +194,37 @@ typedef struct { uint8_t wifi_mode_sel; uint8_t fileSysType; uint8_t wifi_type; - bool cloud_enable; - bool encoder_enable; + bool cloud_enable, + encoder_enable; int levelingPos[5][2]; - int filamentchange_load_length; - int filamentchange_load_speed; - int filamentchange_unload_length; - int filamentchange_unload_speed; - int filament_limit_temper; - float pausePosX; - float pausePosY; - float pausePosZ; + int filamentchange_load_length, + filamentchange_load_speed, + filamentchange_unload_length, + filamentchange_unload_speed, + filament_limit_temper; + float pausePosX, + pausePosY, + pausePosZ; uint32_t curFilesize; } CFG_ITMES; typedef struct { uint8_t curTempType:1, curSprayerChoose:3, - stepHeat:4; - uint8_t leveling_first_time:1, + stepHeat:4, + curSprayerChoose_bak:4; + bool leveling_first_time:1, para_ui_page:1, configWifi:1, command_send:1, filament_load_heat_flg:1, filament_heat_completed_load:1, filament_unload_heat_flg:1, - filament_heat_completed_unload:1; - uint8_t filament_loading_completed:1, + filament_heat_completed_unload:1, + filament_loading_completed:1, filament_unloading_completed:1, filament_loading_time_flg:1, - filament_unloading_time_flg:1, - curSprayerChoose_bak:4; + filament_unloading_time_flg:1; uint8_t wifi_name[32]; uint8_t wifi_key[64]; uint8_t cloud_hostUrl[96]; @@ -240,16 +240,16 @@ typedef struct { uint16_t cloud_port; uint16_t moveSpeed_bak; uint32_t totalSend; - uint32_t filament_loading_time; - uint32_t filament_unloading_time; - uint32_t filament_loading_time_cnt; - uint32_t filament_unloading_time_cnt; + uint32_t filament_loading_time, + filament_unloading_time, + filament_loading_time_cnt, + filament_unloading_time_cnt; float move_dist; float desireSprayerTempBak; - float current_x_position_bak; - float current_y_position_bak; - float current_z_position_bak; - float current_e_position_bak; + float current_x_position_bak, + current_y_position_bak, + current_z_position_bak, + current_e_position_bak; } UI_CFG; typedef enum { diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_list.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_list.cpp index d45f9980f..bda6306e6 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_list.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_list.cpp @@ -157,7 +157,7 @@ void disp_wifi_list() { } void wifi_scan_handle() { - if (!DIALOG_IS(WIFI_ENABLE_TIPS) || uiCfg.command_send != 1) return; + if (!DIALOG_IS(WIFI_ENABLE_TIPS) || !uiCfg.command_send) return; last_disp_state = DIALOG_UI; lv_clear_dialog(); if (wifi_link_state == WIFI_CONNECTED && wifiPara.mode != AP_MODEL) diff --git a/Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.cpp b/Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.cpp index d005a9b10..65b7538b7 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.cpp @@ -87,22 +87,22 @@ void SysTick_Callback() { if (tips_disp.timer == TIPS_TIMER_START) tips_disp.timer_count++; #endif - if (uiCfg.filament_loading_time_flg == 1) { + if (uiCfg.filament_loading_time_flg) { uiCfg.filament_loading_time_cnt++; uiCfg.filament_rate = (uint32_t)(((uiCfg.filament_loading_time_cnt / (uiCfg.filament_loading_time * 1000.0)) * 100.0) + 0.5); if (uiCfg.filament_loading_time_cnt >= (uiCfg.filament_loading_time * 1000)) { uiCfg.filament_loading_time_cnt = 0; - uiCfg.filament_loading_time_flg = 0; - uiCfg.filament_loading_completed = 1; + uiCfg.filament_loading_time_flg = false; + uiCfg.filament_loading_completed = true; } } - if (uiCfg.filament_unloading_time_flg == 1) { + if (uiCfg.filament_unloading_time_flg) { uiCfg.filament_unloading_time_cnt++; uiCfg.filament_rate = (uint32_t)(((uiCfg.filament_unloading_time_cnt / (uiCfg.filament_unloading_time * 1000.0)) * 100.0) + 0.5); if (uiCfg.filament_unloading_time_cnt >= (uiCfg.filament_unloading_time * 1000)) { uiCfg.filament_unloading_time_cnt = 0; - uiCfg.filament_unloading_time_flg = 0; - uiCfg.filament_unloading_completed = 1; + uiCfg.filament_unloading_time_flg = false; + uiCfg.filament_unloading_completed = true; uiCfg.filament_rate = 100; } } diff --git a/Marlin/src/lcd/extui/lib/mks_ui/wifi_module.cpp b/Marlin/src/lcd/extui/lib/mks_ui/wifi_module.cpp index eefdbafbd..bf4f75017 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/wifi_module.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/wifi_module.cpp @@ -953,7 +953,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) { wifi_ret_ack(); send_to_wifi((uint8_t *)"M997 PAUSE\r\n", strlen("M997 PAUSE\r\n")); } - if (uiCfg.command_send == 0) get_wifi_list_command_send(); + if (!uiCfg.command_send) get_wifi_list_command_send(); break; case 998: @@ -1095,13 +1095,13 @@ static void net_msg_handle(uint8_t * msg, uint16_t msgLen) { memcpy(wifi_firm_ver, (const char *)&msg[16 + wifiNameLen + wifiKeyLen + hostLen + id_len], ver_len); } - if (uiCfg.configWifi == 1) { + if (uiCfg.configWifi) { if ((wifiPara.mode != gCfgItems.wifi_mode_sel) || (strncmp(wifiPara.ap_name, (const char *)uiCfg.wifi_name, 32) != 0) || (strncmp(wifiPara.keyCode, (const char *)uiCfg.wifi_key, 64) != 0)) { package_to_wifi(WIFI_PARA_SET, (uint8_t *)0, 0); } - else uiCfg.configWifi = 0; + else uiCfg.configWifi = false; } if (cfg_cloud_flag == 1) { if (((cloud_para.state >> 4) != (char)gCfgItems.cloud_enable) @@ -1127,7 +1127,7 @@ static void wifi_list_msg_handle(uint8_t * msg, uint16_t msgLen) { wifi_list.getNameNum = msg[0]; if (wifi_list.getNameNum < 20) { - uiCfg.command_send = 1; + uiCfg.command_send = true; ZERO(wifi_list.wifiName); wifi_name_num = wifi_list.getNameNum; valid_name_num = 0;