2020-06-16 02:05:33 +00:00
|
|
|
/**
|
|
|
|
* Marlin 3D Printer Firmware
|
|
|
|
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
|
|
*
|
|
|
|
* Based on Sprinter and grbl.
|
|
|
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2020-07-23 03:20:14 +00:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2020-06-16 02:05:33 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* draw_dialog.cpp
|
|
|
|
*/
|
|
|
|
|
2021-05-06 09:17:59 +00:00
|
|
|
#include "../../../inc/MarlinConfigPre.h"
|
2020-06-16 02:05:33 +00:00
|
|
|
|
2020-07-25 05:52:07 +00:00
|
|
|
#if HAS_TFT_LVGL_UI
|
2020-06-16 02:05:33 +00:00
|
|
|
|
|
|
|
#include "draw_ui.h"
|
2020-10-21 17:45:27 +00:00
|
|
|
#include <lv_conf.h>
|
2020-07-25 05:52:07 +00:00
|
|
|
|
2021-05-06 09:17:59 +00:00
|
|
|
#include "../../../sd/cardreader.h"
|
|
|
|
#include "../../../gcode/queue.h"
|
|
|
|
#include "../../../module/temperature.h"
|
|
|
|
#include "../../../module/planner.h"
|
|
|
|
#include "../../../gcode/gcode.h"
|
|
|
|
#include "../../../inc/MarlinConfig.h"
|
2020-06-16 02:05:33 +00:00
|
|
|
|
2020-10-23 01:22:17 +00:00
|
|
|
#if ENABLED(EEPROM_SETTINGS)
|
2021-05-06 09:17:59 +00:00
|
|
|
#include "../../../module/settings.h"
|
2020-10-23 01:22:17 +00:00
|
|
|
#endif
|
|
|
|
|
2020-06-16 02:05:33 +00:00
|
|
|
#if ENABLED(POWER_LOSS_RECOVERY)
|
2021-05-06 09:17:59 +00:00
|
|
|
#include "../../../feature/powerloss.h"
|
2020-06-16 02:05:33 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(PARK_HEAD_ON_PAUSE)
|
2021-05-06 09:17:59 +00:00
|
|
|
#include "../../../feature/pause.h"
|
2020-06-16 02:05:33 +00:00
|
|
|
#endif
|
|
|
|
|
2020-12-22 12:17:06 +00:00
|
|
|
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
|
2021-05-06 09:17:59 +00:00
|
|
|
#include "../../tft_io/touch_calibration.h"
|
2020-12-22 12:17:06 +00:00
|
|
|
#include "draw_touch_calibration.h"
|
|
|
|
#endif
|
|
|
|
|
2020-10-24 04:37:45 +00:00
|
|
|
extern lv_group_t *g;
|
|
|
|
static lv_obj_t *scr, *tempText1, *filament_bar;
|
2020-09-21 01:55:02 +00:00
|
|
|
|
2020-06-16 02:05:33 +00:00
|
|
|
extern uint8_t sel_id;
|
2020-10-21 17:45:27 +00:00
|
|
|
extern bool once_flag, gcode_preview_over;
|
2020-10-24 04:37:45 +00:00
|
|
|
extern int upload_result;
|
2021-07-13 00:17:28 +00:00
|
|
|
extern uint32_t upload_time_sec;
|
2020-09-21 01:55:02 +00:00
|
|
|
extern uint32_t upload_size;
|
2020-10-24 04:37:45 +00:00
|
|
|
extern bool temps_update_flag;
|
2020-06-16 02:05:33 +00:00
|
|
|
|
2021-03-26 20:41:55 +00:00
|
|
|
//#define CANCEL_ON_RIGHT // Put 'Cancel' on the right (as it was before)
|
|
|
|
|
|
|
|
#define BTN_OK_X TERN(CANCEL_ON_RIGHT, 100, 280)
|
|
|
|
#define BTN_CANCEL_X TERN(CANCEL_ON_RIGHT, 280, 100)
|
|
|
|
#define BTN_OK_Y 180
|
|
|
|
#define BTN_CANCEL_Y 180
|
|
|
|
|
2020-10-24 04:37:45 +00:00
|
|
|
static void btn_ok_event_cb(lv_obj_t *btn, lv_event_t event) {
|
|
|
|
if (event != LV_EVENT_RELEASED) return;
|
|
|
|
if (DIALOG_IS(TYPE_PRINT_FILE)) {
|
|
|
|
#if HAS_GCODE_PREVIEW
|
|
|
|
preview_gcode_prehandle(list_file.file_name[sel_id]);
|
|
|
|
#endif
|
|
|
|
reset_print_time();
|
|
|
|
start_print_time();
|
|
|
|
|
|
|
|
uiCfg.print_state = WORKING;
|
|
|
|
lv_clear_dialog();
|
|
|
|
lv_draw_printing();
|
|
|
|
|
|
|
|
#if ENABLED(SDSUPPORT)
|
|
|
|
if (!gcode_preview_over) {
|
|
|
|
char *cur_name;
|
|
|
|
cur_name = strrchr(list_file.file_name[sel_id], '/');
|
|
|
|
|
|
|
|
SdFile file, *curDir;
|
2021-05-08 09:35:35 +00:00
|
|
|
card.abortFilePrintNow();
|
|
|
|
const char * const fname = card.diveToFile(false, curDir, cur_name);
|
2020-10-24 04:37:45 +00:00
|
|
|
if (!fname) return;
|
|
|
|
if (file.open(curDir, fname, O_READ)) {
|
|
|
|
gCfgItems.curFilesize = file.fileSize();
|
|
|
|
file.close();
|
|
|
|
update_spi_flash();
|
|
|
|
}
|
|
|
|
card.openFileRead(cur_name);
|
|
|
|
if (card.isFileOpen()) {
|
|
|
|
feedrate_percentage = 100;
|
|
|
|
planner.flow_percentage[0] = 100;
|
|
|
|
planner.e_factor[0] = planner.flow_percentage[0] * 0.01f;
|
|
|
|
#if HAS_MULTI_EXTRUDER
|
|
|
|
planner.flow_percentage[1] = 100;
|
|
|
|
planner.e_factor[1] = planner.flow_percentage[1] * 0.01f;
|
|
|
|
#endif
|
2021-05-08 09:35:35 +00:00
|
|
|
card.startOrResumeFilePrinting();
|
2020-10-24 04:37:45 +00:00
|
|
|
#if ENABLED(POWER_LOSS_RECOVERY)
|
|
|
|
recovery.prepare();
|
|
|
|
#endif
|
|
|
|
once_flag = false;
|
2020-06-16 02:05:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2020-10-24 04:37:45 +00:00
|
|
|
}
|
|
|
|
else if (DIALOG_IS(TYPE_STOP)) {
|
|
|
|
wait_for_heatup = false;
|
|
|
|
stop_print_time();
|
|
|
|
lv_clear_dialog();
|
|
|
|
lv_draw_ready_print();
|
|
|
|
|
|
|
|
#if ENABLED(SDSUPPORT)
|
2021-05-08 09:35:35 +00:00
|
|
|
uiCfg.print_state = IDLE;
|
|
|
|
card.abortFilePrintSoon();
|
2020-10-24 04:37:45 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else if (DIALOG_IS(TYPE_FINISH_PRINT)) {
|
|
|
|
clear_cur_ui();
|
|
|
|
lv_draw_ready_print();
|
|
|
|
}
|
|
|
|
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
|
|
|
else if (DIALOG_IS(PAUSE_MESSAGE_WAITING, PAUSE_MESSAGE_INSERT, PAUSE_MESSAGE_HEAT))
|
|
|
|
wait_for_user = false;
|
|
|
|
else if (DIALOG_IS(PAUSE_MESSAGE_OPTION))
|
|
|
|
pause_menu_response = PAUSE_RESPONSE_EXTRUDE_MORE;
|
|
|
|
else if (DIALOG_IS(PAUSE_MESSAGE_RESUME)) {
|
2020-09-21 01:55:02 +00:00
|
|
|
clear_cur_ui();
|
|
|
|
draw_return_ui();
|
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
#endif
|
|
|
|
else if (DIALOG_IS(STORE_EEPROM_TIPS)) {
|
|
|
|
TERN_(EEPROM_SETTINGS, (void)settings.save());
|
|
|
|
clear_cur_ui();
|
|
|
|
draw_return_ui();
|
|
|
|
}
|
|
|
|
else if (DIALOG_IS(READ_EEPROM_TIPS)) {
|
|
|
|
TERN_(EEPROM_SETTINGS, (void)settings.load());
|
|
|
|
clear_cur_ui();
|
|
|
|
draw_return_ui();
|
|
|
|
}
|
|
|
|
else if (DIALOG_IS(REVERT_EEPROM_TIPS)) {
|
|
|
|
TERN_(EEPROM_SETTINGS, (void)settings.reset());
|
|
|
|
clear_cur_ui();
|
2020-12-22 12:17:06 +00:00
|
|
|
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
|
|
|
|
const bool do_draw_cal = touch_calibration.need_calibration();
|
|
|
|
if (do_draw_cal) {
|
|
|
|
disp_state_stack._disp_index--; // We are asynchronous from the dialog, so let's remove the dialog from the stack
|
|
|
|
lv_draw_touch_calibration_screen();
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
constexpr bool do_draw_cal = false;
|
|
|
|
#endif
|
|
|
|
if (!do_draw_cal) draw_return_ui();
|
2020-10-24 04:37:45 +00:00
|
|
|
}
|
|
|
|
else if (DIALOG_IS(WIFI_CONFIG_TIPS)) {
|
2021-01-17 02:43:46 +00:00
|
|
|
uiCfg.configWifi = true;
|
2020-10-24 04:37:45 +00:00
|
|
|
clear_cur_ui();
|
|
|
|
draw_return_ui();
|
|
|
|
}
|
|
|
|
else if (DIALOG_IS(TYPE_FILAMENT_HEAT_LOAD_COMPLETED))
|
2021-01-17 02:43:46 +00:00
|
|
|
uiCfg.filament_heat_completed_load = true;
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED))
|
2021-01-17 02:43:46 +00:00
|
|
|
uiCfg.filament_heat_completed_unload = true;
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(TYPE_FILAMENT_LOAD_COMPLETED, TYPE_FILAMENT_UNLOAD_COMPLETED)) {
|
|
|
|
clear_cur_ui();
|
|
|
|
draw_return_ui();
|
2020-06-16 02:05:33 +00:00
|
|
|
}
|
2021-01-14 04:41:09 +00:00
|
|
|
#if ENABLED(MKS_WIFI_MODULE)
|
|
|
|
else if (DIALOG_IS(TYPE_UNBIND)) {
|
|
|
|
cloud_unbind();
|
|
|
|
clear_cur_ui();
|
|
|
|
draw_return_ui();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
else {
|
|
|
|
clear_cur_ui();
|
|
|
|
draw_return_ui();
|
|
|
|
}
|
2020-06-16 02:05:33 +00:00
|
|
|
}
|
|
|
|
|
2020-10-24 04:37:45 +00:00
|
|
|
static void btn_cancel_event_cb(lv_obj_t *btn, lv_event_t event) {
|
|
|
|
if (event != LV_EVENT_RELEASED) return;
|
|
|
|
if (DIALOG_IS(PAUSE_MESSAGE_OPTION)) {
|
2020-12-22 12:17:06 +00:00
|
|
|
TERN_(ADVANCED_PAUSE_FEATURE, pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT);
|
2020-06-16 02:05:33 +00:00
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(TYPE_FILAMENT_LOAD_HEAT, TYPE_FILAMENT_UNLOAD_HEAT, TYPE_FILAMENT_HEAT_LOAD_COMPLETED, TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED)) {
|
2021-03-06 15:04:05 +00:00
|
|
|
thermalManager.setTargetHotend(uiCfg.hotendTargetTempBak, uiCfg.extruderIndex);
|
2020-10-24 04:37:45 +00:00
|
|
|
clear_cur_ui();
|
|
|
|
draw_return_ui();
|
|
|
|
}
|
|
|
|
else if (DIALOG_IS(TYPE_FILAMENT_LOADING, TYPE_FILAMENT_UNLOADING)) {
|
|
|
|
queue.enqueue_one_P(PSTR("M410"));
|
|
|
|
uiCfg.filament_rate = 0;
|
2021-01-17 02:43:46 +00:00
|
|
|
uiCfg.filament_loading_completed = false;
|
|
|
|
uiCfg.filament_unloading_completed = false;
|
|
|
|
uiCfg.filament_loading_time_flg = false;
|
2020-10-24 04:37:45 +00:00
|
|
|
uiCfg.filament_loading_time_cnt = 0;
|
2021-01-17 02:43:46 +00:00
|
|
|
uiCfg.filament_unloading_time_flg = false;
|
2020-10-24 04:37:45 +00:00
|
|
|
uiCfg.filament_unloading_time_cnt = 0;
|
2021-03-06 15:04:05 +00:00
|
|
|
thermalManager.setTargetHotend(uiCfg.hotendTargetTempBak, uiCfg.extruderIndex);
|
2020-10-24 04:37:45 +00:00
|
|
|
clear_cur_ui();
|
|
|
|
draw_return_ui();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
clear_cur_ui();
|
|
|
|
draw_return_ui();
|
2020-06-16 02:05:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void lv_draw_dialog(uint8_t type) {
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_t *btnOk = nullptr, *btnCancel = nullptr;
|
2020-09-21 01:55:02 +00:00
|
|
|
uiCfg.dialogType = type;
|
2020-10-24 22:28:31 +00:00
|
|
|
scr = lv_screen_create(DIALOG_UI);
|
2020-06-16 02:05:33 +00:00
|
|
|
|
2020-10-27 20:09:19 +00:00
|
|
|
lv_obj_t *labelDialog = lv_label_create(scr, "");
|
2020-06-16 02:05:33 +00:00
|
|
|
|
2020-10-24 04:37:45 +00:00
|
|
|
if (DIALOG_IS(TYPE_FINISH_PRINT, PAUSE_MESSAGE_RESUME)) {
|
|
|
|
btnOk = lv_button_btn_create(scr, BTN_OK_X + 90, BTN_OK_Y, 100, 50, btn_ok_event_cb);
|
2020-10-23 01:22:17 +00:00
|
|
|
lv_obj_t *labelOk = lv_label_create_empty(btnOk); // Add a label to the button
|
2020-09-21 01:55:02 +00:00
|
|
|
lv_label_set_text(labelOk, print_file_dialog_menu.confirm); // Set the labels text
|
2020-06-16 02:05:33 +00:00
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(PAUSE_MESSAGE_WAITING, PAUSE_MESSAGE_INSERT, PAUSE_MESSAGE_HEAT)) {
|
|
|
|
btnOk = lv_button_btn_create(scr, BTN_OK_X + 90, BTN_OK_Y, 100, 50, btn_ok_event_cb);
|
2020-10-23 01:22:17 +00:00
|
|
|
lv_obj_t *labelOk = lv_label_create_empty(btnOk); // Add a label to the button
|
2020-07-25 05:52:07 +00:00
|
|
|
lv_label_set_text(labelOk, print_file_dialog_menu.confirm); // Set the labels text
|
2020-06-16 02:05:33 +00:00
|
|
|
}
|
2021-07-30 03:59:33 +00:00
|
|
|
else if (DIALOG_IS(PAUSE_MESSAGE_PARKING, PAUSE_MESSAGE_CHANGING, PAUSE_MESSAGE_UNLOAD, PAUSE_MESSAGE_LOAD, PAUSE_MESSAGE_PURGE, PAUSE_MESSAGE_RESUME, PAUSE_MESSAGE_HEATING)) {
|
2020-06-16 02:05:33 +00:00
|
|
|
// nothing to do
|
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(WIFI_ENABLE_TIPS)) {
|
|
|
|
btnCancel = lv_button_btn_create(scr, BTN_OK_X + 90, BTN_OK_Y, 100, 50, btn_cancel_event_cb);
|
2020-10-23 01:22:17 +00:00
|
|
|
lv_obj_t *labelCancel = lv_label_create_empty(btnCancel);
|
2021-01-13 03:02:35 +00:00
|
|
|
lv_label_set_text(labelCancel, print_file_dialog_menu.cancel);
|
2020-09-21 01:55:02 +00:00
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(TRANSFER_NO_DEVICE)) {
|
|
|
|
btnCancel = lv_button_btn_create(scr, BTN_OK_X + 90, BTN_OK_Y, 100, 50, btn_cancel_event_cb);
|
2020-10-23 01:22:17 +00:00
|
|
|
lv_obj_t *labelCancel = lv_label_create_empty(btnCancel);
|
2021-01-13 03:02:35 +00:00
|
|
|
lv_label_set_text(labelCancel, print_file_dialog_menu.cancel);
|
2020-09-21 01:55:02 +00:00
|
|
|
}
|
2020-11-19 21:51:53 +00:00
|
|
|
#if ENABLED(MKS_WIFI_MODULE)
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(TYPE_UPLOAD_FILE)) {
|
2020-09-21 01:55:02 +00:00
|
|
|
if (upload_result == 2) {
|
2020-10-24 04:37:45 +00:00
|
|
|
btnCancel = lv_button_btn_create(scr, BTN_OK_X + 90, BTN_OK_Y, 100, 50, btn_cancel_event_cb);
|
2020-10-23 01:22:17 +00:00
|
|
|
lv_obj_t *labelCancel = lv_label_create_empty(btnCancel);
|
2021-01-13 03:02:35 +00:00
|
|
|
lv_label_set_text(labelCancel, print_file_dialog_menu.cancel);
|
2020-09-21 01:55:02 +00:00
|
|
|
}
|
|
|
|
else if (upload_result == 3) {
|
2020-10-24 04:37:45 +00:00
|
|
|
btnOk = lv_button_btn_create(scr, BTN_OK_X + 90, BTN_OK_Y, 100, 50, btn_ok_event_cb);
|
2020-10-23 01:22:17 +00:00
|
|
|
lv_obj_t *labelOk = lv_label_create_empty(btnOk);
|
2020-09-21 01:55:02 +00:00
|
|
|
lv_label_set_text(labelOk, print_file_dialog_menu.confirm);
|
|
|
|
}
|
|
|
|
}
|
2021-01-19 22:26:25 +00:00
|
|
|
else if (DIALOG_IS(TYPE_UPDATE_ESP_FIRMWARE)) {
|
2021-01-14 04:41:09 +00:00
|
|
|
// nothing to do
|
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
#endif
|
|
|
|
else if (DIALOG_IS(TYPE_FILAMENT_LOAD_HEAT, TYPE_FILAMENT_UNLOAD_HEAT)) {
|
|
|
|
btnCancel = lv_button_btn_create(scr, BTN_OK_X+90, BTN_OK_Y, 100, 50, btn_cancel_event_cb);
|
2020-10-23 01:22:17 +00:00
|
|
|
lv_obj_t *labelCancel = lv_label_create_empty(btnCancel);
|
2021-01-13 03:02:35 +00:00
|
|
|
lv_label_set_text(labelCancel, print_file_dialog_menu.cancel);
|
2020-09-21 01:55:02 +00:00
|
|
|
|
2020-10-23 01:22:17 +00:00
|
|
|
tempText1 = lv_label_create_empty(scr);
|
2020-09-21 01:55:02 +00:00
|
|
|
filament_sprayer_temp();
|
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(TYPE_FILAMENT_LOAD_COMPLETED, TYPE_FILAMENT_UNLOAD_COMPLETED)) {
|
|
|
|
btnOk = lv_button_btn_create(scr, BTN_OK_X + 90, BTN_OK_Y, 100, 50, btn_ok_event_cb);
|
2020-10-23 01:22:17 +00:00
|
|
|
lv_obj_t *labelOk = lv_label_create_empty(btnOk);
|
2020-09-21 01:55:02 +00:00
|
|
|
lv_label_set_text(labelOk, print_file_dialog_menu.confirm);
|
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(TYPE_FILAMENT_LOADING, TYPE_FILAMENT_UNLOADING)) {
|
|
|
|
btnCancel = lv_button_btn_create(scr, BTN_OK_X + 90, BTN_OK_Y, 100, 50, btn_cancel_event_cb);
|
2020-10-23 01:22:17 +00:00
|
|
|
lv_obj_t *labelCancel = lv_label_create_empty(btnCancel);
|
2021-01-13 03:02:35 +00:00
|
|
|
lv_label_set_text(labelCancel, print_file_dialog_menu.cancel);
|
2020-09-21 01:55:02 +00:00
|
|
|
|
2020-10-24 04:37:45 +00:00
|
|
|
filament_bar = lv_bar_create(scr, nullptr);
|
2020-09-21 01:55:02 +00:00
|
|
|
lv_obj_set_pos(filament_bar, (TFT_WIDTH-400)/2, ((TFT_HEIGHT - titleHeight)-40)/2);
|
|
|
|
lv_obj_set_size(filament_bar, 400, 25);
|
|
|
|
lv_bar_set_style(filament_bar, LV_BAR_STYLE_INDIC, &lv_bar_style_indic);
|
|
|
|
lv_bar_set_anim_time(filament_bar, 1000);
|
|
|
|
lv_bar_set_value(filament_bar, 0, LV_ANIM_ON);
|
|
|
|
}
|
2020-06-16 02:05:33 +00:00
|
|
|
else {
|
2020-10-24 04:37:45 +00:00
|
|
|
btnOk = lv_button_btn_create(scr, BTN_OK_X, BTN_OK_Y, 100, 50, btn_ok_event_cb);
|
2020-10-23 01:22:17 +00:00
|
|
|
lv_obj_t *labelOk = lv_label_create_empty(btnOk); // Add a label to the button
|
2020-06-16 02:05:33 +00:00
|
|
|
|
2020-10-24 04:37:45 +00:00
|
|
|
btnCancel = lv_button_btn_create(scr, BTN_CANCEL_X, BTN_CANCEL_Y, 100, 50, btn_cancel_event_cb);
|
2020-10-23 01:22:17 +00:00
|
|
|
lv_obj_t *labelCancel = lv_label_create_empty(btnCancel); // Add a label to the button
|
2020-06-16 02:05:33 +00:00
|
|
|
|
2020-10-24 04:37:45 +00:00
|
|
|
if (DIALOG_IS(PAUSE_MESSAGE_OPTION)) {
|
2020-07-25 05:52:07 +00:00
|
|
|
lv_label_set_text(labelOk, pause_msg_menu.purgeMore); // Set the labels text
|
2020-06-16 02:05:33 +00:00
|
|
|
lv_label_set_text(labelCancel, pause_msg_menu.continuePrint);
|
|
|
|
}
|
|
|
|
else {
|
2020-07-25 05:52:07 +00:00
|
|
|
lv_label_set_text(labelOk, print_file_dialog_menu.confirm); // Set the labels text
|
2021-01-13 03:02:35 +00:00
|
|
|
lv_label_set_text(labelCancel, print_file_dialog_menu.cancel);
|
2020-06-16 02:05:33 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
if (DIALOG_IS(TYPE_PRINT_FILE)) {
|
2020-06-16 02:05:33 +00:00
|
|
|
lv_label_set_text(labelDialog, print_file_dialog_menu.print_file);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
|
2020-06-16 02:05:33 +00:00
|
|
|
|
2020-10-23 01:22:17 +00:00
|
|
|
lv_obj_t *labelFile = lv_label_create(scr, list_file.long_name[sel_id]);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelFile, nullptr, LV_ALIGN_CENTER, 0, -60);
|
2020-06-16 02:05:33 +00:00
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(TYPE_STOP)) {
|
2021-01-13 03:02:35 +00:00
|
|
|
lv_label_set_text(labelDialog, print_file_dialog_menu.cancel_print);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
|
2020-06-16 02:05:33 +00:00
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(TYPE_FINISH_PRINT)) {
|
2020-06-16 02:05:33 +00:00
|
|
|
lv_label_set_text(labelDialog, print_file_dialog_menu.print_finish);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
|
2020-06-16 02:05:33 +00:00
|
|
|
}
|
2021-07-30 03:59:33 +00:00
|
|
|
else if (DIALOG_IS(PAUSE_MESSAGE_PARKING)) {
|
2020-06-16 02:05:33 +00:00
|
|
|
lv_label_set_text(labelDialog, pause_msg_menu.pausing);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
|
2020-06-16 02:05:33 +00:00
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(PAUSE_MESSAGE_CHANGING)) {
|
2020-06-16 02:05:33 +00:00
|
|
|
lv_label_set_text(labelDialog, pause_msg_menu.changing);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
|
2020-06-16 02:05:33 +00:00
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(PAUSE_MESSAGE_UNLOAD)) {
|
2020-06-16 02:05:33 +00:00
|
|
|
lv_label_set_text(labelDialog, pause_msg_menu.unload);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
|
2020-06-16 02:05:33 +00:00
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(PAUSE_MESSAGE_WAITING)) {
|
2020-06-16 02:05:33 +00:00
|
|
|
lv_label_set_text(labelDialog, pause_msg_menu.waiting);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
|
2020-06-16 02:05:33 +00:00
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(PAUSE_MESSAGE_INSERT)) {
|
2020-06-16 02:05:33 +00:00
|
|
|
lv_label_set_text(labelDialog, pause_msg_menu.insert);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
|
2020-06-16 02:05:33 +00:00
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(PAUSE_MESSAGE_LOAD)) {
|
2020-06-16 02:05:33 +00:00
|
|
|
lv_label_set_text(labelDialog, pause_msg_menu.load);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
|
2020-06-16 02:05:33 +00:00
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(PAUSE_MESSAGE_PURGE)) {
|
2020-06-16 02:05:33 +00:00
|
|
|
lv_label_set_text(labelDialog, pause_msg_menu.purge);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
|
2020-06-16 02:05:33 +00:00
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(PAUSE_MESSAGE_RESUME)) {
|
2020-06-16 02:05:33 +00:00
|
|
|
lv_label_set_text(labelDialog, pause_msg_menu.resume);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
|
2020-06-16 02:05:33 +00:00
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(PAUSE_MESSAGE_HEAT)) {
|
2020-06-16 02:05:33 +00:00
|
|
|
lv_label_set_text(labelDialog, pause_msg_menu.heat);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
|
2020-06-16 02:05:33 +00:00
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(PAUSE_MESSAGE_HEATING)) {
|
2020-06-16 02:05:33 +00:00
|
|
|
lv_label_set_text(labelDialog, pause_msg_menu.heating);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
|
2020-06-16 02:05:33 +00:00
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(PAUSE_MESSAGE_OPTION)) {
|
2020-06-16 02:05:33 +00:00
|
|
|
lv_label_set_text(labelDialog, pause_msg_menu.option);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
|
2020-06-16 02:05:33 +00:00
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(STORE_EEPROM_TIPS)) {
|
2020-07-25 05:52:07 +00:00
|
|
|
lv_label_set_text(labelDialog, eeprom_menu.storeTips);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
|
2020-07-25 05:52:07 +00:00
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(READ_EEPROM_TIPS)) {
|
2020-07-25 05:52:07 +00:00
|
|
|
lv_label_set_text(labelDialog, eeprom_menu.readTips);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
|
2020-07-25 05:52:07 +00:00
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(REVERT_EEPROM_TIPS)) {
|
2020-07-25 05:52:07 +00:00
|
|
|
lv_label_set_text(labelDialog, eeprom_menu.revertTips);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
|
2020-07-25 05:52:07 +00:00
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(WIFI_CONFIG_TIPS)) {
|
2020-09-21 01:55:02 +00:00
|
|
|
lv_label_set_text(labelDialog, machine_menu.wifiConfigTips);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
|
2020-09-21 01:55:02 +00:00
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(WIFI_ENABLE_TIPS)) {
|
2020-09-21 01:55:02 +00:00
|
|
|
lv_label_set_text(labelDialog, print_file_dialog_menu.wifi_enable_tips);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
|
2020-09-21 01:55:02 +00:00
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(TRANSFER_NO_DEVICE)) {
|
2020-09-21 01:55:02 +00:00
|
|
|
lv_label_set_text(labelDialog, DIALOG_UPDATE_NO_DEVICE_EN);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
|
2020-09-21 01:55:02 +00:00
|
|
|
}
|
2020-11-19 21:51:53 +00:00
|
|
|
#if ENABLED(MKS_WIFI_MODULE)
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(TYPE_UPLOAD_FILE)) {
|
2020-09-21 01:55:02 +00:00
|
|
|
if (upload_result == 1) {
|
|
|
|
lv_label_set_text(labelDialog, DIALOG_UPLOAD_ING_EN);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
|
2020-09-21 01:55:02 +00:00
|
|
|
}
|
|
|
|
else if (upload_result == 2) {
|
|
|
|
lv_label_set_text(labelDialog, DIALOG_UPLOAD_ERROR_EN);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
|
2020-09-21 01:55:02 +00:00
|
|
|
}
|
|
|
|
else if (upload_result == 3) {
|
|
|
|
char buf[200];
|
|
|
|
int _index = 0;
|
|
|
|
|
2021-07-13 00:17:28 +00:00
|
|
|
strcpy_P(buf, PSTR(DIALOG_UPLOAD_FINISH_EN));
|
2020-09-21 01:55:02 +00:00
|
|
|
_index = strlen(buf);
|
2021-07-13 00:17:28 +00:00
|
|
|
buf[_index++] = '\n';
|
|
|
|
strcat_P(buf, PSTR(DIALOG_UPLOAD_SIZE_EN));
|
2020-09-21 01:55:02 +00:00
|
|
|
|
|
|
|
_index = strlen(buf);
|
2021-07-13 00:17:28 +00:00
|
|
|
buf[_index++] = ':';
|
|
|
|
sprintf_P(&buf[_index], PSTR(" %d KBytes\n"), (int)(upload_size / 1024));
|
2020-09-21 01:55:02 +00:00
|
|
|
|
2021-07-13 00:17:28 +00:00
|
|
|
strcat_P(buf, PSTR(DIALOG_UPLOAD_TIME_EN));
|
2020-09-21 01:55:02 +00:00
|
|
|
_index = strlen(buf);
|
2021-07-13 00:17:28 +00:00
|
|
|
buf[_index++] = ':';
|
|
|
|
sprintf_P(&buf[_index], PSTR(" %d s\n"), (int)upload_time_sec);
|
2020-09-21 01:55:02 +00:00
|
|
|
|
2021-07-13 00:17:28 +00:00
|
|
|
strcat_P(buf, PSTR(DIALOG_UPLOAD_SPEED_EN));
|
2020-09-21 01:55:02 +00:00
|
|
|
_index = strlen(buf);
|
2021-07-13 00:17:28 +00:00
|
|
|
buf[_index++] = ':';
|
|
|
|
sprintf_P(&buf[_index], PSTR(" %d KBytes/s\n"), (int)(upload_size / upload_time_sec / 1024));
|
2020-09-21 01:55:02 +00:00
|
|
|
|
|
|
|
lv_label_set_text(labelDialog, buf);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
|
2020-09-21 01:55:02 +00:00
|
|
|
}
|
|
|
|
}
|
2021-01-19 22:26:25 +00:00
|
|
|
else if (DIALOG_IS(TYPE_UPDATE_ESP_FIRMWARE)) {
|
2021-01-14 04:41:09 +00:00
|
|
|
lv_label_set_text(labelDialog, DIALOG_UPDATE_WIFI_FIRMWARE_EN);
|
2021-07-24 20:55:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
|
2021-01-14 04:41:09 +00:00
|
|
|
}
|
2020-11-19 21:51:53 +00:00
|
|
|
#endif // MKS_WIFI_MODULE
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(TYPE_FILAMENT_LOAD_HEAT)) {
|
2020-09-21 01:55:02 +00:00
|
|
|
lv_label_set_text(labelDialog, filament_menu.filament_dialog_load_heat);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
|
2020-09-21 01:55:02 +00:00
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(TYPE_FILAMENT_HEAT_LOAD_COMPLETED)) {
|
2020-09-21 01:55:02 +00:00
|
|
|
lv_label_set_text(labelDialog, filament_menu.filament_dialog_load_heat_confirm);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
|
2020-09-21 01:55:02 +00:00
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(TYPE_FILAMENT_UNLOAD_HEAT)) {
|
2020-09-21 01:55:02 +00:00
|
|
|
lv_label_set_text(labelDialog, filament_menu.filament_dialog_unload_heat);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
|
2020-09-21 01:55:02 +00:00
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED)) {
|
2020-09-21 01:55:02 +00:00
|
|
|
lv_label_set_text(labelDialog, filament_menu.filament_dialog_unload_heat_confirm);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
|
2020-09-21 01:55:02 +00:00
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(TYPE_FILAMENT_LOAD_COMPLETED)) {
|
2020-09-21 01:55:02 +00:00
|
|
|
lv_label_set_text(labelDialog, filament_menu.filament_dialog_load_completed);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
|
2020-09-21 01:55:02 +00:00
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(TYPE_FILAMENT_UNLOAD_COMPLETED)) {
|
2020-09-21 01:55:02 +00:00
|
|
|
lv_label_set_text(labelDialog, filament_menu.filament_dialog_unload_completed);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -20);
|
2020-09-21 01:55:02 +00:00
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(TYPE_FILAMENT_LOADING)) {
|
2020-09-21 01:55:02 +00:00
|
|
|
lv_label_set_text(labelDialog, filament_menu.filament_dialog_loading);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -70);
|
2020-09-21 01:55:02 +00:00
|
|
|
}
|
2020-10-24 04:37:45 +00:00
|
|
|
else if (DIALOG_IS(TYPE_FILAMENT_UNLOADING)) {
|
2020-09-21 01:55:02 +00:00
|
|
|
lv_label_set_text(labelDialog, filament_menu.filament_dialog_unloading);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -70);
|
2020-09-21 01:55:02 +00:00
|
|
|
}
|
2021-01-14 04:41:09 +00:00
|
|
|
#if ENABLED(MKS_WIFI_MODULE)
|
|
|
|
else if (DIALOG_IS(TYPE_UNBIND)) {
|
|
|
|
lv_label_set_text(labelDialog, common_menu.unbind_printer_tips);
|
2021-07-24 20:55:45 +00:00
|
|
|
lv_obj_align(labelDialog, nullptr, LV_ALIGN_CENTER, 0, -70);
|
2021-01-14 04:41:09 +00:00
|
|
|
}
|
|
|
|
#endif
|
2020-09-21 01:55:02 +00:00
|
|
|
#if HAS_ROTARY_ENCODER
|
|
|
|
if (gCfgItems.encoder_enable) {
|
|
|
|
if (btnOk) lv_group_add_obj(g, btnOk);
|
|
|
|
if (btnCancel) lv_group_add_obj(g, btnCancel);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void filament_sprayer_temp() {
|
|
|
|
char buf[20] = {0};
|
2021-04-24 01:19:23 +00:00
|
|
|
sprintf(buf, preheat_menu.value_state, thermalManager.wholeDegHotend(uiCfg.extruderIndex), thermalManager.degTargetHotend(uiCfg.extruderIndex));
|
2020-09-21 01:55:02 +00:00
|
|
|
|
2021-03-06 15:04:05 +00:00
|
|
|
strcpy(public_buf_l, uiCfg.extruderIndex < 1 ? extrude_menu.ext1 : extrude_menu.ext2);
|
2020-09-21 01:55:02 +00:00
|
|
|
strcat_P(public_buf_l, PSTR(": "));
|
|
|
|
strcat(public_buf_l, buf);
|
|
|
|
lv_label_set_text(tempText1, public_buf_l);
|
2020-10-24 04:37:45 +00:00
|
|
|
lv_obj_align(tempText1, nullptr, LV_ALIGN_CENTER, 0, -50);
|
2020-09-21 01:55:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void filament_dialog_handle() {
|
2020-10-24 04:37:45 +00:00
|
|
|
if (temps_update_flag && (DIALOG_IS(TYPE_FILAMENT_LOAD_HEAT, TYPE_FILAMENT_UNLOAD_HEAT))) {
|
2020-09-21 01:55:02 +00:00
|
|
|
filament_sprayer_temp();
|
2020-10-24 04:37:45 +00:00
|
|
|
temps_update_flag = false;
|
2020-09-21 01:55:02 +00:00
|
|
|
}
|
2021-01-17 02:43:46 +00:00
|
|
|
if (uiCfg.filament_heat_completed_load) {
|
|
|
|
uiCfg.filament_heat_completed_load = false;
|
2020-09-21 01:55:02 +00:00
|
|
|
lv_clear_dialog();
|
|
|
|
lv_draw_dialog(DIALOG_TYPE_FILAMENT_LOADING);
|
|
|
|
planner.synchronize();
|
2021-01-17 02:43:46 +00:00
|
|
|
uiCfg.filament_loading_time_flg = true;
|
2020-09-21 01:55:02 +00:00
|
|
|
uiCfg.filament_loading_time_cnt = 0;
|
2021-03-06 15:04:05 +00:00
|
|
|
sprintf_P(public_buf_m, PSTR("T%d\nG91\nG1 E%d F%d\nG90"), uiCfg.extruderIndex, gCfgItems.filamentchange_load_length, gCfgItems.filamentchange_load_speed);
|
2020-10-23 01:22:17 +00:00
|
|
|
queue.inject(public_buf_m);
|
2020-09-21 01:55:02 +00:00
|
|
|
}
|
2021-01-17 02:43:46 +00:00
|
|
|
if (uiCfg.filament_heat_completed_unload) {
|
|
|
|
uiCfg.filament_heat_completed_unload = false;
|
2020-09-21 01:55:02 +00:00
|
|
|
lv_clear_dialog();
|
|
|
|
lv_draw_dialog(DIALOG_TYPE_FILAMENT_UNLOADING);
|
|
|
|
planner.synchronize();
|
2021-01-17 02:43:46 +00:00
|
|
|
uiCfg.filament_unloading_time_flg = true;
|
2020-09-21 01:55:02 +00:00
|
|
|
uiCfg.filament_unloading_time_cnt = 0;
|
2021-03-06 15:04:05 +00:00
|
|
|
sprintf_P(public_buf_m, PSTR("T%d\nG91\nG1 E-%d F%d\nG90"), uiCfg.extruderIndex, gCfgItems.filamentchange_unload_length, gCfgItems.filamentchange_unload_speed);
|
2020-10-23 01:22:17 +00:00
|
|
|
queue.inject(public_buf_m);
|
2020-09-21 01:55:02 +00:00
|
|
|
}
|
|
|
|
|
2021-03-19 21:41:47 +00:00
|
|
|
if (uiCfg.filament_load_heat_flg) {
|
2021-04-24 01:19:23 +00:00
|
|
|
const celsius_t diff = thermalManager.wholeDegHotend(uiCfg.extruderIndex) - gCfgItems.filament_limit_temp;
|
2021-03-19 21:41:47 +00:00
|
|
|
if (abs(diff) < 2 || diff > 0) {
|
|
|
|
uiCfg.filament_load_heat_flg = false;
|
|
|
|
lv_clear_dialog();
|
|
|
|
lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_LOAD_COMPLETED);
|
|
|
|
}
|
2020-09-21 01:55:02 +00:00
|
|
|
}
|
|
|
|
|
2021-01-17 02:43:46 +00:00
|
|
|
if (uiCfg.filament_loading_completed) {
|
2020-09-21 01:55:02 +00:00
|
|
|
uiCfg.filament_rate = 0;
|
2021-01-17 02:43:46 +00:00
|
|
|
uiCfg.filament_loading_completed = false;
|
2020-09-21 01:55:02 +00:00
|
|
|
lv_clear_dialog();
|
|
|
|
lv_draw_dialog(DIALOG_TYPE_FILAMENT_LOAD_COMPLETED);
|
|
|
|
}
|
2021-03-19 21:41:47 +00:00
|
|
|
|
|
|
|
if (uiCfg.filament_unload_heat_flg) {
|
2021-04-24 01:19:23 +00:00
|
|
|
const celsius_t diff = thermalManager.wholeDegHotend(uiCfg.extruderIndex) - gCfgItems.filament_limit_temp;
|
2021-03-19 21:41:47 +00:00
|
|
|
if (abs(diff) < 2 || diff > 0) {
|
|
|
|
uiCfg.filament_unload_heat_flg = false;
|
|
|
|
lv_clear_dialog();
|
|
|
|
lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED);
|
|
|
|
}
|
2020-09-21 01:55:02 +00:00
|
|
|
}
|
|
|
|
|
2021-01-17 02:43:46 +00:00
|
|
|
if (uiCfg.filament_unloading_completed) {
|
2020-09-21 01:55:02 +00:00
|
|
|
uiCfg.filament_rate = 0;
|
2021-01-17 02:43:46 +00:00
|
|
|
uiCfg.filament_unloading_completed = false;
|
2020-09-21 01:55:02 +00:00
|
|
|
lv_clear_dialog();
|
|
|
|
lv_draw_dialog(DIALOG_TYPE_FILAMENT_UNLOAD_COMPLETED);
|
|
|
|
}
|
|
|
|
|
2020-10-24 04:37:45 +00:00
|
|
|
if (DIALOG_IS(TYPE_FILAMENT_LOADING, TYPE_FILAMENT_UNLOADING))
|
|
|
|
lv_filament_setbar();
|
2020-06-16 02:05:33 +00:00
|
|
|
}
|
|
|
|
|
2020-09-21 01:55:02 +00:00
|
|
|
void lv_filament_setbar() {
|
|
|
|
lv_bar_set_value(filament_bar, uiCfg.filament_rate, LV_ANIM_ON);
|
|
|
|
}
|
|
|
|
|
|
|
|
void lv_clear_dialog() {
|
|
|
|
#if HAS_ROTARY_ENCODER
|
|
|
|
if (gCfgItems.encoder_enable) lv_group_remove_all_objs(g);
|
|
|
|
#endif
|
|
|
|
lv_obj_del(scr);
|
|
|
|
}
|
2020-06-16 02:05:33 +00:00
|
|
|
|
2020-07-25 05:52:07 +00:00
|
|
|
#endif // HAS_TFT_LVGL_UI
|