MKS UI: Monitor state when idle (#21452)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
parent
943a8ebdc6
commit
4ffb95a736
|
@ -65,6 +65,13 @@ extern uint32_t upload_time;
|
||||||
extern uint32_t upload_size;
|
extern uint32_t upload_size;
|
||||||
extern bool temps_update_flag;
|
extern bool temps_update_flag;
|
||||||
|
|
||||||
|
//#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
|
||||||
|
|
||||||
static void btn_ok_event_cb(lv_obj_t *btn, lv_event_t event) {
|
static void btn_ok_event_cb(lv_obj_t *btn, lv_event_t event) {
|
||||||
if (event != LV_EVENT_RELEASED) return;
|
if (event != LV_EVENT_RELEASED) return;
|
||||||
if (DIALOG_IS(TYPE_PRINT_FILE)) {
|
if (DIALOG_IS(TYPE_PRINT_FILE)) {
|
||||||
|
|
|
@ -74,11 +74,6 @@ enum {
|
||||||
DIALOG_TRANSFER_NO_DEVICE
|
DIALOG_TRANSFER_NO_DEVICE
|
||||||
};
|
};
|
||||||
|
|
||||||
#define BTN_OK_X 100
|
|
||||||
#define BTN_OK_Y 180
|
|
||||||
#define BTN_CANCEL_X 280
|
|
||||||
#define BTN_CANCEL_Y 180
|
|
||||||
|
|
||||||
extern void lv_draw_dialog(uint8_t type);
|
extern void lv_draw_dialog(uint8_t type);
|
||||||
extern void lv_clear_dialog();
|
extern void lv_clear_dialog();
|
||||||
extern void filament_sprayer_temp();
|
extern void filament_sprayer_temp();
|
||||||
|
|
|
@ -222,7 +222,7 @@ void disp_bed_temp() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void disp_fan_speed() {
|
void disp_fan_speed() {
|
||||||
sprintf_P(public_buf_l, PSTR("%3d"), thermalManager.fan_speed[0]);
|
sprintf_P(public_buf_l, PSTR("%d%%"), thermalManager.fanPercent(thermalManager.fan_speed[0]));
|
||||||
lv_label_set_text(labelFan, public_buf_l);
|
lv_label_set_text(labelFan, public_buf_l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,32 +42,36 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#define ICON_POS_Y 38
|
||||||
|
#define TARGET_LABEL_MOD_Y -36
|
||||||
|
#define LABEL_MOD_Y 30
|
||||||
|
#define SECOND_EXT_MOD_Y 100
|
||||||
|
|
||||||
extern lv_group_t* g;
|
extern lv_group_t* g;
|
||||||
static lv_obj_t *scr;
|
static lv_obj_t *scr;
|
||||||
|
static lv_obj_t *labelExt1, *labelExt1Target, *labelFan;
|
||||||
|
|
||||||
|
#if HAS_MULTI_EXTRUDER
|
||||||
|
static lv_obj_t *labelExt2, *labelExt2Target;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAS_HEATED_BED
|
||||||
|
static lv_obj_t *labelBed, *labelBedTarget;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ENABLED(MKS_TEST)
|
#if ENABLED(MKS_TEST)
|
||||||
uint8_t curent_disp_ui = 0;
|
uint8_t curent_disp_ui = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum {
|
enum { ID_TOOL = 1, ID_SET, ID_PRINT };
|
||||||
ID_TOOL = 1,
|
|
||||||
ID_SET,
|
|
||||||
ID_PRINT
|
|
||||||
};
|
|
||||||
|
|
||||||
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;
|
if (event != LV_EVENT_RELEASED) return;
|
||||||
lv_clear_ready_print();
|
lv_clear_ready_print();
|
||||||
|
|
||||||
switch (obj->mks_obj_id) {
|
switch (obj->mks_obj_id) {
|
||||||
case ID_TOOL:
|
case ID_TOOL: lv_draw_tool(); break;
|
||||||
lv_draw_tool();
|
case ID_SET: lv_draw_set(); break;
|
||||||
break;
|
case ID_PRINT: lv_draw_print_file(); break;
|
||||||
case ID_SET:
|
|
||||||
lv_draw_set();
|
|
||||||
break;
|
|
||||||
case ID_PRINT:
|
|
||||||
lv_draw_print_file();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,14 +102,14 @@ void disp_det_error() {
|
||||||
lv_obj_t *e1, *e2, *e3, *bed;
|
lv_obj_t *e1, *e2, *e3, *bed;
|
||||||
void mks_disp_test() {
|
void mks_disp_test() {
|
||||||
char buf[30] = {0};
|
char buf[30] = {0};
|
||||||
sprintf_P(buf, PSTR("e1:%d"), (int)thermalManager.degHotend(0));
|
sprintf_P(buf, PSTR("e1:%d"), thermalManager.degHotend(0));
|
||||||
lv_label_set_text(e1, buf);
|
lv_label_set_text(e1, buf);
|
||||||
#if HAS_MULTI_HOTEND
|
#if HAS_MULTI_HOTEND
|
||||||
sprintf_P(buf, PSTR("e2:%d"), (int)thermalManager.degHotend(1));
|
sprintf_P(buf, PSTR("e2:%d"), thermalManager.degHotend(1));
|
||||||
lv_label_set_text(e2, buf);
|
lv_label_set_text(e2, buf);
|
||||||
#endif
|
#endif
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
sprintf_P(buf, PSTR("bed:%d"), (int)thermalManager.temp_bed.celsius);
|
sprintf_P(buf, PSTR("bed:%d"), thermalManager.degBed());
|
||||||
lv_label_set_text(bed, buf);
|
lv_label_set_text(bed, buf);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -130,53 +134,123 @@ void lv_draw_ready_print() {
|
||||||
lv_obj_align(label_tool, buttonTool, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
|
lv_obj_align(label_tool, buttonTool, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 1
|
e1 = lv_label_create_empty(scr);
|
||||||
e1 = lv_label_create_empty(scr);
|
lv_obj_set_pos(e1, 20, 20);
|
||||||
lv_obj_set_pos(e1, 20, 20);
|
sprintf_P(buf, PSTR("e1: %d"), thermalManager.degHotend(0));
|
||||||
sprintf_P(buf, PSTR("e1: %d"), (int)thermalManager.degHotend(0));
|
lv_label_set_text(e1, buf);
|
||||||
lv_label_set_text(e1, buf);
|
|
||||||
#if HAS_MULTI_HOTEND
|
|
||||||
e2 = lv_label_create_empty(scr);
|
|
||||||
lv_obj_set_pos(e2, 20, 45);
|
|
||||||
sprintf_P(buf, PSTR("e1: %d"), (int)thermalManager.degHotend(1));
|
|
||||||
lv_label_set_text(e2, buf);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAS_HEATED_BED
|
#if HAS_MULTI_HOTEND
|
||||||
bed = lv_label_create_empty(scr);
|
e2 = lv_label_create_empty(scr);
|
||||||
lv_obj_set_pos(bed, 20, 95);
|
lv_obj_set_pos(e2, 20, 45);
|
||||||
sprintf_P(buf, PSTR("bed: %d"), (int)thermalManager.temp_bed.celsius);
|
sprintf_P(buf, PSTR("e1: %d"), thermalManager.degHotend(1));
|
||||||
lv_label_set_text(bed, buf);
|
lv_label_set_text(e2, buf);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
limit_info = lv_label_create_empty(scr);
|
#if HAS_HEATED_BED
|
||||||
|
bed = lv_label_create_empty(scr);
|
||||||
|
lv_obj_set_pos(bed, 20, 95);
|
||||||
|
sprintf_P(buf, PSTR("bed: %d"), thermalManager.degBed());
|
||||||
|
lv_label_set_text(bed, buf);
|
||||||
|
#endif
|
||||||
|
|
||||||
lv_style_copy(&limit_style, &lv_style_scr);
|
limit_info = lv_label_create_empty(scr);
|
||||||
limit_style.body.main_color.full = 0x0000;
|
|
||||||
limit_style.body.grad_color.full = 0x0000;
|
|
||||||
limit_style.text.color.full = 0xffff;
|
|
||||||
lv_obj_set_style(limit_info, &limit_style);
|
|
||||||
|
|
||||||
lv_obj_set_pos(limit_info, 20, 120);
|
lv_style_copy(&limit_style, &lv_style_scr);
|
||||||
lv_label_set_text(limit_info, " ");
|
limit_style.body.main_color.full = 0x0000;
|
||||||
|
limit_style.body.grad_color.full = 0x0000;
|
||||||
|
limit_style.text.color.full = 0xFFFF;
|
||||||
|
lv_obj_set_style(limit_info, &limit_style);
|
||||||
|
|
||||||
det_info = lv_label_create_empty(scr);
|
lv_obj_set_pos(limit_info, 20, 120);
|
||||||
|
lv_label_set_text(limit_info, " ");
|
||||||
|
|
||||||
lv_style_copy(&det_style, &lv_style_scr);
|
det_info = lv_label_create_empty(scr);
|
||||||
det_style.body.main_color.full = 0x0000;
|
|
||||||
det_style.body.grad_color.full = 0x0000;
|
|
||||||
det_style.text.color.full = 0xffff;
|
|
||||||
lv_obj_set_style(det_info, &det_style);
|
|
||||||
|
|
||||||
lv_obj_set_pos(det_info, 20, 145);
|
lv_style_copy(&det_style, &lv_style_scr);
|
||||||
lv_label_set_text(det_info, " ");
|
det_style.body.main_color.full = 0x0000;
|
||||||
#endif // if 1
|
det_style.body.grad_color.full = 0x0000;
|
||||||
|
det_style.text.color.full = 0xFFFF;
|
||||||
|
lv_obj_set_style(det_info, &det_style);
|
||||||
|
|
||||||
|
lv_obj_set_pos(det_info, 20, 145);
|
||||||
|
lv_label_set_text(det_info, " ");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lv_big_button_create(scr, "F:/bmp_tool.bin", main_menu.tool, 20, 90, event_handler, ID_TOOL);
|
lv_big_button_create(scr, "F:/bmp_tool.bin", main_menu.tool, 20, 180, event_handler, ID_TOOL);
|
||||||
lv_big_button_create(scr, "F:/bmp_set.bin", main_menu.set, 180, 90, event_handler, ID_SET);
|
lv_big_button_create(scr, "F:/bmp_set.bin", main_menu.set, 180, 180, event_handler, ID_SET);
|
||||||
lv_big_button_create(scr, "F:/bmp_printing.bin", main_menu.print, 340, 90, event_handler, ID_PRINT);
|
lv_big_button_create(scr, "F:/bmp_printing.bin", main_menu.print, 340, 180, event_handler, ID_PRINT);
|
||||||
|
|
||||||
|
// Monitoring
|
||||||
|
lv_obj_t *buttonExt1 = lv_img_create(scr, NULL);
|
||||||
|
#if HAS_MULTI_EXTRUDER
|
||||||
|
lv_obj_t *buttonExt2 = lv_img_create(scr, NULL);
|
||||||
|
#endif
|
||||||
|
#if HAS_HEATED_BED
|
||||||
|
lv_obj_t *buttonBedstate = lv_img_create(scr, NULL);
|
||||||
|
#endif
|
||||||
|
lv_obj_t *buttonFanstate = lv_img_create(scr, NULL);
|
||||||
|
|
||||||
|
lv_img_set_src(buttonExt1, "F:/bmp_ext1_state.bin");
|
||||||
|
#if HAS_MULTI_EXTRUDER
|
||||||
|
lv_img_set_src(buttonExt2, "F:/bmp_ext2_state.bin");
|
||||||
|
#endif
|
||||||
|
#if HAS_HEATED_BED
|
||||||
|
lv_img_set_src(buttonBedstate, "F:/bmp_bed_state.bin");
|
||||||
|
#endif
|
||||||
|
lv_img_set_src(buttonFanstate, "F:/bmp_fan_state.bin");
|
||||||
|
|
||||||
|
lv_obj_set_pos(buttonExt1, 55, ICON_POS_Y);
|
||||||
|
#if HAS_MULTI_EXTRUDER
|
||||||
|
lv_obj_set_pos(buttonExt2, 55, ICON_POS_Y + SECOND_EXT_MOD_Y);
|
||||||
|
#endif
|
||||||
|
#if HAS_HEATED_BED
|
||||||
|
lv_obj_set_pos(buttonBedstate, 210, ICON_POS_Y);
|
||||||
|
#endif
|
||||||
|
lv_obj_set_pos(buttonFanstate, 380, ICON_POS_Y);
|
||||||
|
|
||||||
|
labelExt1 = lv_label_create(scr, 55, LABEL_MOD_Y, nullptr);
|
||||||
|
labelExt1Target = lv_label_create(scr, 55, LABEL_MOD_Y, nullptr);
|
||||||
|
|
||||||
|
#if HAS_MULTI_EXTRUDER
|
||||||
|
labelExt2 = lv_label_create(scr, 55, LABEL_MOD_Y + SECOND_EXT_MOD_Y, nullptr);
|
||||||
|
labelExt2Target = lv_label_create(scr, 55, LABEL_MOD_Y + SECOND_EXT_MOD_Y, nullptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAS_HEATED_BED
|
||||||
|
labelBed = lv_label_create(scr, 210, LABEL_MOD_Y, nullptr);
|
||||||
|
labelBedTarget = lv_label_create(scr, 210, LABEL_MOD_Y, nullptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
labelFan = lv_label_create(scr, 380, 80, nullptr);
|
||||||
|
|
||||||
|
sprintf_P(buf, PSTR("%d"), thermalManager.degHotend(0));
|
||||||
|
lv_label_set_text(labelExt1, buf);
|
||||||
|
lv_obj_align(labelExt1, buttonExt1, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
|
||||||
|
sprintf_P(buf, PSTR("-> %d"), thermalManager.degTargetHotend(0));
|
||||||
|
lv_label_set_text(labelExt1Target, buf);
|
||||||
|
lv_obj_align(labelExt1Target, buttonExt1, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
|
||||||
|
|
||||||
|
#if HAS_MULTI_EXTRUDER
|
||||||
|
sprintf_P(buf, PSTR("%d"), thermalManager.degHotend(1));
|
||||||
|
lv_label_set_text(labelExt2, buf);
|
||||||
|
lv_obj_align(labelExt2, buttonExt2, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
|
||||||
|
sprintf_P(buf, PSTR("-> %d"), thermalManager.degTargetHotend(1));
|
||||||
|
lv_label_set_text(labelExt2Target, buf);
|
||||||
|
lv_obj_align(labelExt2Target, buttonExt2, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAS_HEATED_BED
|
||||||
|
sprintf_P(buf, PSTR("%d"), thermalManager.degBed());
|
||||||
|
lv_label_set_text(labelBed, buf);
|
||||||
|
lv_obj_align(labelBed, buttonBedstate, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
|
||||||
|
sprintf_P(buf, PSTR("-> %d"), thermalManager.degTargetBed());
|
||||||
|
lv_label_set_text(labelBedTarget, buf);
|
||||||
|
lv_obj_align(labelBedTarget, buttonBedstate, LV_ALIGN_CENTER, 0, TARGET_LABEL_MOD_Y);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
sprintf_P(buf, PSTR("%d%%"), thermalManager.fanPercent(thermalManager.fan_speed[0]));
|
||||||
|
lv_label_set_text(labelFan, buf);
|
||||||
|
lv_obj_align(labelFan, buttonFanstate, LV_ALIGN_CENTER, 0, LABEL_MOD_Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
|
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
|
||||||
|
|
|
@ -815,9 +815,9 @@ void disp_language_init() {
|
||||||
wifi_menu.disconnected = WIFI_DISCONNECTED_TEXT;
|
wifi_menu.disconnected = WIFI_DISCONNECTED_TEXT;
|
||||||
wifi_menu.exception = WIFI_EXCEPTION_TEXT;
|
wifi_menu.exception = WIFI_EXCEPTION_TEXT;
|
||||||
|
|
||||||
printing_menu.temp1 = TEXT_VALUE;
|
printing_menu.temp1 = TEXT_VALUE_TARGET;
|
||||||
printing_menu.temp2 = TEXT_VALUE;
|
printing_menu.temp2 = TEXT_VALUE_TARGET;
|
||||||
printing_menu.bed_temp = TEXT_VALUE;
|
printing_menu.bed_temp = TEXT_VALUE_TARGET;
|
||||||
|
|
||||||
filament_menu.stat_temp = TEXT_VALUE;
|
filament_menu.stat_temp = TEXT_VALUE;
|
||||||
|
|
||||||
|
|
|
@ -748,6 +748,7 @@ extern eeprom_def eeprom_menu;
|
||||||
/*****************************************/
|
/*****************************************/
|
||||||
//
|
//
|
||||||
#define TEXT_VALUE "%d/%d"
|
#define TEXT_VALUE "%d/%d"
|
||||||
|
#define TEXT_VALUE_TARGET "%d -> %d"
|
||||||
|
|
||||||
#define TEXT_VALUE_T ": %d℃"
|
#define TEXT_VALUE_T ": %d℃"
|
||||||
#define TEXT_VALUE_mm ": %dmm"
|
#define TEXT_VALUE_mm ": %dmm"
|
||||||
|
|
Loading…
Reference in a new issue