Ver código fonte

DWIN cleanup, preserve Z offset

Scott Lahteine 4 anos atrás
pai
commit
7e55cbf798
1 arquivos alterados com 23 adições e 37 exclusões
  1. 23
    37
      Marlin/src/lcd/dwin/e3v2/dwin.cpp

+ 23
- 37
Marlin/src/lcd/dwin/e3v2/dwin.cpp Ver arquivo

@@ -594,7 +594,7 @@ inline void Item_Prepare_Home(const uint8_t row) {
594 594
     if (HMI_IsChinese()) {
595 595
       #if HAS_BED_PROBE
596 596
         DWIN_Frame_AreaCopy(1, 174, 164, 223, 177, LBLX, MBASE(row));
597
-        DWIN_Draw_Signed_Float(font8x16, Color_Bg_Black, 2, 2, 202, MBASE(row), BABY_Z_VAR * 100);
597
+        DWIN_Draw_Signed_Float(font8x16, Color_Bg_Black, 2, 2, 202, MBASE(row), probe.offset.z * 100);
598 598
       #else
599 599
         DWIN_Frame_AreaCopy(1, 43, 89, 98, 101, LBLX, MBASE(row));
600 600
       #endif
@@ -602,7 +602,7 @@ inline void Item_Prepare_Home(const uint8_t row) {
602 602
     else {
603 603
       #if HAS_BED_PROBE
604 604
         DWIN_Frame_AreaCopy(1, 93, 179, 141, 189, LBLX, MBASE(row));    // "Z-Offset"
605
-        DWIN_Draw_Signed_Float(font8x16, Color_Bg_Black, 2, 2, 202, MBASE(row), BABY_Z_VAR * 100);
605
+        DWIN_Draw_Signed_Float(font8x16, Color_Bg_Black, 2, 2, 202, MBASE(row), probe.offset.z * 100);
606 606
       #else
607 607
         DWIN_Frame_AreaCopy(1, 1, 76, 106, 86, LBLX, MBASE(row));       // "..."
608 608
       #endif
@@ -1271,14 +1271,8 @@ void HMI_Move_Z() {
1271 1271
           probe.offset.z = dwin_zoffset;
1272 1272
           TERN_(EEPROM_SETTINGS, settings.save());
1273 1273
         #endif
1274
-        if (HMI_ValueStruct.show_mode == -4) {
1275
-          checkkey = Prepare;
1276
-          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));
1277
-        }
1278
-        else {
1279
-          checkkey = Tune;
1280
-          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));
1281
-        }
1274
+        checkkey = HMI_ValueStruct.show_mode == -4 ? Prepare : Tune;
1275
+        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));
1282 1276
         DWIN_UpdateLCD();
1283 1277
         return;
1284 1278
       }
@@ -1311,11 +1305,7 @@ void HMI_Move_Z() {
1311 1305
       }
1312 1306
       if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.E_Temp)) {
1313 1307
         EncoderRate.enabled = false;
1314
-        if (HMI_ValueStruct.show_mode == -1) { // temperature
1315
-          checkkey = TemperatureID;
1316
-          DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(temp_line), HMI_ValueStruct.E_Temp);
1317
-        }
1318
-        else if (HMI_ValueStruct.show_mode == -2) {
1308
+        if (HMI_ValueStruct.show_mode == -2) {
1319 1309
           checkkey = PLAPreheat;
1320 1310
           ui.material_preset[0].hotend_temp = HMI_ValueStruct.E_Temp;
1321 1311
           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() {
1327 1317
           DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(temp_line), ui.material_preset[1].hotend_temp);
1328 1318
           return;
1329 1319
         }
1330
-        else { // tune
1320
+        else if (HMI_ValueStruct.show_mode == -1) // Temperature
1321
+          checkkey = TemperatureID;
1322
+        else
1331 1323
           checkkey = Tune;
1332
-          DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(temp_line), HMI_ValueStruct.E_Temp);
1333
-        }
1324
+        DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(temp_line), HMI_ValueStruct.E_Temp);
1334 1325
         thermalManager.setTargetHotend(HMI_ValueStruct.E_Temp, 0);
1335 1326
         return;
1336 1327
       }
@@ -1358,11 +1349,7 @@ void HMI_Move_Z() {
1358 1349
       }
1359 1350
       if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Bed_Temp)) {
1360 1351
         EncoderRate.enabled = false;
1361
-        if (HMI_ValueStruct.show_mode == -1) {
1362
-          checkkey = TemperatureID;
1363
-          DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(bed_line), HMI_ValueStruct.Bed_Temp);
1364
-        }
1365
-        else if (HMI_ValueStruct.show_mode == -2) {
1352
+        if (HMI_ValueStruct.show_mode == -2) {
1366 1353
           checkkey = PLAPreheat;
1367 1354
           ui.material_preset[0].bed_temp = HMI_ValueStruct.Bed_Temp;
1368 1355
           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() {
1374 1361
           DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(bed_line), ui.material_preset[1].bed_temp);
1375 1362
           return;
1376 1363
         }
1377
-        else {
1364
+        else if (HMI_ValueStruct.show_mode == -1)
1365
+          checkkey = TemperatureID;
1366
+        else
1378 1367
           checkkey = Tune;
1379
-          DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(bed_line), HMI_ValueStruct.Bed_Temp);
1380
-        }
1368
+        DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(bed_line), HMI_ValueStruct.Bed_Temp);
1381 1369
         thermalManager.setTargetBed(HMI_ValueStruct.Bed_Temp);
1382 1370
         return;
1383 1371
       }
@@ -1406,11 +1394,7 @@ void HMI_Move_Z() {
1406 1394
 
1407 1395
       if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Fan_speed)) {
1408 1396
         EncoderRate.enabled = false;
1409
-        if (HMI_ValueStruct.show_mode == -1) {
1410
-          checkkey = TemperatureID;
1411
-          DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(fan_line), HMI_ValueStruct.Fan_speed);
1412
-        }
1413
-        else if (HMI_ValueStruct.show_mode == -2) {
1397
+        if (HMI_ValueStruct.show_mode == -2) {
1414 1398
           checkkey = PLAPreheat;
1415 1399
           ui.material_preset[0].fan_speed = HMI_ValueStruct.Fan_speed;
1416 1400
           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() {
1422 1406
           DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(fan_line), ui.material_preset[1].fan_speed);
1423 1407
           return;
1424 1408
         }
1425
-        else {
1409
+        else if (HMI_ValueStruct.show_mode == -1)
1410
+          checkkey = TemperatureID;
1411
+        else
1426 1412
           checkkey = Tune;
1427
-          DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(fan_line), HMI_ValueStruct.Fan_speed);
1428
-        }
1413
+        DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(fan_line), HMI_ValueStruct.Fan_speed);
1429 1414
         thermalManager.set_fan_speed(0, HMI_ValueStruct.Fan_speed);
1430 1415
         return;
1431 1416
       }
@@ -1844,7 +1829,8 @@ void Draw_Status_Area(const bool with_update) {
1844 1829
 
1845 1830
   #if HAS_ZOFFSET_ITEM
1846 1831
     DWIN_ICON_Show(ICON, ICON_Zoffset, 158, 428);
1847
-    DWIN_Draw_Signed_Float(DWIN_FONT_STAT, Color_Bg_Black, 2, 2, 178, 429, BABY_Z_VAR * 100);
1832
+    dwin_zoffset = BABY_Z_VAR;
1833
+    DWIN_Draw_Signed_Float(DWIN_FONT_STAT, Color_Bg_Black, 2, 2, 178, 429, dwin_zoffset * 100);
1848 1834
   #endif
1849 1835
 
1850 1836
   if (with_update) {
@@ -3573,7 +3559,7 @@ void EachMomentUpdate() {
3573 3559
   else if (dwin_abort_flag && !HMI_flag.home_flag) { // Print Stop
3574 3560
     dwin_abort_flag = false;
3575 3561
     HMI_ValueStruct.print_speed = feedrate_percentage = 100;
3576
-    dwin_zoffset = TERN0(HAS_BED_PROBE, probe.offset.z);
3562
+    dwin_zoffset = BABY_Z_VAR;
3577 3563
     select_page.set(0);
3578 3564
     Goto_MainMenu();
3579 3565
   }
@@ -3681,6 +3667,7 @@ void DWIN_HandleScreen() {
3681 3667
 
3682 3668
 void DWIN_CompletedHoming() {
3683 3669
   HMI_flag.home_flag = false;
3670
+  dwin_zoffset = TERN0(HAS_BED_PROBE, probe.offset.z);
3684 3671
   if (checkkey == Last_Prepare) {
3685 3672
     checkkey = Prepare;
3686 3673
     select_prepare.now = PREPARE_CASE_HOME;
@@ -3689,7 +3676,6 @@ void DWIN_CompletedHoming() {
3689 3676
   }
3690 3677
   else if (checkkey == Back_Main) {
3691 3678
     HMI_ValueStruct.print_speed = feedrate_percentage = 100;
3692
-    dwin_zoffset = TERN0(HAS_BED_PROBE, probe.offset.z);
3693 3679
     planner.finish_and_disable();
3694 3680
     Goto_MainMenu();
3695 3681
   }

Carregando…
Cancelar
Salvar