🎨 Add MKS UI goto_previous_ui

This commit is contained in:
Scott Lahteine 2021-10-17 22:10:08 -05:00 committed by Scott Lahteine
parent af08f16efc
commit de77dfcbbd
19 changed files with 35 additions and 57 deletions

View File

@ -39,8 +39,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_A_RETURN:
clear_cur_ui();
draw_return_ui();
goto_previous_ui();
break;
}
}

View File

@ -107,8 +107,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
TERN_(EEPROM_SETTINGS, (void)settings.save());
has_adjust_z = 0;
}
clear_cur_ui();
draw_return_ui();
goto_previous_ui();
break;
}
}

View File

@ -110,8 +110,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
disp_speed_step();
break;
case ID_C_RETURN:
clear_cur_ui();
draw_return_ui();
goto_previous_ui();
break;
}
}

View File

@ -49,8 +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_CLOUD_BIND_RETURN:
clear_cur_ui();
draw_return_ui();
goto_previous_ui();
break;
case ID_CLOUD_RELEASE_BIND:
if (cloud_para.state == 0x12) {

View File

@ -136,19 +136,16 @@ static void btn_ok_event_cb(lv_obj_t *btn, lv_event_t event) {
else if (DIALOG_IS(PAUSE_MESSAGE_OPTION))
pause_menu_response = PAUSE_RESPONSE_EXTRUDE_MORE;
else if (DIALOG_IS(PAUSE_MESSAGE_RESUME)) {
clear_cur_ui();
draw_return_ui();
goto_previous_ui();
}
#endif
else if (DIALOG_IS(STORE_EEPROM_TIPS)) {
TERN_(EEPROM_SETTINGS, (void)settings.save());
clear_cur_ui();
draw_return_ui();
goto_previous_ui();
}
else if (DIALOG_IS(READ_EEPROM_TIPS)) {
TERN_(EEPROM_SETTINGS, (void)settings.load());
clear_cur_ui();
draw_return_ui();
goto_previous_ui();
}
else if (DIALOG_IS(REVERT_EEPROM_TIPS)) {
TERN_(EEPROM_SETTINGS, (void)settings.reset());
@ -166,27 +163,23 @@ static void btn_ok_event_cb(lv_obj_t *btn, lv_event_t event) {
}
else if (DIALOG_IS(WIFI_CONFIG_TIPS)) {
uiCfg.configWifi = true;
clear_cur_ui();
draw_return_ui();
goto_previous_ui();
}
else if (DIALOG_IS(TYPE_FILAMENT_HEAT_LOAD_COMPLETED))
uiCfg.filament_heat_completed_load = true;
else if (DIALOG_IS(TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED))
uiCfg.filament_heat_completed_unload = true;
else if (DIALOG_IS(TYPE_FILAMENT_LOAD_COMPLETED, TYPE_FILAMENT_UNLOAD_COMPLETED)) {
clear_cur_ui();
draw_return_ui();
goto_previous_ui();
}
#if ENABLED(MKS_WIFI_MODULE)
else if (DIALOG_IS(TYPE_UNBIND)) {
cloud_unbind();
clear_cur_ui();
draw_return_ui();
goto_previous_ui();
}
#endif
else {
clear_cur_ui();
draw_return_ui();
goto_previous_ui();
}
}
@ -197,8 +190,7 @@ static void btn_cancel_event_cb(lv_obj_t *btn, lv_event_t event) {
}
else if (DIALOG_IS(TYPE_FILAMENT_LOAD_HEAT, TYPE_FILAMENT_UNLOAD_HEAT, TYPE_FILAMENT_HEAT_LOAD_COMPLETED, TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED)) {
thermalManager.setTargetHotend(uiCfg.hotendTargetTempBak, uiCfg.extruderIndex);
clear_cur_ui();
draw_return_ui();
goto_previous_ui();
}
else if (DIALOG_IS(TYPE_FILAMENT_LOADING, TYPE_FILAMENT_UNLOADING)) {
queue.enqueue_one(F("M410"));
@ -210,12 +202,10 @@ static void btn_cancel_event_cb(lv_obj_t *btn, lv_event_t event) {
uiCfg.filament_unloading_time_flg = false;
uiCfg.filament_unloading_time_cnt = 0;
thermalManager.setTargetHotend(uiCfg.hotendTargetTempBak, uiCfg.extruderIndex);
clear_cur_ui();
draw_return_ui();
goto_previous_ui();
}
else {
clear_cur_ui();
draw_return_ui();
goto_previous_ui();
}
}

View File

@ -106,8 +106,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
disp_ext_speed();
break;
case ID_E_RETURN:
clear_cur_ui();
draw_return_ui();
goto_previous_ui();
break;
}
}

View File

@ -55,7 +55,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
case ID_F_HIGH: fanPercent = 100; break;
case ID_F_MID: fanPercent = 50; break;
case ID_F_OFF: fanPercent = 0; break;
case ID_F_RETURN: clear_cur_ui(); draw_return_ui(); return;
case ID_F_RETURN: goto_previous_ui(); return;
}
thermalManager.set_fan_speed(0, map(fanPercent, 0, 100, 0, 255));
if (obj->mks_obj_id != ID_F_RETURN) disp_fan_value();

View File

@ -101,8 +101,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
planner.set_e_position_mm((destination.e = current_position.e = uiCfg.current_e_position_bak));
thermalManager.setTargetHotend(uiCfg.hotendTargetTempBak, uiCfg.extruderIndex);
clear_cur_ui();
draw_return_ui();
goto_previous_ui();
break;
}
}

View File

@ -67,8 +67,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
queue.inject(F("M84XY"));
break;
case ID_H_RETURN:
clear_cur_ui();
draw_return_ui();
goto_previous_ui();
break;
}
}

View File

@ -105,8 +105,7 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) {
}
else if (strcmp_P(txt, PSTR(LV_SYMBOL_CLOSE)) == 0) {
if (kb->event_cb != lv_kb_def_event_cb) {
lv_clear_keyboard();
draw_return_ui();
goto_previous_ui();
}
else {
lv_kb_set_ta(kb, nullptr); // De-assign the text area to hide its cursor if needed
@ -122,13 +121,11 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) {
#if ENABLED(MKS_WIFI_MODULE)
case wifiName:
memcpy(uiCfg.wifi_name, ret_ta_txt, sizeof(uiCfg.wifi_name));
lv_clear_keyboard();
draw_return_ui();
goto_previous_ui();
break;
case wifiPassWord:
memcpy(uiCfg.wifi_key, ret_ta_txt, sizeof(uiCfg.wifi_name));
lv_clear_keyboard();
draw_return_ui();
goto_previous_ui();
break;
case wifiConfig:
ZERO(uiCfg.wifi_name);
@ -160,8 +157,7 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) {
uint8_t buf[100];
strncpy((char *)buf, ret_ta_txt, sizeof(buf));
update_gcode_command(AUTO_LEVELING_COMMAND_ADDR, buf);
lv_clear_keyboard();
draw_return_ui();
goto_previous_ui();
break;
case GCodeCommand:
if (ret_ta_txt[0] && !queue.ring_buffer.full(3)) {

View File

@ -83,8 +83,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
disp_move_dist();
break;
case ID_M_RETURN:
clear_cur_ui();
draw_return_ui();
goto_previous_ui();
return;
}
disp_cur_pos();

View File

@ -453,8 +453,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
case ID_NUM_CONFIRM:
last_disp_state = NUMBER_KEY_UI;
if (strlen(key_value) != 0) set_value_confirm();
lv_clear_number_key();
draw_return_ui();
goto_previous_ui();
break;
}
}

View File

@ -90,8 +90,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
lv_draw_change_speed();
break;
case ID_O_RETURN:
clear_cur_ui();
draw_return_ui();
goto_previous_ui();
break;
case ID_O_POWER_OFF:
if (gCfgItems.finish_power_off) {

View File

@ -159,8 +159,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
disp_desire_temp();
break;
case ID_P_RETURN:
clear_cur_ui();
draw_return_ui();
goto_previous_ui();
break;
case ID_P_ABS:
if (uiCfg.curTempType == 0) {

View File

@ -99,8 +99,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
switch (obj->mks_obj_id) {
case ID_TC_RETURN:
TERN_(MKS_TEST, current_disp_ui = 1);
lv_clear_touch_calibration_screen();
draw_return_ui();
goto_previous_ui();
break;
}
}

View File

@ -54,8 +54,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
switch (obj->mks_obj_id) {
case ID_MANUAL_POS_RETURN:
uiCfg.para_ui_page = false;
lv_clear_tramming_pos_settings();
draw_return_ui();
goto_previous_ui();
return;
case ID_MANUAL_POS_X1:
value = level_pos_x1;

View File

@ -1082,6 +1082,11 @@ void draw_return_ui() {
}
}
void goto_previous_ui() {
clear_cur_ui();
draw_return_ui();
}
// Set the same image for both Released and Pressed
void lv_imgbtn_set_src_both(lv_obj_t *imgbtn, const void *src) {
lv_imgbtn_set_src(imgbtn, LV_BTN_STATE_REL, src);

View File

@ -467,6 +467,7 @@ void lv_eom_hook(void *);
void GUI_RefreshPage();
void clear_cur_ui();
void draw_return_ui();
void goto_previous_ui();
void sd_detection();
void gCfg_to_spiFlah();
void print_time_count();

View File

@ -47,8 +47,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_WIFI_RETURN:
lv_clear_wifi_settings();
draw_return_ui();
goto_previous_ui();
break;
case ID_WIFI_MODEL:
if (gCfgItems.wifi_mode_sel == AP_MODEL) {