Browse Source

DWIN cleanup, preserve Z offset

vanilla_fb_2.0.x
Scott Lahteine 4 years ago
committed by Scott Lahteine
parent
commit
2ae8014da7
  1. 60
      Marlin/src/lcd/dwin/e3v2/dwin.cpp

60
Marlin/src/lcd/dwin/e3v2/dwin.cpp

@ -594,7 +594,7 @@ inline void Item_Prepare_Home(const uint8_t row) {
if (HMI_IsChinese()) { if (HMI_IsChinese()) {
#if HAS_BED_PROBE #if HAS_BED_PROBE
DWIN_Frame_AreaCopy(1, 174, 164, 223, 177, LBLX, MBASE(row)); DWIN_Frame_AreaCopy(1, 174, 164, 223, 177, LBLX, MBASE(row));
DWIN_Draw_Signed_Float(font8x16, Color_Bg_Black, 2, 2, 202, MBASE(row), BABY_Z_VAR * 100); DWIN_Draw_Signed_Float(font8x16, Color_Bg_Black, 2, 2, 202, MBASE(row), probe.offset.z * 100);
#else #else
DWIN_Frame_AreaCopy(1, 43, 89, 98, 101, LBLX, MBASE(row)); DWIN_Frame_AreaCopy(1, 43, 89, 98, 101, LBLX, MBASE(row));
#endif #endif
@ -602,7 +602,7 @@ inline void Item_Prepare_Home(const uint8_t row) {
else { else {
#if HAS_BED_PROBE #if HAS_BED_PROBE
DWIN_Frame_AreaCopy(1, 93, 179, 141, 189, LBLX, MBASE(row)); // "Z-Offset" DWIN_Frame_AreaCopy(1, 93, 179, 141, 189, LBLX, MBASE(row)); // "Z-Offset"
DWIN_Draw_Signed_Float(font8x16, Color_Bg_Black, 2, 2, 202, MBASE(row), BABY_Z_VAR * 100); DWIN_Draw_Signed_Float(font8x16, Color_Bg_Black, 2, 2, 202, MBASE(row), probe.offset.z * 100);
#else #else
DWIN_Frame_AreaCopy(1, 1, 76, 106, 86, LBLX, MBASE(row)); // "..." DWIN_Frame_AreaCopy(1, 1, 76, 106, 86, LBLX, MBASE(row)); // "..."
#endif #endif
@ -1271,14 +1271,8 @@ void HMI_Move_Z() {
probe.offset.z = dwin_zoffset; probe.offset.z = dwin_zoffset;
TERN_(EEPROM_SETTINGS, settings.save()); TERN_(EEPROM_SETTINGS, settings.save());
#endif #endif
if (HMI_ValueStruct.show_mode == -4) { checkkey = HMI_ValueStruct.show_mode == -4 ? Prepare : Tune;
checkkey = Prepare; DWIN_Draw_Signed_Float(font8x16, Color_Bg_Black, 2, 2, 202, MBASE(zoff_line), TERN(HAS_BED_PROBE, BABY_Z_VAR * 100, HMI_ValueStruct.offset_value));
DWIN_Draw_Signed_Float(font8x16, Color_Bg_Black, 2, 2, 202, MBASE(zoff_line), TERN(HAS_BED_PROBE, BABY_Z_VAR * 100, HMI_ValueStruct.offset_value));
}
else {
checkkey = Tune;
DWIN_Draw_Signed_Float(font8x16, Color_Bg_Black, 2, 2, 202, MBASE(zoff_line), TERN(HAS_BED_PROBE, BABY_Z_VAR * 100, HMI_ValueStruct.offset_value));
}
DWIN_UpdateLCD(); DWIN_UpdateLCD();
return; return;
} }
@ -1311,11 +1305,7 @@ void HMI_Move_Z() {
} }
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.E_Temp)) { if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.E_Temp)) {
EncoderRate.enabled = false; EncoderRate.enabled = false;
if (HMI_ValueStruct.show_mode == -1) { // temperature if (HMI_ValueStruct.show_mode == -2) {
checkkey = TemperatureID;
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(temp_line), HMI_ValueStruct.E_Temp);
}
else if (HMI_ValueStruct.show_mode == -2) {
checkkey = PLAPreheat; checkkey = PLAPreheat;
ui.material_preset[0].hotend_temp = HMI_ValueStruct.E_Temp; ui.material_preset[0].hotend_temp = HMI_ValueStruct.E_Temp;
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(temp_line), ui.material_preset[0].hotend_temp); DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(temp_line), ui.material_preset[0].hotend_temp);
@ -1327,10 +1317,11 @@ void HMI_Move_Z() {
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(temp_line), ui.material_preset[1].hotend_temp); DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(temp_line), ui.material_preset[1].hotend_temp);
return; return;
} }
else { // tune else if (HMI_ValueStruct.show_mode == -1) // Temperature
checkkey = TemperatureID;
else
checkkey = Tune; checkkey = Tune;
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(temp_line), HMI_ValueStruct.E_Temp); DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(temp_line), HMI_ValueStruct.E_Temp);
}
thermalManager.setTargetHotend(HMI_ValueStruct.E_Temp, 0); thermalManager.setTargetHotend(HMI_ValueStruct.E_Temp, 0);
return; return;
} }
@ -1358,11 +1349,7 @@ void HMI_Move_Z() {
} }
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Bed_Temp)) { if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Bed_Temp)) {
EncoderRate.enabled = false; EncoderRate.enabled = false;
if (HMI_ValueStruct.show_mode == -1) { if (HMI_ValueStruct.show_mode == -2) {
checkkey = TemperatureID;
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(bed_line), HMI_ValueStruct.Bed_Temp);
}
else if (HMI_ValueStruct.show_mode == -2) {
checkkey = PLAPreheat; checkkey = PLAPreheat;
ui.material_preset[0].bed_temp = HMI_ValueStruct.Bed_Temp; ui.material_preset[0].bed_temp = HMI_ValueStruct.Bed_Temp;
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(bed_line), ui.material_preset[0].bed_temp); DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(bed_line), ui.material_preset[0].bed_temp);
@ -1374,10 +1361,11 @@ void HMI_Move_Z() {
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(bed_line), ui.material_preset[1].bed_temp); DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(bed_line), ui.material_preset[1].bed_temp);
return; return;
} }
else { else if (HMI_ValueStruct.show_mode == -1)
checkkey = TemperatureID;
else
checkkey = Tune; checkkey = Tune;
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(bed_line), HMI_ValueStruct.Bed_Temp); DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(bed_line), HMI_ValueStruct.Bed_Temp);
}
thermalManager.setTargetBed(HMI_ValueStruct.Bed_Temp); thermalManager.setTargetBed(HMI_ValueStruct.Bed_Temp);
return; return;
} }
@ -1406,11 +1394,7 @@ void HMI_Move_Z() {
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Fan_speed)) { if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Fan_speed)) {
EncoderRate.enabled = false; EncoderRate.enabled = false;
if (HMI_ValueStruct.show_mode == -1) { if (HMI_ValueStruct.show_mode == -2) {
checkkey = TemperatureID;
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(fan_line), HMI_ValueStruct.Fan_speed);
}
else if (HMI_ValueStruct.show_mode == -2) {
checkkey = PLAPreheat; checkkey = PLAPreheat;
ui.material_preset[0].fan_speed = HMI_ValueStruct.Fan_speed; ui.material_preset[0].fan_speed = HMI_ValueStruct.Fan_speed;
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(fan_line), ui.material_preset[0].fan_speed); DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(fan_line), ui.material_preset[0].fan_speed);
@ -1422,10 +1406,11 @@ void HMI_Move_Z() {
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(fan_line), ui.material_preset[1].fan_speed); DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(fan_line), ui.material_preset[1].fan_speed);
return; return;
} }
else { else if (HMI_ValueStruct.show_mode == -1)
checkkey = TemperatureID;
else
checkkey = Tune; checkkey = Tune;
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(fan_line), HMI_ValueStruct.Fan_speed); DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(fan_line), HMI_ValueStruct.Fan_speed);
}
thermalManager.set_fan_speed(0, HMI_ValueStruct.Fan_speed); thermalManager.set_fan_speed(0, HMI_ValueStruct.Fan_speed);
return; return;
} }
@ -1844,7 +1829,8 @@ void Draw_Status_Area(const bool with_update) {
#if HAS_ZOFFSET_ITEM #if HAS_ZOFFSET_ITEM
DWIN_ICON_Show(ICON, ICON_Zoffset, 158, 428); DWIN_ICON_Show(ICON, ICON_Zoffset, 158, 428);
DWIN_Draw_Signed_Float(DWIN_FONT_STAT, Color_Bg_Black, 2, 2, 178, 429, BABY_Z_VAR * 100); dwin_zoffset = BABY_Z_VAR;
DWIN_Draw_Signed_Float(DWIN_FONT_STAT, Color_Bg_Black, 2, 2, 178, 429, dwin_zoffset * 100);
#endif #endif
if (with_update) { if (with_update) {
@ -3573,7 +3559,7 @@ void EachMomentUpdate() {
else if (dwin_abort_flag && !HMI_flag.home_flag) { // Print Stop else if (dwin_abort_flag && !HMI_flag.home_flag) { // Print Stop
dwin_abort_flag = false; dwin_abort_flag = false;
HMI_ValueStruct.print_speed = feedrate_percentage = 100; HMI_ValueStruct.print_speed = feedrate_percentage = 100;
dwin_zoffset = TERN0(HAS_BED_PROBE, probe.offset.z); dwin_zoffset = BABY_Z_VAR;
select_page.set(0); select_page.set(0);
Goto_MainMenu(); Goto_MainMenu();
} }
@ -3681,6 +3667,7 @@ void DWIN_HandleScreen() {
void DWIN_CompletedHoming() { void DWIN_CompletedHoming() {
HMI_flag.home_flag = false; HMI_flag.home_flag = false;
dwin_zoffset = TERN0(HAS_BED_PROBE, probe.offset.z);
if (checkkey == Last_Prepare) { if (checkkey == Last_Prepare) {
checkkey = Prepare; checkkey = Prepare;
select_prepare.now = PREPARE_CASE_HOME; select_prepare.now = PREPARE_CASE_HOME;
@ -3689,7 +3676,6 @@ void DWIN_CompletedHoming() {
} }
else if (checkkey == Back_Main) { else if (checkkey == Back_Main) {
HMI_ValueStruct.print_speed = feedrate_percentage = 100; HMI_ValueStruct.print_speed = feedrate_percentage = 100;
dwin_zoffset = TERN0(HAS_BED_PROBE, probe.offset.z);
planner.finish_and_disable(); planner.finish_and_disable();
Goto_MainMenu(); Goto_MainMenu();
} }

Loading…
Cancel
Save