More LVGL UI code reduction (#19879)

This commit is contained in:
Victor Oliveira 2020-10-24 19:28:31 -03:00 committed by Scott Lahteine
parent 676354f1d1
commit b586a30e7b
48 changed files with 74 additions and 462 deletions

View File

@ -185,7 +185,7 @@ void SPIFlashStorage::loadPage(uint8_t* buffer) {
// char fname[256]; // char fname[256];
// snprintf(fname, sizeof(fname), "./pages/page-%03d.data", m_currentPage); // snprintf(fname, sizeof(fname), "./pages/page-%03d.data", m_currentPage);
// FILE *fp = fopen(fname, "rb"); // FILE *fp = fopen(fname, "rb");
// if (fp != nullptr) { // if (fp) {
// fread(buffer, 1, SPI_FLASH_PageSize, fp); // fread(buffer, 1, SPI_FLASH_PageSize, fp);
// fclose(fp); // fclose(fp);
// } // }

View File

@ -49,17 +49,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_about(void) { void lv_draw_about(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != ABOUT_UI) { scr = lv_screen_create(ABOUT_UI);
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = ABOUT_UI;
}
disp_state = ABOUT_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
// Create an Image button // Create an Image button
lv_obj_t *buttonBack = lv_imgbtn_create(scr, "F:/bmp_return.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_A_RETURN); lv_obj_t *buttonBack = lv_imgbtn_create(scr, "F:/bmp_return.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_A_RETURN);

View File

@ -108,16 +108,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_acceleration_settings(void) { void lv_draw_acceleration_settings(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != ACCELERATION_UI) { scr = lv_screen_create(ACCELERATION_UI, machine_menu.AccelerationConfTitle);
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = ACCELERATION_UI;
}
disp_state = ACCELERATION_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.AccelerationConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
if (uiCfg.para_ui_page != 1) { if (uiCfg.para_ui_page != 1) {
sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.acceleration); sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.acceleration);

View File

@ -40,6 +40,7 @@ enum {
}; };
static void event_handler(lv_obj_t *obj, lv_event_t event) { static void event_handler(lv_obj_t *obj, lv_event_t event) {
if (event != LV_EVENT_RELEASED) return;
switch (obj->mks_obj_id) { switch (obj->mks_obj_id) {
case ID_ADVANCE_RETURN: case ID_ADVANCE_RETURN:
lv_clear_advance_settings(); lv_clear_advance_settings();
@ -69,17 +70,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_advance_settings(void) { void lv_draw_advance_settings(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != ADVANCED_UI) { scr = lv_screen_create(ADVANCED_UI, machine_menu.AdvancedConfTitle);
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = ADVANCED_UI;
}
disp_state = ADVANCED_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.AdvancedConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
int index = 0; int index = 0;
lv_screen_menu_item(scr, machine_menu.PausePosition, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_PAUSE_POS, index++); lv_screen_menu_item(scr, machine_menu.PausePosition, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_PAUSE_POS, index++);

View File

@ -65,17 +65,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_auto_level_offset_settings(void) { void lv_draw_auto_level_offset_settings(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != NOZZLE_PROBE_OFFSET_UI) { scr = lv_screen_create(NOZZLE_PROBE_OFFSET_UI, machine_menu.OffsetConfTitle);
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = NOZZLE_PROBE_OFFSET_UI;
}
disp_state = NOZZLE_PROBE_OFFSET_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.OffsetConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
sprintf_P(public_buf_l, PSTR("%.1f"), TERN(HAS_PROBE_XY_OFFSET, probe.offset.x, 0)); sprintf_P(public_buf_l, PSTR("%.1f"), TERN(HAS_PROBE_XY_OFFSET, probe.offset.x, 0));
lv_screen_menu_item_1_edit(scr, machine_menu.Xoffset, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_OFFSET_X, 0, public_buf_l); lv_screen_menu_item_1_edit(scr, machine_menu.Xoffset, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_OFFSET_X, 0, public_buf_l);

View File

@ -112,18 +112,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_baby_stepping(void) { void lv_draw_baby_stepping(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != BABY_STEP_UI) { scr = lv_screen_create(BABY_STEP_UI);
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = BABY_STEP_UI;
}
disp_state = BABY_STEP_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
lv_big_button_create(scr, "F:/bmp_xAdd.bin", move_menu.x_add, INTERVAL_V, titleHeight, event_handler, ID_BABY_STEP_X_P); lv_big_button_create(scr, "F:/bmp_xAdd.bin", move_menu.x_add, INTERVAL_V, titleHeight, event_handler, ID_BABY_STEP_X_P);
lv_big_button_create(scr, "F:/bmp_xDec.bin", move_menu.x_dec, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_BABY_STEP_X_N); lv_big_button_create(scr, "F:/bmp_xDec.bin", move_menu.x_dec, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_BABY_STEP_X_N);
lv_big_button_create(scr, "F:/bmp_yAdd.bin", move_menu.y_add, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_BABY_STEP_Y_P); lv_big_button_create(scr, "F:/bmp_yAdd.bin", move_menu.y_add, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_BABY_STEP_Y_P);

View File

@ -126,18 +126,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_change_speed(void) { void lv_draw_change_speed(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != CHANGE_SPEED_UI) { scr = lv_screen_create(CHANGE_SPEED_UI);
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = CHANGE_SPEED_UI;
}
disp_state = CHANGE_SPEED_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
// Create an Image button // Create an Image button
lv_big_button_create(scr, "F:/bmp_Add.bin", speed_menu.add, INTERVAL_V, titleHeight, event_handler, ID_C_ADD); lv_big_button_create(scr, "F:/bmp_Add.bin", speed_menu.add, INTERVAL_V, titleHeight, event_handler, ID_C_ADD);
lv_big_button_create(scr, "F:/bmp_Dec.bin", speed_menu.dec, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_C_DEC); lv_big_button_create(scr, "F:/bmp_Dec.bin", speed_menu.dec, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_C_DEC);

View File

@ -211,19 +211,8 @@ static void btn_cancel_event_cb(lv_obj_t *btn, lv_event_t event) {
void lv_draw_dialog(uint8_t type) { void lv_draw_dialog(uint8_t type) {
lv_obj_t *btnOk = nullptr, *btnCancel = nullptr; lv_obj_t *btnOk = nullptr, *btnCancel = nullptr;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != DIALOG_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = DIALOG_UI;
}
disp_state = DIALOG_UI;
uiCfg.dialogType = type; uiCfg.dialogType = type;
scr = lv_screen_create(DIALOG_UI);
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
lv_obj_t *labelDialog = lv_label_create_empty(scr); lv_obj_t *labelDialog = lv_label_create_empty(scr);

View File

@ -66,17 +66,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_eeprom_settings(void) { void lv_draw_eeprom_settings(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != EEPROM_SETTINGS_UI) { scr = lv_screen_create(EEPROM_SETTINGS_UI);
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = EEPROM_SETTINGS_UI;
}
disp_state = EEPROM_SETTINGS_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
lv_screen_menu_item(scr, eeprom_menu.revert, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_EEPROM_REVERT, 0); lv_screen_menu_item(scr, eeprom_menu.revert, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_EEPROM_REVERT, 0);
lv_screen_menu_item(scr, eeprom_menu.store, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_EEPROM_STORE, 1); lv_screen_menu_item(scr, eeprom_menu.store, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_EEPROM_STORE, 1);
lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, event_handler, ID_EEPROM_RETURN, true); lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, event_handler, ID_EEPROM_RETURN, true);

View File

@ -55,18 +55,8 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_encoder_settings(void) { void lv_draw_encoder_settings(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != ENCODER_SETTINGS_UI) { scr = lv_screen_create(ENCODER_SETTINGS_UI, machine_menu.EncoderConfTitle);
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = ENCODER_SETTINGS_UI;
}
disp_state = ENCODER_SETTINGS_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.EncoderConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
buttonEncoderState = lv_screen_menu_item_onoff(scr, machine_menu.EncoderConfText, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_ENCODER_STATE, 0, gCfgItems.encoder_enable); buttonEncoderState = lv_screen_menu_item_onoff(scr, machine_menu.EncoderConfText, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_ENCODER_STATE, 0, gCfgItems.encoder_enable);
lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, event_handler, ID_ENCODER_RETURN, true); lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y, event_handler, ID_ENCODER_RETURN, true);
} }

View File

@ -41,15 +41,8 @@ static lv_obj_t *scr;
void lv_draw_error_message(PGM_P const msg) { void lv_draw_error_message(PGM_P const msg) {
#if 0 #if 0
static lv_obj_t *message = nullptr, *kill_message = nullptr, *reset_tips = nullptr; static lv_obj_t *message = nullptr, *kill_message = nullptr, *reset_tips = nullptr;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != ERROR_MESSAGE_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = ERROR_MESSAGE_UI;
}
disp_state = ERROR_MESSAGE_UI;
scr = lv_screen_create(); scr = lv_screen_create(ERROR_MESSAGE_UI, "");
lv_refr_now(lv_refr_get_disp_refreshing());
if (msg) { if (msg) {
message = lv_label_create(scr, msg); message = lv_label_create(scr, msg);

View File

@ -122,18 +122,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_extrusion(void) { void lv_draw_extrusion(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != EXTRUSION_UI) { scr = lv_screen_create(EXTRUSION_UI);
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = EXTRUSION_UI;
}
disp_state = EXTRUSION_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
// Create image buttons // Create image buttons
lv_obj_t *buttonAdd = lv_big_button_create(scr, "F:/bmp_in.bin", extrude_menu.in, INTERVAL_V, titleHeight, event_handler, ID_E_ADD); lv_obj_t *buttonAdd = lv_big_button_create(scr, "F:/bmp_in.bin", extrude_menu.in, INTERVAL_V, titleHeight, event_handler, ID_E_ADD);
lv_obj_clear_protect(buttonAdd, LV_PROTECT_FOLLOW); lv_obj_clear_protect(buttonAdd, LV_PROTECT_FOLLOW);

View File

@ -89,18 +89,8 @@ void lv_draw_fan(void) {
#if HAS_FAN #if HAS_FAN
fanSpeed = thermalManager.fan_speed[0]; fanSpeed = thermalManager.fan_speed[0];
#endif #endif
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != FAN_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = FAN_UI;
}
disp_state = FAN_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
scr = lv_screen_create(FAN_UI);
// Create an Image button // Create an Image button
buttonAdd = lv_big_button_create(scr, "F:/bmp_Add.bin", fan_menu.add, INTERVAL_V, titleHeight, event_handler, ID_F_ADD); buttonAdd = lv_big_button_create(scr, "F:/bmp_Add.bin", fan_menu.add, INTERVAL_V, titleHeight, event_handler, ID_F_ADD);
lv_obj_clear_protect(buttonAdd, LV_PROTECT_FOLLOW); lv_obj_clear_protect(buttonAdd, LV_PROTECT_FOLLOW);

View File

@ -112,18 +112,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_filament_change(void) { void lv_draw_filament_change(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != FILAMENTCHANGE_UI) { scr = lv_screen_create(FILAMENTCHANGE_UI);
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = FILAMENTCHANGE_UI;
}
disp_state = FILAMENTCHANGE_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
// Create an Image button // Create an Image button
lv_obj_t *buttonIn = lv_big_button_create(scr, "F:/bmp_in.bin", filament_menu.in, INTERVAL_V, titleHeight, event_handler, ID_FILAMNT_IN); lv_obj_t *buttonIn = lv_big_button_create(scr, "F:/bmp_in.bin", filament_menu.in, INTERVAL_V, titleHeight, event_handler, ID_FILAMNT_IN);
lv_obj_clear_protect(buttonIn, LV_PROTECT_FOLLOW); lv_obj_clear_protect(buttonIn, LV_PROTECT_FOLLOW);

View File

@ -89,17 +89,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_filament_settings(void) { void lv_draw_filament_settings(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != FILAMENT_SETTINGS_UI) { scr = lv_screen_create(FILAMENT_SETTINGS_UI, machine_menu.FilamentConfTitle);
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = FILAMENT_SETTINGS_UI;
}
disp_state = FILAMENT_SETTINGS_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.FilamentConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
if (uiCfg.para_ui_page != 1) { if (uiCfg.para_ui_page != 1) {
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.filamentchange_load_length); sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.filamentchange_load_length);

View File

@ -77,18 +77,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_home(void) { void lv_draw_home(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != ZERO_UI) { scr = lv_screen_create(ZERO_UI);
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = ZERO_UI;
}
disp_state = ZERO_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
lv_big_button_create(scr, "F:/bmp_zeroAll.bin", home_menu.home_all, INTERVAL_V, titleHeight, event_handler, ID_H_ALL); lv_big_button_create(scr, "F:/bmp_zeroAll.bin", home_menu.home_all, INTERVAL_V, titleHeight, event_handler, ID_H_ALL);
lv_big_button_create(scr, "F:/bmp_zeroX.bin", home_menu.home_x, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_H_X); lv_big_button_create(scr, "F:/bmp_zeroX.bin", home_menu.home_x, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_H_X);
lv_big_button_create(scr, "F:/bmp_zeroY.bin", home_menu.home_y, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight, event_handler, ID_H_Y); lv_big_button_create(scr, "F:/bmp_zeroY.bin", home_menu.home_y, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight, event_handler, ID_H_Y);

View File

@ -75,15 +75,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_homing_sensitivity_settings(void) { void lv_draw_homing_sensitivity_settings(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != HOMING_SENSITIVITY_UI) { scr = lv_screen_create(HOMING_SENSITIVITY_UI, machine_menu.HomingSensitivityConfTitle);
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = HOMING_SENSITIVITY_UI;
}
disp_state = HOMING_SENSITIVITY_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.HomingSensitivityConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
sprintf_P(public_buf_l, PSTR("%d"), TERN(X_SENSORLESS, stepperX.homing_threshold(), 0)); sprintf_P(public_buf_l, PSTR("%d"), TERN(X_SENSORLESS, stepperX.homing_threshold(), 0));
lv_screen_menu_item_1_edit(scr, machine_menu.X_Sensitivity, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_SENSITIVITY_X, 0, public_buf_l); lv_screen_menu_item_1_edit(scr, machine_menu.X_Sensitivity, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_SENSITIVITY_X, 0, public_buf_l);

View File

@ -71,15 +71,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_jerk_settings(void) { void lv_draw_jerk_settings(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != JERK_UI) { scr = lv_screen_create(JERK_UI, machine_menu.JerkConfTitle);
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = JERK_UI;
}
disp_state = JERK_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.JerkConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
sprintf_P(public_buf_l, PSTR("%.1f"), planner.max_jerk[X_AXIS]); sprintf_P(public_buf_l, PSTR("%.1f"), planner.max_jerk[X_AXIS]);
lv_screen_menu_item_1_edit(scr, machine_menu.X_Jerk, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_JERK_X, 0, public_buf_l); lv_screen_menu_item_1_edit(scr, machine_menu.X_Jerk, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_JERK_X, 0, public_buf_l);

View File

@ -84,7 +84,7 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) {
if (lv_btnm_get_btn_ctrl(kb, btn_id, LV_BTNM_CTRL_NO_REPEAT) && event == LV_EVENT_LONG_PRESSED_REPEAT) return; if (lv_btnm_get_btn_ctrl(kb, btn_id, LV_BTNM_CTRL_NO_REPEAT) && event == LV_EVENT_LONG_PRESSED_REPEAT) return;
const char * txt = lv_btnm_get_active_btn_text(kb); const char * txt = lv_btnm_get_active_btn_text(kb);
if (txt == nullptr) return; if (!txt) return;
// Do the corresponding action according to the text of the button // Do the corresponding action according to the text of the button
if (strcmp(txt, "abc") == 0) { if (strcmp(txt, "abc") == 0) {
@ -169,14 +169,13 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) {
default: break; default: break;
} }
} }
else { else
lv_kb_set_ta(kb, nullptr); /*De-assign the text area to hide it cursor if needed*/ lv_kb_set_ta(kb, nullptr); // De-assign the text area to hide it cursor if needed
}
return; return;
} }
/*Add the characters to the text area if set*/ /*Add the characters to the text area if set*/
if (ext->ta == nullptr) return; if (!ext->ta) return;
if (strcmp(txt, "Enter") == 0 || strcmp(txt, LV_SYMBOL_NEW_LINE) == 0) if (strcmp(txt, "Enter") == 0 || strcmp(txt, LV_SYMBOL_NEW_LINE) == 0)
lv_ta_add_char(ext->ta, '\n'); lv_ta_add_char(ext->ta, '\n');
@ -213,15 +212,7 @@ static void lv_kb_event_cb(lv_obj_t *kb, lv_event_t event) {
} }
void lv_draw_keyboard() { void lv_draw_keyboard() {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != KEY_BOARD_UI) { scr = lv_screen_create(KEY_BOARD_UI, "");
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = KEY_BOARD_UI;
}
disp_state = KEY_BOARD_UI;
scr = lv_screen_create();
lv_refr_now(lv_refr_get_disp_refreshing());
/*Create styles for the keyboard*/ /*Create styles for the keyboard*/
static lv_style_t rel_style, pr_style; static lv_style_t rel_style, pr_style;

View File

@ -188,19 +188,7 @@ static void disp_language(uint8_t language, uint8_t state) {
} }
void lv_draw_language(void) { void lv_draw_language(void) {
scr = lv_screen_create(LANGUAGE_UI);
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != LANGUAGE_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = LANGUAGE_UI;
}
disp_state = LANGUAGE_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
// Create image buttons // Create image buttons
buttonCN = lv_big_button_create(scr, "F:/bmp_simplified_cn.bin", language_menu.chinese_s, INTERVAL_V, titleHeight, event_handler, ID_CN); buttonCN = lv_big_button_create(scr, "F:/bmp_simplified_cn.bin", language_menu.chinese_s, INTERVAL_V, titleHeight, event_handler, ID_CN);
lv_obj_clear_protect(buttonCN, LV_PROTECT_FOLLOW); lv_obj_clear_protect(buttonCN, LV_PROTECT_FOLLOW);
@ -211,7 +199,6 @@ void lv_draw_language(void) {
buttonFR = lv_big_button_create(scr, "F:/bmp_french.bin", language_menu.french, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_FR); buttonFR = lv_big_button_create(scr, "F:/bmp_french.bin", language_menu.french, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_FR);
buttonIT = lv_big_button_create(scr, "F:/bmp_italy.bin", language_menu.italy, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_IT); buttonIT = lv_big_button_create(scr, "F:/bmp_italy.bin", language_menu.italy, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_IT);
lv_big_button_create(scr, "F:/bmp_return.bin", common_menu.text_back, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_L_RETURN); lv_big_button_create(scr, "F:/bmp_return.bin", common_menu.text_back, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_L_RETURN);
disp_language(gCfgItems.language, SELECTED); disp_language(gCfgItems.language, SELECTED);
} }

View File

@ -39,6 +39,7 @@ enum {
}; };
static void event_handler(lv_obj_t *obj, lv_event_t event) { static void event_handler(lv_obj_t *obj, lv_event_t event) {
if (event != LV_EVENT_RELEASED) return;
switch (obj->mks_obj_id) { switch (obj->mks_obj_id) {
case ID_LEVEL_RETURN: case ID_LEVEL_RETURN:
lv_clear_level_settings(); lv_clear_level_settings();
@ -63,16 +64,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_level_settings(void) { void lv_draw_level_settings(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != LEVELING_PARA_UI) { scr = lv_screen_create(LEVELING_PARA_UI, machine_menu.LevelingParaConfTitle);
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = LEVELING_PARA_UI;
}
disp_state = LEVELING_PARA_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.LevelingParaConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
lv_screen_menu_item(scr, machine_menu.LevelingManuPosConf, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_LEVEL_POSITION, 0); lv_screen_menu_item(scr, machine_menu.LevelingManuPosConf, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_LEVEL_POSITION, 0);
lv_screen_menu_item(scr, machine_menu.LevelingAutoCommandConf, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_LEVEL_COMMAND, 1); lv_screen_menu_item(scr, machine_menu.LevelingAutoCommandConf, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_LEVEL_COMMAND, 1);
#if HAS_BED_PROBE #if HAS_BED_PROBE

View File

@ -66,17 +66,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_machine_para(void) { void lv_draw_machine_para(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != MACHINE_PARA_UI) { scr = lv_screen_create(MACHINE_PARA_UI);
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = MACHINE_PARA_UI;
}
disp_state = MACHINE_PARA_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
lv_screen_menu_item(scr, MachinePara_menu.MachineSetting, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_PARA_MACHINE, 0); lv_screen_menu_item(scr, MachinePara_menu.MachineSetting, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_PARA_MACHINE, 0);
lv_screen_menu_item(scr, MachinePara_menu.MotorSetting, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_PARA_MOTOR, 1); lv_screen_menu_item(scr, MachinePara_menu.MotorSetting, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_PARA_MOTOR, 1);
lv_screen_menu_item(scr, MachinePara_menu.leveling, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_PARA_LEVEL, 2); lv_screen_menu_item(scr, MachinePara_menu.leveling, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_PARA_LEVEL, 2);

View File

@ -63,18 +63,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_machine_settings(void) { void lv_draw_machine_settings(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != MACHINE_SETTINGS_UI) { scr = lv_screen_create(MACHINE_SETTINGS_UI, machine_menu.MachineConfigTitle);
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = MACHINE_SETTINGS_UI;
}
disp_state = MACHINE_SETTINGS_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.MachineConfigTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
lv_screen_menu_item(scr, machine_menu.AccelerationConf, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_MACHINE_ACCELERATION, 0); lv_screen_menu_item(scr, machine_menu.AccelerationConf, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_MACHINE_ACCELERATION, 0);
lv_screen_menu_item(scr, machine_menu.MaxFeedRateConf, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_MACHINE_FEEDRATE, 1); lv_screen_menu_item(scr, machine_menu.MaxFeedRateConf, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_MACHINE_FEEDRATE, 1);
#if HAS_CLASSIC_JERK #if HAS_CLASSIC_JERK

View File

@ -118,16 +118,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_manualLevel(void) { void lv_draw_manualLevel(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != LEVELING_UI) { scr = lv_screen_create(LEVELING_UI);
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = LEVELING_UI;
}
disp_state = LEVELING_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
// Create an Image button // Create an Image button
lv_obj_t *buttonPoint1 = lv_big_button_create(scr, "F:/bmp_leveling1.bin", leveling_menu.position1, INTERVAL_V, titleHeight, event_handler, ID_M_POINT1); lv_obj_t *buttonPoint1 = lv_big_button_create(scr, "F:/bmp_leveling1.bin", leveling_menu.position1, INTERVAL_V, titleHeight, event_handler, ID_M_POINT1);
lv_obj_clear_protect(buttonPoint1, LV_PROTECT_FOLLOW); lv_obj_clear_protect(buttonPoint1, LV_PROTECT_FOLLOW);

View File

@ -121,15 +121,8 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
void lv_draw_manual_level_pos_settings(void) { void lv_draw_manual_level_pos_settings(void) {
char buf2[50]; char buf2[50];
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != MANUAL_LEVELING_POSIGION_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = MANUAL_LEVELING_POSIGION_UI;
}
disp_state = MANUAL_LEVELING_POSIGION_UI;
scr = lv_screen_create(); scr = lv_screen_create(MANUAL_LEVELING_POSIGION_UI, machine_menu.LevelingParaConfTitle);
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.LevelingParaConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
if (uiCfg.para_ui_page != 1) { if (uiCfg.para_ui_page != 1) {
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.levelingPos[0][0]); sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.levelingPos[0][0]);

View File

@ -90,15 +90,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_max_feedrate_settings(void) { void lv_draw_max_feedrate_settings(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != MAXFEEDRATE_UI) { scr = lv_screen_create(MAXFEEDRATE_UI, machine_menu.MaxFeedRateConfTitle);
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = MAXFEEDRATE_UI;
}
disp_state = MAXFEEDRATE_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.MaxFeedRateConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
if (uiCfg.para_ui_page != 1) { if (uiCfg.para_ui_page != 1) {
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]);

View File

@ -73,19 +73,9 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_motor_settings(void) { void lv_draw_motor_settings(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != MOTOR_SETTINGS_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = MOTOR_SETTINGS_UI;
}
disp_state = MOTOR_SETTINGS_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.MotorConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
int index = 0; int index = 0;
scr = lv_screen_create(MOTOR_SETTINGS_UI, machine_menu.MotorConfTitle);
lv_screen_menu_item(scr, machine_menu.StepsConf, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_MOTOR_STEPS, index++); lv_screen_menu_item(scr, machine_menu.StepsConf, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_MOTOR_STEPS, index++);
#if USE_SENSORLESS #if USE_SENSORLESS
lv_screen_menu_item(scr, machine_menu.HomingSensitivityConf, PARA_UI_POS_X, PARA_UI_POS_Y * (index + 1), event_handler, ID_HOME_SENSE, index); lv_screen_menu_item(scr, machine_menu.HomingSensitivityConf, PARA_UI_POS_X, PARA_UI_POS_Y * (index + 1), event_handler, ID_HOME_SENSE, index);

View File

@ -115,18 +115,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_move_motor(void) { void lv_draw_move_motor(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != MOVE_MOTOR_UI) { scr = lv_screen_create(MOVE_MOTOR_UI);
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = MOVE_MOTOR_UI;
}
disp_state = MOVE_MOTOR_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
lv_obj_t *buttonXI = lv_big_button_create(scr, "F:/bmp_xAdd.bin", move_menu.x_add, INTERVAL_V, titleHeight, event_handler, ID_M_X_P); lv_obj_t *buttonXI = lv_big_button_create(scr, "F:/bmp_xAdd.bin", move_menu.x_add, INTERVAL_V, titleHeight, event_handler, ID_M_X_P);
lv_obj_clear_protect(buttonXI, LV_PROTECT_FOLLOW); lv_obj_clear_protect(buttonXI, LV_PROTECT_FOLLOW);
lv_big_button_create(scr, "F:/bmp_xDec.bin", move_menu.x_dec, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_M_X_N); lv_big_button_create(scr, "F:/bmp_xDec.bin", move_menu.x_dec, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_M_X_N);

View File

@ -662,17 +662,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_number_key(void) { void lv_draw_number_key(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != NUMBER_KEY_UI) { scr = lv_screen_create(NUMBER_KEY_UI, "");
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = NUMBER_KEY_UI;
}
disp_state = NUMBER_KEY_UI;
scr = lv_screen_create();
//(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
buttonValue = lv_btn_create(scr, 92, 40, 296, 40, event_handler, ID_NUM_KEY1, &style_num_text); buttonValue = lv_btn_create(scr, 92, 40, 296, 40, event_handler, ID_NUM_KEY1, &style_num_text);
labelValue = lv_label_create_empty(buttonValue); labelValue = lv_label_create_empty(buttonValue);

View File

@ -129,17 +129,7 @@ void lv_draw_operation(void) {
*buttonBabyStep = nullptr, *label_BabyStep = nullptr, *buttonBabyStep = nullptr, *label_BabyStep = nullptr,
*label_Filament = nullptr; *label_Filament = nullptr;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != OPERATE_UI) { scr = lv_screen_create(OPERATE_UI);
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = OPERATE_UI;
}
disp_state = OPERATE_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
// Create image buttons // Create image buttons
lv_obj_t *buttonPreHeat = lv_imgbtn_create(scr, "F:/bmp_temp.bin", INTERVAL_V, titleHeight, event_handler, ID_O_PRE_HEAT); lv_obj_t *buttonPreHeat = lv_imgbtn_create(scr, "F:/bmp_temp.bin", INTERVAL_V, titleHeight, event_handler, ID_O_PRE_HEAT);

View File

@ -65,15 +65,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_pause_position(void) { void lv_draw_pause_position(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != PAUSE_POS_UI) { scr = lv_screen_create(PAUSE_POS_UI, machine_menu.PausePosText);
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = PAUSE_POS_UI;
}
disp_state = PAUSE_POS_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.PausePosText);
lv_refr_now(lv_refr_get_disp_refreshing());
sprintf_P(public_buf_l, PSTR("%.1f"), gCfgItems.pausePosX); sprintf_P(public_buf_l, PSTR("%.1f"), gCfgItems.pausePosX);
lv_screen_menu_item_1_edit(scr, machine_menu.xPos, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_PAUSE_X, 0, public_buf_l); lv_screen_menu_item_1_edit(scr, machine_menu.xPos, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_PAUSE_X, 0, public_buf_l);

View File

@ -158,17 +158,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_preHeat(void) { void lv_draw_preHeat(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != PRE_HEAT_UI) { scr = lv_screen_create(PRE_HEAT_UI);
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = PRE_HEAT_UI;
}
disp_state = PRE_HEAT_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
// Create image buttons // Create image buttons
lv_big_button_create(scr, "F:/bmp_Add.bin", preheat_menu.add, INTERVAL_V, titleHeight, event_handler, ID_P_ADD); lv_big_button_create(scr, "F:/bmp_Add.bin", preheat_menu.add, INTERVAL_V, titleHeight, event_handler, ID_P_ADD);

View File

@ -252,10 +252,7 @@ static char test_public_buf_l[40];
void disp_gcode_icon(uint8_t file_num) { void disp_gcode_icon(uint8_t file_num) {
uint8_t i; uint8_t i;
scr = lv_screen_create(); scr = lv_screen_create(MAIN_UI, "");
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
// Create image buttons // Create image buttons
buttonPageUp = lv_imgbtn_create(scr, "F:/bmp_pageUp.bin", OTHER_BTN_XPIEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_P_UP); buttonPageUp = lv_imgbtn_create(scr, "F:/bmp_pageUp.bin", OTHER_BTN_XPIEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_P_UP);

View File

@ -121,15 +121,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
void lv_draw_printing(void) { void lv_draw_printing(void) {
disp_state_stack._disp_index = 0; disp_state_stack._disp_index = 0;
ZERO(disp_state_stack._disp_state); ZERO(disp_state_stack._disp_state);
disp_state_stack._disp_state[disp_state_stack._disp_index] = PRINTING_UI; scr = lv_screen_create(PRINTING_UI);
disp_state = PRINTING_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
// Create image buttons // Create image buttons
lv_obj_t *buttonExt1 = lv_img_create(scr, nullptr); lv_obj_t *buttonExt1 = lv_img_create(scr, nullptr);

View File

@ -122,13 +122,8 @@ void lv_draw_ready_print(void) {
disp_state_stack._disp_index = 0; disp_state_stack._disp_index = 0;
ZERO(disp_state_stack._disp_state); ZERO(disp_state_stack._disp_state);
disp_state_stack._disp_state[disp_state_stack._disp_index] = PRINT_READY_UI; scr = lv_screen_create(PRINT_READY_UI, "");
disp_state = PRINT_READY_UI;
scr = lv_screen_create();
//lv_obj_set_hidden(scr, true); //lv_obj_set_hidden(scr, true);
lv_refr_now(lv_refr_get_disp_refreshing());
if (mks_test_flag == 0x1E) { if (mks_test_flag == 0x1E) {
//(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text()); //(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());

View File

@ -126,18 +126,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_set(void) { void lv_draw_set(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != SET_UI) { scr = lv_screen_create(SET_UI);
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = SET_UI;
}
disp_state = SET_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
lv_big_button_create(scr, "F:/bmp_eeprom_settings.bin", set_menu.eepromSet, INTERVAL_V, titleHeight, event_handler, ID_S_EEPROM_SET); lv_big_button_create(scr, "F:/bmp_eeprom_settings.bin", set_menu.eepromSet, INTERVAL_V, titleHeight, event_handler, ID_S_EEPROM_SET);
lv_big_button_create(scr, "F:/bmp_fan.bin", set_menu.fan, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_S_FAN); lv_big_button_create(scr, "F:/bmp_fan.bin", set_menu.fan, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_S_FAN);
lv_big_button_create(scr, "F:/bmp_about.bin", set_menu.about, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight, event_handler, ID_S_ABOUT); lv_big_button_create(scr, "F:/bmp_about.bin", set_menu.about, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight, event_handler, ID_S_ABOUT);

View File

@ -90,15 +90,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_step_settings(void) { void lv_draw_step_settings(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != STEPS_UI) { scr = lv_screen_create(STEPS_UI, machine_menu.StepsConfTitle);
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = STEPS_UI;
}
disp_state = STEPS_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.StepsConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
if (uiCfg.para_ui_page != 1) { if (uiCfg.para_ui_page != 1) {
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]);

View File

@ -103,15 +103,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_tmc_current_settings(void) { void lv_draw_tmc_current_settings(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != TMC_CURRENT_UI) { scr = lv_screen_create(TMC_CURRENT_UI, machine_menu.TmcCurrentConfTitle);
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = TMC_CURRENT_UI;
}
disp_state = TMC_CURRENT_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.TmcCurrentConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
float milliamps; float milliamps;
if (uiCfg.para_ui_page != 1) { if (uiCfg.para_ui_page != 1) {

View File

@ -112,15 +112,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
void lv_draw_tmc_step_mode_settings(void) { void lv_draw_tmc_step_mode_settings(void) {
buttonXState = buttonYState = buttonZState = buttonE0State = buttonE1State = nullptr; buttonXState = buttonYState = buttonZState = buttonE0State = buttonE1State = nullptr;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != TMC_MODE_UI) { scr = lv_screen_create(TMC_MODE_UI, machine_menu.TmcStepModeConfTitle);
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = TMC_MODE_UI;
}
disp_state = TMC_MODE_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.TmcStepModeConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
bool stealth_X = false, stealth_Y = false, stealth_Z = false, stealth_E0 = false, stealth_E1 = false; bool stealth_X = false, stealth_Y = false, stealth_Z = false, stealth_E0 = false, stealth_E1 = false;
#if AXIS_HAS_STEALTHCHOP(X) #if AXIS_HAS_STEALTHCHOP(X)

View File

@ -99,24 +99,11 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_tool(void) { void lv_draw_tool(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != TOOL_UI) { scr = lv_screen_create(TOOL_UI);
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = TOOL_UI;
}
disp_state = TOOL_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
lv_big_button_create(scr, "F:/bmp_preHeat.bin", tool_menu.preheat, INTERVAL_V, titleHeight, event_handler, ID_T_PRE_HEAT); lv_big_button_create(scr, "F:/bmp_preHeat.bin", tool_menu.preheat, INTERVAL_V, titleHeight, event_handler, ID_T_PRE_HEAT);
lv_big_button_create(scr, "F:/bmp_extruct.bin", tool_menu.extrude, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_T_EXTRUCT); lv_big_button_create(scr, "F:/bmp_extruct.bin", tool_menu.extrude, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight, event_handler, ID_T_EXTRUCT);
lv_big_button_create(scr, "F:/bmp_mov.bin", tool_menu.move, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight, event_handler, ID_T_MOV); lv_big_button_create(scr, "F:/bmp_mov.bin", tool_menu.move, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight, event_handler, ID_T_MOV);
lv_big_button_create(scr, "F:/bmp_zero.bin", tool_menu.home, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_T_HOME); lv_big_button_create(scr, "F:/bmp_zero.bin", tool_menu.home, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight, event_handler, ID_T_HOME);
lv_big_button_create(scr, "F:/bmp_leveling.bin", tool_menu.TERN(AUTO_BED_LEVELING_BILINEAR, autoleveling, leveling), INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_T_LEVELING); lv_big_button_create(scr, "F:/bmp_leveling.bin", tool_menu.TERN(AUTO_BED_LEVELING_BILINEAR, autoleveling, leveling), INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_T_LEVELING);
lv_big_button_create(scr, "F:/bmp_filamentchange.bin", tool_menu.filament, BTN_X_PIXEL+INTERVAL_V*2,BTN_Y_PIXEL+INTERVAL_H+titleHeight, event_handler,ID_T_FILAMENT); lv_big_button_create(scr, "F:/bmp_filamentchange.bin", tool_menu.filament, BTN_X_PIXEL+INTERVAL_V*2,BTN_Y_PIXEL+INTERVAL_H+titleHeight, event_handler,ID_T_FILAMENT);
lv_big_button_create(scr, "F:/bmp_return.bin", common_menu.text_back, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_T_RETURN); lv_big_button_create(scr, "F:/bmp_return.bin", common_menu.text_back, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_T_RETURN);

View File

@ -1628,11 +1628,29 @@ void lv_btn_set_style_both(lv_obj_t *btn, lv_style_t *style) {
} }
// Create a screen // Create a screen
lv_obj_t* lv_screen_create() { lv_obj_t* lv_screen_create(DISP_STATE newScreenType, const char* title) {
lv_obj_t *scr = lv_obj_create(nullptr, nullptr); lv_obj_t *scr = lv_obj_create(nullptr, nullptr);
lv_obj_set_style(scr, &tft_style_scr); lv_obj_set_style(scr, &tft_style_scr);
lv_scr_load(scr); lv_scr_load(scr);
lv_obj_clean(scr); lv_obj_clean(scr);
// breadcrumbs
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != newScreenType) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = newScreenType;
}
disp_state = newScreenType;
lv_refr_now(lv_refr_get_disp_refreshing());
// title
lv_obj_t *titleLabel = nullptr;
if (!title)
titleLabel = lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
else if (title[0] != '\0')
titleLabel = lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, title);
if (titleLabel)
lv_obj_set_style(titleLabel, &tft_style_label_rel);
return scr; return scr;
} }

View File

@ -468,7 +468,7 @@ void lv_btn_use_label_style(lv_obj_t *btn);
void lv_btn_set_style_both(lv_obj_t *btn, lv_style_t *style); void lv_btn_set_style_both(lv_obj_t *btn, lv_style_t *style);
// Create a screen // Create a screen
lv_obj_t* lv_screen_create(); lv_obj_t* lv_screen_create(DISP_STATE newScreenType, const char* title = nullptr);
// Create an empty label // Create an empty label
lv_obj_t* lv_label_create_empty(lv_obj_t *par); lv_obj_t* lv_label_create_empty(lv_obj_t *par);

View File

@ -58,17 +58,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_wifi(void) { void lv_draw_wifi(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != WIFI_UI) { scr = lv_screen_create(WIFI_UI);
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = WIFI_UI;
}
disp_state = WIFI_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
// Create an Image button // Create an Image button
lv_obj_t *buttonBack = lv_imgbtn_create(scr, "F:/bmp_return.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_W_RETURN); lv_obj_t *buttonBack = lv_imgbtn_create(scr, "F:/bmp_return.bin", BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight, event_handler, ID_W_RETURN);

View File

@ -89,17 +89,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_wifi_list(void) { void lv_draw_wifi_list(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != WIFI_LIST_UI) { scr = lv_screen_create(WIFI_LIST_UI);
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = WIFI_LIST_UI;
}
disp_state = WIFI_LIST_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
lv_obj_t *buttonDown = lv_imgbtn_create(scr, "F:/bmp_pageDown.bin", OTHER_BTN_XPIEL * 3 + INTERVAL_V * 4, titleHeight + OTHER_BTN_YPIEL + INTERVAL_H, event_handler, ID_WL_DOWN); lv_obj_t *buttonDown = lv_imgbtn_create(scr, "F:/bmp_pageDown.bin", OTHER_BTN_XPIEL * 3 + INTERVAL_V * 4, titleHeight + OTHER_BTN_YPIEL + INTERVAL_H, event_handler, ID_WL_DOWN);
lv_obj_t *buttonBack = lv_imgbtn_create(scr, "F:/bmp_back.bin", OTHER_BTN_XPIEL * 3 + INTERVAL_V * 4, titleHeight + (OTHER_BTN_YPIEL + INTERVAL_H) * 2, event_handler, ID_WL_RETURN); lv_obj_t *buttonBack = lv_imgbtn_create(scr, "F:/bmp_back.bin", OTHER_BTN_XPIEL * 3 + INTERVAL_V * 4, titleHeight + (OTHER_BTN_YPIEL + INTERVAL_H) * 2, event_handler, ID_WL_RETURN);

View File

@ -94,17 +94,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
} }
void lv_draw_wifi_settings(void) { void lv_draw_wifi_settings(void) {
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != WIFI_SETTINGS_UI) { scr = lv_screen_create(WIFI_SETTINGS_UI, machine_menu.WifiConfTitle);
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = WIFI_SETTINGS_UI;
}
disp_state = WIFI_SETTINGS_UI;
scr = lv_screen_create();
(void)lv_label_create(scr, TITLE_XPOS, TITLE_YPOS, machine_menu.WifiConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
lv_obj_t *labelModelText = lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y + 10, machine_menu.wifiMode); lv_obj_t *labelModelText = lv_label_create(scr, PARA_UI_POS_X, PARA_UI_POS_Y + 10, machine_menu.wifiMode);

View File

@ -39,14 +39,7 @@ tips_menu_def tips_menu;
void lv_draw_wifi_tips(void) { void lv_draw_wifi_tips(void) {
static lv_obj_t *text_tips,*wifi_name; static lv_obj_t *text_tips,*wifi_name;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != WIFI_TIPS_UI) { scr = lv_screen_create(WIFI_TIPS_UI, "");
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = WIFI_TIPS_UI;
}
disp_state = WIFI_TIPS_UI;
scr = lv_screen_create();
lv_refr_now(lv_refr_get_disp_refreshing());
wifi_name = lv_label_create(scr, (const char *)wifi_list.wifiName[wifi_list.nameIndex]); wifi_name = lv_label_create(scr, (const char *)wifi_list.wifiName[wifi_list.nameIndex]);
lv_obj_align(wifi_name, nullptr, LV_ALIGN_CENTER, 0, -20); lv_obj_align(wifi_name, nullptr, LV_ALIGN_CENTER, 0, -20);

View File

@ -53,7 +53,7 @@ WifiSerial::WifiSerial(usart_dev *usart_device, uint8 tx_pin, uint8 rx_pin) {
/* F1 MCUs have no GPIO_AFR[HL], so turn off PWM if there's a conflict /* F1 MCUs have no GPIO_AFR[HL], so turn off PWM if there's a conflict
* on this GPIO bit. */ * on this GPIO bit. */
static void disable_timer_if_necessary(timer_dev *dev, uint8 ch) { static void disable_timer_if_necessary(timer_dev *dev, uint8 ch) {
if (dev != nullptr) timer_set_mode(dev, ch, TIMER_DISABLED); if (dev) timer_set_mode(dev, ch, TIMER_DISABLED);
} }
#elif STM32_MCU_SERIES == STM32_SERIES_F2 || STM32_MCU_SERIES == STM32_SERIES_F4 #elif STM32_MCU_SERIES == STM32_SERIES_F2 || STM32_MCU_SERIES == STM32_SERIES_F4
#define disable_timer_if_necessary(dev, ch) ((void)0) #define disable_timer_if_necessary(dev, ch) ((void)0)

View File

@ -533,12 +533,8 @@ EspUploadResult flashFinish(signed char reboot) {
// Compute the checksum of a block of data // Compute the checksum of a block of data
uint16_t checksum(const uint8_t *data, uint16_t dataLen, uint16_t cksum) { uint16_t checksum(const uint8_t *data, uint16_t dataLen, uint16_t cksum) {
if (data != nullptr) { if (data) while (dataLen--) cksum ^= (uint16_t)*data++;
while (dataLen--) { return cksum;
cksum ^= (uint16_t)*data++;
}
}
return(cksum);
} }
EspUploadResult flashWriteBlock(uint16_t flashParmVal, uint16_t flashParmMask) { EspUploadResult flashWriteBlock(uint16_t flashParmVal, uint16_t flashParmMask) {