Преглед изворни кода

DWIN cleanup, preserve Z offset

Scott Lahteine пре 4 година
родитељ
комит
7e55cbf798
1 измењених фајлова са 23 додато и 37 уклоњено
  1. 23
    37
      Marlin/src/lcd/dwin/e3v2/dwin.cpp

+ 23
- 37
Marlin/src/lcd/dwin/e3v2/dwin.cpp Прегледај датотеку

594
     if (HMI_IsChinese()) {
594
     if (HMI_IsChinese()) {
595
       #if HAS_BED_PROBE
595
       #if HAS_BED_PROBE
596
         DWIN_Frame_AreaCopy(1, 174, 164, 223, 177, LBLX, MBASE(row));
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
       #else
598
       #else
599
         DWIN_Frame_AreaCopy(1, 43, 89, 98, 101, LBLX, MBASE(row));
599
         DWIN_Frame_AreaCopy(1, 43, 89, 98, 101, LBLX, MBASE(row));
600
       #endif
600
       #endif
602
     else {
602
     else {
603
       #if HAS_BED_PROBE
603
       #if HAS_BED_PROBE
604
         DWIN_Frame_AreaCopy(1, 93, 179, 141, 189, LBLX, MBASE(row));    // "Z-Offset"
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
       #else
606
       #else
607
         DWIN_Frame_AreaCopy(1, 1, 76, 106, 86, LBLX, MBASE(row));       // "..."
607
         DWIN_Frame_AreaCopy(1, 1, 76, 106, 86, LBLX, MBASE(row));       // "..."
608
       #endif
608
       #endif
1271
           probe.offset.z = dwin_zoffset;
1271
           probe.offset.z = dwin_zoffset;
1272
           TERN_(EEPROM_SETTINGS, settings.save());
1272
           TERN_(EEPROM_SETTINGS, settings.save());
1273
         #endif
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
         DWIN_UpdateLCD();
1276
         DWIN_UpdateLCD();
1283
         return;
1277
         return;
1284
       }
1278
       }
1311
       }
1305
       }
1312
       if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.E_Temp)) {
1306
       if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.E_Temp)) {
1313
         EncoderRate.enabled = false;
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
           checkkey = PLAPreheat;
1309
           checkkey = PLAPreheat;
1320
           ui.material_preset[0].hotend_temp = HMI_ValueStruct.E_Temp;
1310
           ui.material_preset[0].hotend_temp = HMI_ValueStruct.E_Temp;
1321
           DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(temp_line), ui.material_preset[0].hotend_temp);
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
           DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(temp_line), ui.material_preset[1].hotend_temp);
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
           return;
1318
           return;
1329
         }
1319
         }
1330
-        else { // tune
1320
+        else if (HMI_ValueStruct.show_mode == -1) // Temperature
1321
+          checkkey = TemperatureID;
1322
+        else
1331
           checkkey = Tune;
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
         thermalManager.setTargetHotend(HMI_ValueStruct.E_Temp, 0);
1325
         thermalManager.setTargetHotend(HMI_ValueStruct.E_Temp, 0);
1335
         return;
1326
         return;
1336
       }
1327
       }
1358
       }
1349
       }
1359
       if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Bed_Temp)) {
1350
       if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Bed_Temp)) {
1360
         EncoderRate.enabled = false;
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
           checkkey = PLAPreheat;
1353
           checkkey = PLAPreheat;
1367
           ui.material_preset[0].bed_temp = HMI_ValueStruct.Bed_Temp;
1354
           ui.material_preset[0].bed_temp = HMI_ValueStruct.Bed_Temp;
1368
           DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(bed_line), ui.material_preset[0].bed_temp);
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
           DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(bed_line), ui.material_preset[1].bed_temp);
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
           return;
1362
           return;
1376
         }
1363
         }
1377
-        else {
1364
+        else if (HMI_ValueStruct.show_mode == -1)
1365
+          checkkey = TemperatureID;
1366
+        else
1378
           checkkey = Tune;
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
         thermalManager.setTargetBed(HMI_ValueStruct.Bed_Temp);
1369
         thermalManager.setTargetBed(HMI_ValueStruct.Bed_Temp);
1382
         return;
1370
         return;
1383
       }
1371
       }
1406
 
1394
 
1407
       if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Fan_speed)) {
1395
       if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Fan_speed)) {
1408
         EncoderRate.enabled = false;
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
           checkkey = PLAPreheat;
1398
           checkkey = PLAPreheat;
1415
           ui.material_preset[0].fan_speed = HMI_ValueStruct.Fan_speed;
1399
           ui.material_preset[0].fan_speed = HMI_ValueStruct.Fan_speed;
1416
           DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(fan_line), ui.material_preset[0].fan_speed);
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
           DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(fan_line), ui.material_preset[1].fan_speed);
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
           return;
1407
           return;
1424
         }
1408
         }
1425
-        else {
1409
+        else if (HMI_ValueStruct.show_mode == -1)
1410
+          checkkey = TemperatureID;
1411
+        else
1426
           checkkey = Tune;
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
         thermalManager.set_fan_speed(0, HMI_ValueStruct.Fan_speed);
1414
         thermalManager.set_fan_speed(0, HMI_ValueStruct.Fan_speed);
1430
         return;
1415
         return;
1431
       }
1416
       }
1844
 
1829
 
1845
   #if HAS_ZOFFSET_ITEM
1830
   #if HAS_ZOFFSET_ITEM
1846
     DWIN_ICON_Show(ICON, ICON_Zoffset, 158, 428);
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
   #endif
1834
   #endif
1849
 
1835
 
1850
   if (with_update) {
1836
   if (with_update) {
3573
   else if (dwin_abort_flag && !HMI_flag.home_flag) { // Print Stop
3559
   else if (dwin_abort_flag && !HMI_flag.home_flag) { // Print Stop
3574
     dwin_abort_flag = false;
3560
     dwin_abort_flag = false;
3575
     HMI_ValueStruct.print_speed = feedrate_percentage = 100;
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
     select_page.set(0);
3563
     select_page.set(0);
3578
     Goto_MainMenu();
3564
     Goto_MainMenu();
3579
   }
3565
   }
3681
 
3667
 
3682
 void DWIN_CompletedHoming() {
3668
 void DWIN_CompletedHoming() {
3683
   HMI_flag.home_flag = false;
3669
   HMI_flag.home_flag = false;
3670
+  dwin_zoffset = TERN0(HAS_BED_PROBE, probe.offset.z);
3684
   if (checkkey == Last_Prepare) {
3671
   if (checkkey == Last_Prepare) {
3685
     checkkey = Prepare;
3672
     checkkey = Prepare;
3686
     select_prepare.now = PREPARE_CASE_HOME;
3673
     select_prepare.now = PREPARE_CASE_HOME;
3689
   }
3676
   }
3690
   else if (checkkey == Back_Main) {
3677
   else if (checkkey == Back_Main) {
3691
     HMI_ValueStruct.print_speed = feedrate_percentage = 100;
3678
     HMI_ValueStruct.print_speed = feedrate_percentage = 100;
3692
-    dwin_zoffset = TERN0(HAS_BED_PROBE, probe.offset.z);
3693
     planner.finish_and_disable();
3679
     planner.finish_and_disable();
3694
     Goto_MainMenu();
3680
     Goto_MainMenu();
3695
   }
3681
   }

Loading…
Откажи
Сачувај