Apply bool to some MKS UI

This commit is contained in:
Scott Lahteine 2021-01-16 20:43:46 -06:00
parent b41f41589a
commit 40c8f2001d
16 changed files with 96 additions and 96 deletions

View file

@ -50,7 +50,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
if (event != LV_EVENT_RELEASED) return; if (event != LV_EVENT_RELEASED) return;
switch (obj->mks_obj_id) { switch (obj->mks_obj_id) {
case ID_ACCE_RETURN: case ID_ACCE_RETURN:
uiCfg.para_ui_page = 0; uiCfg.para_ui_page = false;
lv_clear_acceleration_settings(); lv_clear_acceleration_settings();
draw_return_ui(); draw_return_ui();
break; break;
@ -95,12 +95,12 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
lv_draw_number_key(); lv_draw_number_key();
break; break;
case ID_ACCE_UP: case ID_ACCE_UP:
uiCfg.para_ui_page = 0; uiCfg.para_ui_page = false;
lv_clear_acceleration_settings(); lv_clear_acceleration_settings();
lv_draw_acceleration_settings(); lv_draw_acceleration_settings();
break; break;
case ID_ACCE_DOWN: case ID_ACCE_DOWN:
uiCfg.para_ui_page = 1; uiCfg.para_ui_page = true;
lv_clear_acceleration_settings(); lv_clear_acceleration_settings();
lv_draw_acceleration_settings(); lv_draw_acceleration_settings();
break; break;
@ -110,7 +110,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
void lv_draw_acceleration_settings() { void lv_draw_acceleration_settings() {
scr = lv_screen_create(ACCELERATION_UI, machine_menu.AccelerationConfTitle); 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); 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); 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);

View file

@ -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(); if (!do_draw_cal) draw_return_ui();
} }
else if (DIALOG_IS(WIFI_CONFIG_TIPS)) { else if (DIALOG_IS(WIFI_CONFIG_TIPS)) {
uiCfg.configWifi = 1; uiCfg.configWifi = true;
clear_cur_ui(); clear_cur_ui();
draw_return_ui(); draw_return_ui();
} }
else if (DIALOG_IS(TYPE_FILAMENT_HEAT_LOAD_COMPLETED)) 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)) 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)) { else if (DIALOG_IS(TYPE_FILAMENT_LOAD_COMPLETED, TYPE_FILAMENT_UNLOAD_COMPLETED)) {
clear_cur_ui(); clear_cur_ui();
draw_return_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)) { else if (DIALOG_IS(TYPE_FILAMENT_LOADING, TYPE_FILAMENT_UNLOADING)) {
queue.enqueue_one_P(PSTR("M410")); queue.enqueue_one_P(PSTR("M410"));
uiCfg.filament_rate = 0; uiCfg.filament_rate = 0;
uiCfg.filament_loading_completed = 0; uiCfg.filament_loading_completed = false;
uiCfg.filament_unloading_completed = 0; uiCfg.filament_unloading_completed = false;
uiCfg.filament_loading_time_flg = 0; uiCfg.filament_loading_time_flg = false;
uiCfg.filament_loading_time_cnt = 0; uiCfg.filament_loading_time_cnt = 0;
uiCfg.filament_unloading_time_flg = 0; uiCfg.filament_unloading_time_flg = false;
uiCfg.filament_unloading_time_cnt = 0; uiCfg.filament_unloading_time_cnt = 0;
thermalManager.temp_hotend[uiCfg.curSprayerChoose].target = uiCfg.desireSprayerTempBak; thermalManager.temp_hotend[uiCfg.curSprayerChoose].target = uiCfg.desireSprayerTempBak;
clear_cur_ui(); clear_cur_ui();
@ -493,22 +493,22 @@ void filament_dialog_handle() {
filament_sprayer_temp(); filament_sprayer_temp();
temps_update_flag = false; temps_update_flag = false;
} }
if (uiCfg.filament_heat_completed_load == 1) { if (uiCfg.filament_heat_completed_load) {
uiCfg.filament_heat_completed_load = 0; uiCfg.filament_heat_completed_load = false;
lv_clear_dialog(); lv_clear_dialog();
lv_draw_dialog(DIALOG_TYPE_FILAMENT_LOADING); lv_draw_dialog(DIALOG_TYPE_FILAMENT_LOADING);
planner.synchronize(); planner.synchronize();
uiCfg.filament_loading_time_flg = 1; uiCfg.filament_loading_time_flg = true;
uiCfg.filament_loading_time_cnt = 0; 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); 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); queue.inject(public_buf_m);
} }
if (uiCfg.filament_heat_completed_unload == 1) { if (uiCfg.filament_heat_completed_unload) {
uiCfg.filament_heat_completed_unload = 0; uiCfg.filament_heat_completed_unload = false;
lv_clear_dialog(); lv_clear_dialog();
lv_draw_dialog(DIALOG_TYPE_FILAMENT_UNLOADING); lv_draw_dialog(DIALOG_TYPE_FILAMENT_UNLOADING);
planner.synchronize(); planner.synchronize();
uiCfg.filament_unloading_time_flg = 1; uiCfg.filament_unloading_time_flg = true;
uiCfg.filament_unloading_time_cnt = 0; 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); 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); 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) 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)) || ((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_clear_dialog();
lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_LOAD_COMPLETED); 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_rate = 0;
uiCfg.filament_loading_completed = 0; uiCfg.filament_loading_completed = false;
lv_clear_dialog(); lv_clear_dialog();
lv_draw_dialog(DIALOG_TYPE_FILAMENT_LOAD_COMPLETED); lv_draw_dialog(DIALOG_TYPE_FILAMENT_LOAD_COMPLETED);
} }
if (((abs((int)((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius - gCfgItems.filament_limit_temper)) <= 1) 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)) || ((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_clear_dialog();
lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED); 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_rate = 0;
uiCfg.filament_unloading_completed = 0; uiCfg.filament_unloading_completed = false;
lv_clear_dialog(); lv_clear_dialog();
lv_draw_dialog(DIALOG_TYPE_FILAMENT_UNLOAD_COMPLETED); lv_draw_dialog(DIALOG_TYPE_FILAMENT_UNLOAD_COMPLETED);
} }

View file

@ -49,7 +49,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
if (event != LV_EVENT_RELEASED) return; if (event != LV_EVENT_RELEASED) return;
switch (obj->mks_obj_id) { switch (obj->mks_obj_id) {
case ID_FILAMNT_IN: 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) 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)) { || (gCfgItems.filament_limit_temper <= thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius)) {
lv_clear_filament_change(); lv_clear_filament_change();
@ -65,7 +65,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
break; break;
case ID_FILAMNT_OUT: case ID_FILAMNT_OUT:
uiCfg.filament_unload_heat_flg=1; uiCfg.filament_unload_heat_flg = true;
if ((thermalManager.temp_hotend[uiCfg.curSprayerChoose].target > 0) if ((thermalManager.temp_hotend[uiCfg.curSprayerChoose].target > 0)
&& ((abs((int)((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target - thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius)) <= 1) && ((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)) || ((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius >= gCfgItems.filament_limit_temper))

View file

@ -46,7 +46,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
if (event != LV_EVENT_RELEASED) return; if (event != LV_EVENT_RELEASED) return;
switch (obj->mks_obj_id) { switch (obj->mks_obj_id) {
case ID_FILAMENT_SET_RETURN: case ID_FILAMENT_SET_RETURN:
uiCfg.para_ui_page = 0; uiCfg.para_ui_page = false;
lv_clear_filament_settings(); lv_clear_filament_settings();
draw_return_ui(); draw_return_ui();
break; break;
@ -76,12 +76,12 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
lv_draw_number_key(); lv_draw_number_key();
break; break;
case ID_FILAMENT_SET_UP: case ID_FILAMENT_SET_UP:
uiCfg.para_ui_page = 0; uiCfg.para_ui_page = false;
lv_clear_filament_settings(); lv_clear_filament_settings();
lv_draw_filament_settings(); lv_draw_filament_settings();
break; break;
case ID_FILAMENT_SET_DOWN: case ID_FILAMENT_SET_DOWN:
uiCfg.para_ui_page = 1; uiCfg.para_ui_page = true;
lv_clear_filament_settings(); lv_clear_filament_settings();
lv_draw_filament_settings(); lv_draw_filament_settings();
break; break;
@ -91,7 +91,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
void lv_draw_filament_settings() { void lv_draw_filament_settings() {
scr = lv_screen_create(FILAMENT_SETTINGS_UI, machine_menu.FilamentConfTitle); 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); 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); 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);

View file

@ -52,7 +52,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
if (event != LV_EVENT_RELEASED) return; if (event != LV_EVENT_RELEASED) return;
switch (obj->mks_obj_id) { switch (obj->mks_obj_id) {
case ID_MANUAL_POS_RETURN: case ID_MANUAL_POS_RETURN:
uiCfg.para_ui_page = 0; uiCfg.para_ui_page = false;
lv_clear_manual_level_pos_settings(); lv_clear_manual_level_pos_settings();
draw_return_ui(); draw_return_ui();
return; return;
@ -87,12 +87,12 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
value = level_pos_y5; value = level_pos_y5;
break; break;
case ID_MANUAL_POS_UP: case ID_MANUAL_POS_UP:
uiCfg.para_ui_page = 0; uiCfg.para_ui_page = false;
lv_clear_manual_level_pos_settings(); lv_clear_manual_level_pos_settings();
lv_draw_manual_level_pos_settings(); lv_draw_manual_level_pos_settings();
return; return;
case ID_MANUAL_POS_DOWN: case ID_MANUAL_POS_DOWN:
uiCfg.para_ui_page = 1; uiCfg.para_ui_page = true;
lv_clear_manual_level_pos_settings(); lv_clear_manual_level_pos_settings();
lv_draw_manual_level_pos_settings(); lv_draw_manual_level_pos_settings();
return; return;
@ -106,7 +106,7 @@ void lv_draw_manual_level_pos_settings() {
scr = lv_screen_create(MANUAL_LEVELING_POSIGION_UI, machine_menu.LevelingParaConfTitle); 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(public_buf_l, PSTR("%d"), gCfgItems.levelingPos[0][0]);
sprintf_P(buf2, PSTR("%d"), gCfgItems.levelingPos[0][1]); 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); 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);

View file

@ -49,7 +49,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
lv_clear_max_feedrate_settings(); lv_clear_max_feedrate_settings();
switch (obj->mks_obj_id) { switch (obj->mks_obj_id) {
case ID_FEED_RETURN: case ID_FEED_RETURN:
uiCfg.para_ui_page = 0; uiCfg.para_ui_page = false;
draw_return_ui(); draw_return_ui();
return; return;
case ID_FEED_X: case ID_FEED_X:
@ -68,11 +68,11 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
value = E1MaxFeedRate; value = E1MaxFeedRate;
break; break;
case ID_FEED_UP: case ID_FEED_UP:
uiCfg.para_ui_page = 0; uiCfg.para_ui_page = false;
lv_draw_max_feedrate_settings(); lv_draw_max_feedrate_settings();
return; return;
case ID_FEED_DOWN: case ID_FEED_DOWN:
uiCfg.para_ui_page = 1; uiCfg.para_ui_page = true;
lv_draw_max_feedrate_settings(); lv_draw_max_feedrate_settings();
return; return;
} }
@ -82,7 +82,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
void lv_draw_max_feedrate_settings() { void lv_draw_max_feedrate_settings() {
scr = lv_screen_create(MAXFEEDRATE_UI, machine_menu.MaxFeedRateConfTitle); 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]); 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); 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);

View file

@ -88,7 +88,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
lv_draw_wifi(); lv_draw_wifi();
} }
else { else {
if (uiCfg.command_send == 1) { if (uiCfg.command_send) {
uint8_t cmd_wifi_list[] = { 0xA5, 0x07, 0x00, 0x00, 0xFC }; uint8_t cmd_wifi_list[] = { 0xA5, 0x07, 0x00, 0x00, 0xFC };
raw_send_to_wifi(cmd_wifi_list, COUNT(cmd_wifi_list)); raw_send_to_wifi(cmd_wifi_list, COUNT(cmd_wifi_list));
last_disp_state = SET_UI; last_disp_state = SET_UI;

View file

@ -48,7 +48,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
lv_clear_step_settings(); lv_clear_step_settings();
switch (obj->mks_obj_id) { switch (obj->mks_obj_id) {
case ID_STEP_RETURN: case ID_STEP_RETURN:
uiCfg.para_ui_page = 0; uiCfg.para_ui_page = false;
draw_return_ui(); draw_return_ui();
return; return;
case ID_STEP_X: case ID_STEP_X:
@ -67,11 +67,11 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
value = E1step; value = E1step;
break; break;
case ID_STEP_UP: case ID_STEP_UP:
uiCfg.para_ui_page = 0; uiCfg.para_ui_page = false;
lv_draw_step_settings(); lv_draw_step_settings();
return; return;
case ID_STEP_DOWN: case ID_STEP_DOWN:
uiCfg.para_ui_page = 1; uiCfg.para_ui_page = true;
lv_draw_step_settings(); lv_draw_step_settings();
return; return;
} }
@ -81,7 +81,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
void lv_draw_step_settings() { void lv_draw_step_settings() {
scr = lv_screen_create(STEPS_UI, machine_menu.StepsConfTitle); 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]); 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); 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);

View file

@ -49,7 +49,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
lv_clear_tmc_current_settings(); lv_clear_tmc_current_settings();
switch (obj->mks_obj_id) { switch (obj->mks_obj_id) {
case ID_TMC_CURRENT_RETURN: case ID_TMC_CURRENT_RETURN:
uiCfg.para_ui_page = 0; uiCfg.para_ui_page = false;
draw_return_ui(); draw_return_ui();
return; return;
#if AXIS_IS_TMC(X) #if AXIS_IS_TMC(X)
@ -79,11 +79,11 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
#endif #endif
case ID_TMC_CURRENT_UP: case ID_TMC_CURRENT_UP:
uiCfg.para_ui_page = 0; uiCfg.para_ui_page = false;
lv_draw_tmc_current_settings(); lv_draw_tmc_current_settings();
return; return;
case ID_TMC_CURRENT_DOWN: case ID_TMC_CURRENT_DOWN:
uiCfg.para_ui_page = 1; uiCfg.para_ui_page = true;
lv_draw_tmc_current_settings(); lv_draw_tmc_current_settings();
return; return;
} }
@ -95,7 +95,7 @@ void lv_draw_tmc_current_settings() {
scr = lv_screen_create(TMC_CURRENT_UI, machine_menu.TmcCurrentConfTitle); scr = lv_screen_create(TMC_CURRENT_UI, machine_menu.TmcCurrentConfTitle);
float milliamps; float milliamps;
if (uiCfg.para_ui_page != 1) { if (!uiCfg.para_ui_page) {
#if AXIS_IS_TMC(X) #if AXIS_IS_TMC(X)
milliamps = stepperX.getMilliamps(); milliamps = stepperX.getMilliamps();
#else #else

View file

@ -63,7 +63,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
switch (obj->mks_obj_id) { switch (obj->mks_obj_id) {
case ID_TMC_MODE_RETURN: case ID_TMC_MODE_RETURN:
uiCfg.para_ui_page = 0; uiCfg.para_ui_page = false;
lv_clear_tmc_step_mode_settings(); lv_clear_tmc_step_mode_settings();
draw_return_ui(); draw_return_ui();
break; break;
@ -95,12 +95,12 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
#endif #endif
case ID_TMC_MODE_UP: case ID_TMC_MODE_UP:
uiCfg.para_ui_page = 0; uiCfg.para_ui_page = false;
lv_clear_tmc_step_mode_settings(); lv_clear_tmc_step_mode_settings();
lv_draw_tmc_step_mode_settings(); lv_draw_tmc_step_mode_settings();
break; break;
case ID_TMC_MODE_DOWN: case ID_TMC_MODE_DOWN:
uiCfg.para_ui_page = 1; uiCfg.para_ui_page = true;
lv_clear_tmc_step_mode_settings(); lv_clear_tmc_step_mode_settings();
lv_draw_tmc_step_mode_settings(); lv_draw_tmc_step_mode_settings();
break; break;
@ -129,7 +129,7 @@ void lv_draw_tmc_step_mode_settings() {
stealth_E1 = stepperE1.get_stealthChop(); stealth_E1 = stepperE1.get_stealthChop();
#endif #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); 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); 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); 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);

View file

@ -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; public_buf_m[sizeof(public_buf_m)-1] = 0;
queue.inject_P(PSTR(public_buf_m)); queue.inject_P(PSTR(public_buf_m));
#else #else
uiCfg.leveling_first_time = 1; uiCfg.leveling_first_time = true;
lv_draw_manualLevel(); lv_draw_manualLevel();
#endif #endif
break; break;

View file

@ -181,22 +181,22 @@ void ui_cfg_init() {
uiCfg.curTempType = 0; uiCfg.curTempType = 0;
uiCfg.curSprayerChoose = 0; uiCfg.curSprayerChoose = 0;
uiCfg.stepHeat = 10; uiCfg.stepHeat = 10;
uiCfg.leveling_first_time = 0; uiCfg.leveling_first_time = false;
uiCfg.para_ui_page = 0; uiCfg.para_ui_page = false;
uiCfg.extruStep = 5; uiCfg.extruStep = 5;
uiCfg.extruSpeed = 10; uiCfg.extruSpeed = 10;
uiCfg.move_dist = 1; uiCfg.move_dist = 1;
uiCfg.moveSpeed = 3000; uiCfg.moveSpeed = 3000;
uiCfg.stepPrintSpeed = 10; uiCfg.stepPrintSpeed = 10;
uiCfg.command_send = 0; uiCfg.command_send = false;
uiCfg.dialogType = 0; uiCfg.dialogType = 0;
uiCfg.filament_heat_completed_load = 0; uiCfg.filament_heat_completed_load = false;
uiCfg.filament_rate = 0; uiCfg.filament_rate = 0;
uiCfg.filament_loading_completed = 0; uiCfg.filament_loading_completed = false;
uiCfg.filament_unloading_completed = 0; uiCfg.filament_unloading_completed = false;
uiCfg.filament_loading_time_flg = 0; uiCfg.filament_loading_time_flg = false;
uiCfg.filament_loading_time_cnt = 0; uiCfg.filament_loading_time_cnt = 0;
uiCfg.filament_unloading_time_flg = 0; uiCfg.filament_unloading_time_flg = false;
uiCfg.filament_unloading_time_cnt = 0; uiCfg.filament_unloading_time_cnt = 0;
#if ENABLED(MKS_WIFI_MODULE) #if ENABLED(MKS_WIFI_MODULE)

View file

@ -194,37 +194,37 @@ typedef struct {
uint8_t wifi_mode_sel; uint8_t wifi_mode_sel;
uint8_t fileSysType; uint8_t fileSysType;
uint8_t wifi_type; uint8_t wifi_type;
bool cloud_enable; bool cloud_enable,
bool encoder_enable; encoder_enable;
int levelingPos[5][2]; int levelingPos[5][2];
int filamentchange_load_length; int filamentchange_load_length,
int filamentchange_load_speed; filamentchange_load_speed,
int filamentchange_unload_length; filamentchange_unload_length,
int filamentchange_unload_speed; filamentchange_unload_speed,
int filament_limit_temper; filament_limit_temper;
float pausePosX; float pausePosX,
float pausePosY; pausePosY,
float pausePosZ; pausePosZ;
uint32_t curFilesize; uint32_t curFilesize;
} CFG_ITMES; } CFG_ITMES;
typedef struct { typedef struct {
uint8_t curTempType:1, uint8_t curTempType:1,
curSprayerChoose:3, curSprayerChoose:3,
stepHeat:4; stepHeat:4,
uint8_t leveling_first_time:1, curSprayerChoose_bak:4;
bool leveling_first_time:1,
para_ui_page:1, para_ui_page:1,
configWifi:1, configWifi:1,
command_send:1, command_send:1,
filament_load_heat_flg:1, filament_load_heat_flg:1,
filament_heat_completed_load:1, filament_heat_completed_load:1,
filament_unload_heat_flg:1, filament_unload_heat_flg:1,
filament_heat_completed_unload:1; filament_heat_completed_unload:1,
uint8_t filament_loading_completed:1, filament_loading_completed:1,
filament_unloading_completed:1, filament_unloading_completed:1,
filament_loading_time_flg:1, filament_loading_time_flg:1,
filament_unloading_time_flg:1, filament_unloading_time_flg:1;
curSprayerChoose_bak:4;
uint8_t wifi_name[32]; uint8_t wifi_name[32];
uint8_t wifi_key[64]; uint8_t wifi_key[64];
uint8_t cloud_hostUrl[96]; uint8_t cloud_hostUrl[96];
@ -240,16 +240,16 @@ typedef struct {
uint16_t cloud_port; uint16_t cloud_port;
uint16_t moveSpeed_bak; uint16_t moveSpeed_bak;
uint32_t totalSend; uint32_t totalSend;
uint32_t filament_loading_time; uint32_t filament_loading_time,
uint32_t filament_unloading_time; filament_unloading_time,
uint32_t filament_loading_time_cnt; filament_loading_time_cnt,
uint32_t filament_unloading_time_cnt; filament_unloading_time_cnt;
float move_dist; float move_dist;
float desireSprayerTempBak; float desireSprayerTempBak;
float current_x_position_bak; float current_x_position_bak,
float current_y_position_bak; current_y_position_bak,
float current_z_position_bak; current_z_position_bak,
float current_e_position_bak; current_e_position_bak;
} UI_CFG; } UI_CFG;
typedef enum { typedef enum {

View file

@ -157,7 +157,7 @@ void disp_wifi_list() {
} }
void wifi_scan_handle() { 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; last_disp_state = DIALOG_UI;
lv_clear_dialog(); lv_clear_dialog();
if (wifi_link_state == WIFI_CONNECTED && wifiPara.mode != AP_MODEL) if (wifi_link_state == WIFI_CONNECTED && wifiPara.mode != AP_MODEL)

View file

@ -87,22 +87,22 @@ void SysTick_Callback() {
if (tips_disp.timer == TIPS_TIMER_START) if (tips_disp.timer == TIPS_TIMER_START)
tips_disp.timer_count++; tips_disp.timer_count++;
#endif #endif
if (uiCfg.filament_loading_time_flg == 1) { if (uiCfg.filament_loading_time_flg) {
uiCfg.filament_loading_time_cnt++; 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); 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)) { if (uiCfg.filament_loading_time_cnt >= (uiCfg.filament_loading_time * 1000)) {
uiCfg.filament_loading_time_cnt = 0; uiCfg.filament_loading_time_cnt = 0;
uiCfg.filament_loading_time_flg = 0; uiCfg.filament_loading_time_flg = false;
uiCfg.filament_loading_completed = 1; 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_unloading_time_cnt++;
uiCfg.filament_rate = (uint32_t)(((uiCfg.filament_unloading_time_cnt / (uiCfg.filament_unloading_time * 1000.0)) * 100.0) + 0.5); 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)) { if (uiCfg.filament_unloading_time_cnt >= (uiCfg.filament_unloading_time * 1000)) {
uiCfg.filament_unloading_time_cnt = 0; uiCfg.filament_unloading_time_cnt = 0;
uiCfg.filament_unloading_time_flg = 0; uiCfg.filament_unloading_time_flg = false;
uiCfg.filament_unloading_completed = 1; uiCfg.filament_unloading_completed = true;
uiCfg.filament_rate = 100; uiCfg.filament_rate = 100;
} }
} }

View file

@ -953,7 +953,7 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
wifi_ret_ack(); wifi_ret_ack();
send_to_wifi((uint8_t *)"M997 PAUSE\r\n", strlen("M997 PAUSE\r\n")); 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; break;
case 998: 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); 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) if ((wifiPara.mode != gCfgItems.wifi_mode_sel)
|| (strncmp(wifiPara.ap_name, (const char *)uiCfg.wifi_name, 32) != 0) || (strncmp(wifiPara.ap_name, (const char *)uiCfg.wifi_name, 32) != 0)
|| (strncmp(wifiPara.keyCode, (const char *)uiCfg.wifi_key, 64) != 0)) { || (strncmp(wifiPara.keyCode, (const char *)uiCfg.wifi_key, 64) != 0)) {
package_to_wifi(WIFI_PARA_SET, (uint8_t *)0, 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 (cfg_cloud_flag == 1) {
if (((cloud_para.state >> 4) != (char)gCfgItems.cloud_enable) 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]; wifi_list.getNameNum = msg[0];
if (wifi_list.getNameNum < 20) { if (wifi_list.getNameNum < 20) {
uiCfg.command_send = 1; uiCfg.command_send = true;
ZERO(wifi_list.wifiName); ZERO(wifi_list.wifiName);
wifi_name_num = wifi_list.getNameNum; wifi_name_num = wifi_list.getNameNum;
valid_name_num = 0; valid_name_num = 0;