Browse Source

🎨 Add MKS UI goto_previous_ui

vanilla_fb_2.0.x
Scott Lahteine 3 years ago
committed by Scott Lahteine
parent
commit
de77dfcbbd
  1. 3
      Marlin/src/lcd/extui/mks_ui/draw_about.cpp
  2. 3
      Marlin/src/lcd/extui/mks_ui/draw_baby_stepping.cpp
  3. 3
      Marlin/src/lcd/extui/mks_ui/draw_change_speed.cpp
  4. 3
      Marlin/src/lcd/extui/mks_ui/draw_cloud_bind.cpp
  5. 30
      Marlin/src/lcd/extui/mks_ui/draw_dialog.cpp
  6. 3
      Marlin/src/lcd/extui/mks_ui/draw_extrusion.cpp
  7. 2
      Marlin/src/lcd/extui/mks_ui/draw_fan.cpp
  8. 3
      Marlin/src/lcd/extui/mks_ui/draw_filament_change.cpp
  9. 3
      Marlin/src/lcd/extui/mks_ui/draw_home.cpp
  10. 12
      Marlin/src/lcd/extui/mks_ui/draw_keyboard.cpp
  11. 3
      Marlin/src/lcd/extui/mks_ui/draw_move_motor.cpp
  12. 3
      Marlin/src/lcd/extui/mks_ui/draw_number_key.cpp
  13. 3
      Marlin/src/lcd/extui/mks_ui/draw_operation.cpp
  14. 3
      Marlin/src/lcd/extui/mks_ui/draw_preHeat.cpp
  15. 3
      Marlin/src/lcd/extui/mks_ui/draw_touch_calibration.cpp
  16. 3
      Marlin/src/lcd/extui/mks_ui/draw_tramming_pos_settings.cpp
  17. 5
      Marlin/src/lcd/extui/mks_ui/draw_ui.cpp
  18. 1
      Marlin/src/lcd/extui/mks_ui/draw_ui.h
  19. 3
      Marlin/src/lcd/extui/mks_ui/draw_wifi_settings.cpp

3
Marlin/src/lcd/extui/mks_ui/draw_about.cpp

@ -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;
}
}

3
Marlin/src/lcd/extui/mks_ui/draw_baby_stepping.cpp

@ -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;
}
}

3
Marlin/src/lcd/extui/mks_ui/draw_change_speed.cpp

@ -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;
}
}

3
Marlin/src/lcd/extui/mks_ui/draw_cloud_bind.cpp

@ -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) {

30
Marlin/src/lcd/extui/mks_ui/draw_dialog.cpp

@ -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();
}
}

3
Marlin/src/lcd/extui/mks_ui/draw_extrusion.cpp

@ -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;
}
}

2
Marlin/src/lcd/extui/mks_ui/draw_fan.cpp

@ -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();

3
Marlin/src/lcd/extui/mks_ui/draw_filament_change.cpp

@ -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;
}
}

3
Marlin/src/lcd/extui/mks_ui/draw_home.cpp

@ -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;
}
}

12
Marlin/src/lcd/extui/mks_ui/draw_keyboard.cpp

@ -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)) {

3
Marlin/src/lcd/extui/mks_ui/draw_move_motor.cpp

@ -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();

3
Marlin/src/lcd/extui/mks_ui/draw_number_key.cpp

@ -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;
}
}

3
Marlin/src/lcd/extui/mks_ui/draw_operation.cpp

@ -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) {

3
Marlin/src/lcd/extui/mks_ui/draw_preHeat.cpp

@ -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) {

3
Marlin/src/lcd/extui/mks_ui/draw_touch_calibration.cpp

@ -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;
}
}

3
Marlin/src/lcd/extui/mks_ui/draw_tramming_pos_settings.cpp

@ -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;

5
Marlin/src/lcd/extui/mks_ui/draw_ui.cpp

@ -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);

1
Marlin/src/lcd/extui/mks_ui/draw_ui.h

@ -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();

3
Marlin/src/lcd/extui/mks_ui/draw_wifi_settings.cpp

@ -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) {

Loading…
Cancel
Save