🎨 Update MKS UI for no bed, extruder (#22938)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
x301
Dmytro 3 years ago committed by Scott Lahteine
parent 5b1ef638ee
commit ae98d2e5ea

@ -60,18 +60,20 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
switch (obj->mks_obj_id) { switch (obj->mks_obj_id) {
case ID_P_ADD: { case ID_P_ADD: {
if (uiCfg.curTempType == 0) { if (uiCfg.curTempType == 0) {
int16_t max_target; #if HAS_HOTEND
thermalManager.temp_hotend[uiCfg.extruderIndex].target += uiCfg.stepHeat; int16_t max_target;
if (uiCfg.extruderIndex == 0) thermalManager.temp_hotend[uiCfg.extruderIndex].target += uiCfg.stepHeat;
max_target = HEATER_0_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1); if (uiCfg.extruderIndex == 0)
else { max_target = HEATER_0_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1);
#if HAS_MULTI_HOTEND else {
max_target = HEATER_1_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1); #if HAS_MULTI_HOTEND
#endif max_target = HEATER_1_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1);
} #endif
if (thermalManager.degTargetHotend(uiCfg.extruderIndex) > max_target) }
thermalManager.setTargetHotend(max_target, uiCfg.extruderIndex); if (thermalManager.degTargetHotend(uiCfg.extruderIndex) > max_target)
thermalManager.start_watching_hotend(uiCfg.extruderIndex); thermalManager.setTargetHotend(max_target, uiCfg.extruderIndex);
thermalManager.start_watching_hotend(uiCfg.extruderIndex);
#endif
} }
else { else {
#if HAS_HEATED_BED #if HAS_HEATED_BED
@ -87,11 +89,13 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
case ID_P_DEC: case ID_P_DEC:
if (uiCfg.curTempType == 0) { if (uiCfg.curTempType == 0) {
if (thermalManager.degTargetHotend(uiCfg.extruderIndex) > uiCfg.stepHeat) #if HAS_HOTEND
thermalManager.temp_hotend[uiCfg.extruderIndex].target -= uiCfg.stepHeat; if (thermalManager.degTargetHotend(uiCfg.extruderIndex) > uiCfg.stepHeat)
else thermalManager.temp_hotend[uiCfg.extruderIndex].target -= uiCfg.stepHeat;
thermalManager.setTargetHotend(0, uiCfg.extruderIndex); else
thermalManager.start_watching_hotend(uiCfg.extruderIndex); thermalManager.setTargetHotend(0, uiCfg.extruderIndex);
thermalManager.start_watching_hotend(uiCfg.extruderIndex);
#endif
} }
else { else {
#if HAS_HEATED_BED #if HAS_HEATED_BED
@ -99,7 +103,6 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
thermalManager.temp_bed.target -= uiCfg.stepHeat; thermalManager.temp_bed.target -= uiCfg.stepHeat;
else else
thermalManager.setTargetBed(0); thermalManager.setTargetBed(0);
thermalManager.start_watching_bed(); thermalManager.start_watching_bed();
#endif #endif
} }
@ -142,8 +145,10 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
break; break;
case ID_P_OFF: case ID_P_OFF:
if (uiCfg.curTempType == 0) { if (uiCfg.curTempType == 0) {
thermalManager.setTargetHotend(0, uiCfg.extruderIndex); #if HAS_HOTEND
thermalManager.start_watching_hotend(uiCfg.extruderIndex); thermalManager.setTargetHotend(0, uiCfg.extruderIndex);
thermalManager.start_watching_hotend(uiCfg.extruderIndex);
#endif
} }
else { else {
#if HAS_HEATED_BED #if HAS_HEATED_BED
@ -158,16 +163,20 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
draw_return_ui(); draw_return_ui();
break; break;
case ID_P_ABS: case ID_P_ABS:
if (uiCfg.curTempType == 0) if (uiCfg.curTempType == 0) {
thermalManager.setTargetHotend(PREHEAT_2_TEMP_HOTEND, 0); TERN_(HAS_HOTEND, thermalManager.setTargetHotend(PREHEAT_2_TEMP_HOTEND, 0));
else if (uiCfg.curTempType == 1) }
thermalManager.setTargetBed(PREHEAT_2_TEMP_BED); else if (uiCfg.curTempType == 1) {
TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(PREHEAT_2_TEMP_BED));
}
break; break;
case ID_P_PLA: case ID_P_PLA:
if (uiCfg.curTempType == 0) if (uiCfg.curTempType == 0) {
thermalManager.setTargetHotend(PREHEAT_1_TEMP_HOTEND, 0); TERN_(HAS_HOTEND, thermalManager.setTargetHotend(PREHEAT_1_TEMP_HOTEND, 0));
else if (uiCfg.curTempType == 1) }
thermalManager.setTargetBed(PREHEAT_1_TEMP_BED); else if (uiCfg.curTempType == 1) {
TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(PREHEAT_1_TEMP_BED));
}
break; break;
} }
} }
@ -227,14 +236,14 @@ void disp_ext_heart() {
void disp_temp_type() { void disp_temp_type() {
if (uiCfg.curTempType == 0) { if (uiCfg.curTempType == 0) {
if (uiCfg.extruderIndex == 1) { if (TERN0(HAS_MULTI_EXTRUDER, uiCfg.extruderIndex == 1)) {
lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru2.bin"); lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru2.bin");
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
lv_label_set_text(labelType, preheat_menu.ext2); lv_label_set_text(labelType, preheat_menu.ext2);
lv_obj_align(labelType, buttonType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET); lv_obj_align(labelType, buttonType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
} }
} }
else { else if (ENABLED(HAS_HOTEND)) {
lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru1.bin"); lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru1.bin");
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
lv_label_set_text(labelType, preheat_menu.ext1); lv_label_set_text(labelType, preheat_menu.ext1);
@ -242,7 +251,7 @@ void disp_temp_type() {
} }
} }
} }
else { else if (ENABLED(HAS_HEATED_BED)) {
lv_imgbtn_set_src_both(buttonType, "F:/bmp_bed.bin"); lv_imgbtn_set_src_both(buttonType, "F:/bmp_bed.bin");
if (gCfgItems.multiple_language) { if (gCfgItems.multiple_language) {
lv_label_set_text(labelType, preheat_menu.hotbed); lv_label_set_text(labelType, preheat_menu.hotbed);
@ -256,8 +265,10 @@ void disp_desire_temp() {
public_buf_l[0] = '\0'; public_buf_l[0] = '\0';
if (uiCfg.curTempType == 0) { if (uiCfg.curTempType == 0) {
strcat(public_buf_l, uiCfg.extruderIndex < 1 ? preheat_menu.ext1 : preheat_menu.ext2); #if HAS_HOTEND
sprintf(buf, preheat_menu.value_state, thermalManager.wholeDegHotend(uiCfg.extruderIndex), thermalManager.degTargetHotend(uiCfg.extruderIndex)); strcat(public_buf_l, uiCfg.extruderIndex < 1 ? preheat_menu.ext1 : preheat_menu.ext2);
sprintf(buf, preheat_menu.value_state, thermalManager.wholeDegHotend(uiCfg.extruderIndex), thermalManager.degTargetHotend(uiCfg.extruderIndex));
#endif
} }
else { else {
#if HAS_HEATED_BED #if HAS_HEATED_BED

Loading…
Cancel
Save