소스 검색

Ender 3 V2 DWIN cleanup (#21026)

Scott Lahteine 3 년 전
부모
커밋
662d81c801
No account linked to committer's email address
3개의 변경된 파일110개의 추가작업 그리고 124개의 파일을 삭제
  1. 4
    4
      Marlin/src/core/macros.h
  2. 100
    114
      Marlin/src/lcd/dwin/e3v2/dwin.cpp
  3. 6
    6
      Marlin/src/lcd/dwin/e3v2/dwin.h

+ 4
- 4
Marlin/src/core/macros.h 파일 보기

@@ -130,20 +130,20 @@
130 130
 
131 131
   #define NOLESS(v, n) \
132 132
     do{ \
133
-      __typeof__(n) _n = (n); \
133
+      __typeof__(v) _n = (n); \
134 134
       if (_n > v) v = _n; \
135 135
     }while(0)
136 136
 
137 137
   #define NOMORE(v, n) \
138 138
     do{ \
139
-      __typeof__(n) _n = (n); \
139
+      __typeof__(v) _n = (n); \
140 140
       if (_n < v) v = _n; \
141 141
     }while(0)
142 142
 
143 143
   #define LIMIT(v, n1, n2) \
144 144
     do{ \
145
-      __typeof__(n1) _n1 = (n1); \
146
-      __typeof__(n2) _n2 = (n2); \
145
+      __typeof__(v) _n1 = (n1); \
146
+      __typeof__(v) _n2 = (n2); \
147 147
       if (_n1 > v) v = _n1; \
148 148
       else if (_n2 < v) v = _n2; \
149 149
     }while(0)

+ 100
- 114
Marlin/src/lcd/dwin/e3v2/dwin.cpp 파일 보기

@@ -191,16 +191,12 @@ constexpr float default_max_acceleration[]    = DEFAULT_MAX_ACCELERATION;
191 191
   constexpr float default_max_jerk[]          = { DEFAULT_XJERK, DEFAULT_YJERK, DEFAULT_ZJERK, DEFAULT_EJERK };
192 192
 #endif
193 193
 
194
-uint8_t Percentrecord = 0;
195
-uint16_t remain_time = 0;
194
+static uint8_t _card_percent = 0;
195
+static uint16_t _remain_time = 0;
196 196
 
197 197
 #if ENABLED(PAUSE_HEAT)
198
-  #if HAS_HOTEND
199
-    uint16_t temphot = 0;
200
-  #endif
201
-  #if HAS_HEATED_BED
202
-    uint16_t tempbed = 0;
203
-  #endif
198
+  TERN_(HAS_HOTEND, uint16_t resume_hotend_temp = 0);
199
+  TERN_(HAS_HEATED_BED, uint16_t resume_bed_temp = 0);
204 200
 #endif
205 201
 
206 202
 #if HAS_ZOFFSET_ITEM
@@ -1081,8 +1077,8 @@ void Draw_Printing_Screen() {
1081 1077
 
1082 1078
 void Draw_Print_ProgressBar() {
1083 1079
   DWIN_ICON_Show(ICON, ICON_Bar, 15, 93);
1084
-  DWIN_Draw_Rectangle(1, BarFill_Color, 16 + Percentrecord * 240 / 100, 93, 256, 113);
1085
-  DWIN_Draw_IntValue(true, true, 0, font8x16, Percent_Color, Color_Bg_Black, 2, 117, 133, Percentrecord);
1080
+  DWIN_Draw_Rectangle(1, BarFill_Color, 16 + _card_percent * 240 / 100, 93, 256, 113);
1081
+  DWIN_Draw_IntValue(true, true, 0, font8x16, Percent_Color, Color_Bg_Black, 2, 117, 133, _card_percent);
1086 1082
   DWIN_Draw_String(false, false, font8x16, Percent_Color, Color_Bg_Black, 133, 133, F("%"));
1087 1083
 }
1088 1084
 
@@ -1094,9 +1090,9 @@ void Draw_Print_ProgressElapsed() {
1094 1090
 }
1095 1091
 
1096 1092
 void Draw_Print_ProgressRemain() {
1097
-  DWIN_Draw_IntValue(true, true, 1, font8x16, Color_White, Color_Bg_Black, 2, 176, 212, remain_time / 3600);
1093
+  DWIN_Draw_IntValue(true, true, 1, font8x16, Color_White, Color_Bg_Black, 2, 176, 212, _remain_time / 3600);
1098 1094
   DWIN_Draw_String(false, false, font8x16, Color_White, Color_Bg_Black, 192, 212, F(":"));
1099
-  DWIN_Draw_IntValue(true, true, 1, font8x16, Color_White, Color_Bg_Black, 2, 200, 212, (remain_time % 3600) / 60);
1095
+  DWIN_Draw_IntValue(true, true, 1, font8x16, Color_White, Color_Bg_Black, 2, 200, 212, (_remain_time % 3600) / 60);
1100 1096
 }
1101 1097
 
1102 1098
 void Goto_PrintProcess() {
@@ -1158,10 +1154,10 @@ inline ENCODER_DiffState get_encoder_state() {
1158 1154
 void HMI_Move_X() {
1159 1155
   ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
1160 1156
   if (encoder_diffState != ENCODER_DIFF_NO) {
1161
-    if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Move_X_scale)) {
1157
+    if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Move_X_scaled)) {
1162 1158
       checkkey = AxisMove;
1163 1159
       EncoderRate.enabled = false;
1164
-      DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(1), HMI_ValueStruct.Move_X_scale);
1160
+      DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(1), HMI_ValueStruct.Move_X_scaled);
1165 1161
       if (!planner.is_full()) {
1166 1162
         // Wait for planner moves to finish!
1167 1163
         planner.synchronize();
@@ -1170,10 +1166,9 @@ void HMI_Move_X() {
1170 1166
       DWIN_UpdateLCD();
1171 1167
       return;
1172 1168
     }
1173
-    NOLESS(HMI_ValueStruct.Move_X_scale, (X_MIN_POS) * MINUNITMULT);
1174
-    NOMORE(HMI_ValueStruct.Move_X_scale, (X_MAX_POS) * MINUNITMULT);
1175
-    current_position.x = HMI_ValueStruct.Move_X_scale / MINUNITMULT;
1176
-    DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, UNITFDIGITS, 216, MBASE(1), HMI_ValueStruct.Move_X_scale);
1169
+    LIMIT(HMI_ValueStruct.Move_X_scaled, (X_MIN_POS) * MINUNITMULT, (X_MAX_POS) * MINUNITMULT);
1170
+    current_position.x = HMI_ValueStruct.Move_X_scaled / MINUNITMULT;
1171
+    DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, UNITFDIGITS, 216, MBASE(1), HMI_ValueStruct.Move_X_scaled);
1177 1172
     DWIN_UpdateLCD();
1178 1173
   }
1179 1174
 }
@@ -1181,10 +1176,10 @@ void HMI_Move_X() {
1181 1176
 void HMI_Move_Y() {
1182 1177
   ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
1183 1178
   if (encoder_diffState != ENCODER_DIFF_NO) {
1184
-    if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Move_Y_scale)) {
1179
+    if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Move_Y_scaled)) {
1185 1180
       checkkey = AxisMove;
1186 1181
       EncoderRate.enabled = false;
1187
-      DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(2), HMI_ValueStruct.Move_Y_scale);
1182
+      DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(2), HMI_ValueStruct.Move_Y_scaled);
1188 1183
       if (!planner.is_full()) {
1189 1184
         // Wait for planner moves to finish!
1190 1185
         planner.synchronize();
@@ -1193,10 +1188,9 @@ void HMI_Move_Y() {
1193 1188
       DWIN_UpdateLCD();
1194 1189
       return;
1195 1190
     }
1196
-    NOLESS(HMI_ValueStruct.Move_Y_scale, (Y_MIN_POS) * MINUNITMULT);
1197
-    NOMORE(HMI_ValueStruct.Move_Y_scale, (Y_MAX_POS) * MINUNITMULT);
1198
-    current_position.y = HMI_ValueStruct.Move_Y_scale / MINUNITMULT;
1199
-    DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, UNITFDIGITS, 216, MBASE(2), HMI_ValueStruct.Move_Y_scale);
1191
+    LIMIT(HMI_ValueStruct.Move_Y_scaled, (Y_MIN_POS) * MINUNITMULT, (Y_MAX_POS) * MINUNITMULT);
1192
+    current_position.y = HMI_ValueStruct.Move_Y_scaled / MINUNITMULT;
1193
+    DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, UNITFDIGITS, 216, MBASE(2), HMI_ValueStruct.Move_Y_scaled);
1200 1194
     DWIN_UpdateLCD();
1201 1195
   }
1202 1196
 }
@@ -1204,10 +1198,10 @@ void HMI_Move_Y() {
1204 1198
 void HMI_Move_Z() {
1205 1199
   ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
1206 1200
   if (encoder_diffState != ENCODER_DIFF_NO) {
1207
-    if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Move_Z_scale)) {
1201
+    if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Move_Z_scaled)) {
1208 1202
       checkkey = AxisMove;
1209 1203
       EncoderRate.enabled = false;
1210
-      DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, UNITFDIGITS, 216, MBASE(3), HMI_ValueStruct.Move_Z_scale);
1204
+      DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, UNITFDIGITS, 216, MBASE(3), HMI_ValueStruct.Move_Z_scaled);
1211 1205
       if (!planner.is_full()) {
1212 1206
         // Wait for planner moves to finish!
1213 1207
         planner.synchronize();
@@ -1216,10 +1210,9 @@ void HMI_Move_Z() {
1216 1210
       DWIN_UpdateLCD();
1217 1211
       return;
1218 1212
     }
1219
-    NOLESS(HMI_ValueStruct.Move_Z_scale, Z_MIN_POS * MINUNITMULT);
1220
-    NOMORE(HMI_ValueStruct.Move_Z_scale, Z_MAX_POS * MINUNITMULT);
1221
-    current_position.z = HMI_ValueStruct.Move_Z_scale / MINUNITMULT;
1222
-    DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, UNITFDIGITS, 216, MBASE(3), HMI_ValueStruct.Move_Z_scale);
1213
+    LIMIT(HMI_ValueStruct.Move_Z_scaled, Z_MIN_POS * MINUNITMULT, Z_MAX_POS * MINUNITMULT);
1214
+    current_position.z = HMI_ValueStruct.Move_Z_scaled / MINUNITMULT;
1215
+    DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, UNITFDIGITS, 216, MBASE(3), HMI_ValueStruct.Move_Z_scaled);
1223 1216
     DWIN_UpdateLCD();
1224 1217
   }
1225 1218
 }
@@ -1227,14 +1220,14 @@ void HMI_Move_Z() {
1227 1220
 #if HAS_HOTEND
1228 1221
 
1229 1222
   void HMI_Move_E() {
1230
-    static float last_E_scale = 0;
1223
+    static float last_E_scaled = 0;
1231 1224
     ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
1232 1225
     if (encoder_diffState != ENCODER_DIFF_NO) {
1233
-      if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Move_E_scale)) {
1226
+      if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Move_E_scaled)) {
1234 1227
         checkkey = AxisMove;
1235 1228
         EncoderRate.enabled = false;
1236
-        last_E_scale = HMI_ValueStruct.Move_E_scale;
1237
-        DWIN_Draw_Signed_Float(font8x16, Color_Bg_Black, 3, UNITFDIGITS, 216, MBASE(4), HMI_ValueStruct.Move_E_scale);
1229
+        last_E_scaled = HMI_ValueStruct.Move_E_scaled;
1230
+        DWIN_Draw_Signed_Float(font8x16, Color_Bg_Black, 3, UNITFDIGITS, 216, MBASE(4), HMI_ValueStruct.Move_E_scaled);
1238 1231
         if (!planner.is_full()) {
1239 1232
           planner.synchronize(); // Wait for planner moves to finish!
1240 1233
           planner.buffer_line(current_position, MMM_TO_MMS(FEEDRATE_E), active_extruder);
@@ -1242,12 +1235,12 @@ void HMI_Move_Z() {
1242 1235
         DWIN_UpdateLCD();
1243 1236
         return;
1244 1237
       }
1245
-      if ((HMI_ValueStruct.Move_E_scale - last_E_scale) > (EXTRUDE_MAXLENGTH) * MINUNITMULT)
1246
-        HMI_ValueStruct.Move_E_scale = last_E_scale + (EXTRUDE_MAXLENGTH) * MINUNITMULT;
1247
-      else if ((last_E_scale - HMI_ValueStruct.Move_E_scale) > (EXTRUDE_MAXLENGTH) * MINUNITMULT)
1248
-        HMI_ValueStruct.Move_E_scale = last_E_scale - (EXTRUDE_MAXLENGTH) * MINUNITMULT;
1249
-      current_position.e = HMI_ValueStruct.Move_E_scale / MINUNITMULT;
1250
-      DWIN_Draw_Signed_Float(font8x16, Select_Color, 3, UNITFDIGITS, 216, MBASE(4), HMI_ValueStruct.Move_E_scale);
1238
+      if ((HMI_ValueStruct.Move_E_scaled - last_E_scaled) > (EXTRUDE_MAXLENGTH) * MINUNITMULT)
1239
+        HMI_ValueStruct.Move_E_scaled = last_E_scaled + (EXTRUDE_MAXLENGTH) * MINUNITMULT;
1240
+      else if ((last_E_scaled - HMI_ValueStruct.Move_E_scaled) > (EXTRUDE_MAXLENGTH) * MINUNITMULT)
1241
+        HMI_ValueStruct.Move_E_scaled = last_E_scaled - (EXTRUDE_MAXLENGTH) * MINUNITMULT;
1242
+      current_position.e = HMI_ValueStruct.Move_E_scaled / MINUNITMULT;
1243
+      DWIN_Draw_Signed_Float(font8x16, Select_Color, 3, UNITFDIGITS, 216, MBASE(4), HMI_ValueStruct.Move_E_scaled);
1251 1244
       DWIN_UpdateLCD();
1252 1245
     }
1253 1246
   }
@@ -1277,8 +1270,7 @@ void HMI_Move_Z() {
1277 1270
         DWIN_UpdateLCD();
1278 1271
         return;
1279 1272
       }
1280
-      NOLESS(HMI_ValueStruct.offset_value, (Z_PROBE_OFFSET_RANGE_MIN) * 100);
1281
-      NOMORE(HMI_ValueStruct.offset_value, (Z_PROBE_OFFSET_RANGE_MAX) * 100);
1273
+      LIMIT(HMI_ValueStruct.offset_value, (Z_PROBE_OFFSET_RANGE_MIN) * 100, (Z_PROBE_OFFSET_RANGE_MAX) * 100);
1282 1274
       last_zoffset = dwin_zoffset;
1283 1275
       dwin_zoffset = HMI_ValueStruct.offset_value / 100.0f;
1284 1276
       #if EITHER(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP)
@@ -1326,8 +1318,7 @@ void HMI_Move_Z() {
1326 1318
         return;
1327 1319
       }
1328 1320
       // E_Temp limit
1329
-      NOMORE(HMI_ValueStruct.E_Temp, MAX_E_TEMP);
1330
-      NOLESS(HMI_ValueStruct.E_Temp, MIN_E_TEMP);
1321
+      LIMIT(HMI_ValueStruct.E_Temp, MIN_E_TEMP, MAX_E_TEMP);
1331 1322
       // E_Temp value
1332 1323
       DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(temp_line), HMI_ValueStruct.E_Temp);
1333 1324
     }
@@ -1370,8 +1361,7 @@ void HMI_Move_Z() {
1370 1361
         return;
1371 1362
       }
1372 1363
       // Bed_Temp limit
1373
-      NOMORE(HMI_ValueStruct.Bed_Temp, BED_MAX_TARGET);
1374
-      NOLESS(HMI_ValueStruct.Bed_Temp, MIN_BED_TEMP);
1364
+      LIMIT(HMI_ValueStruct.Bed_Temp, MIN_BED_TEMP, BED_MAX_TARGET);
1375 1365
       // Bed_Temp value
1376 1366
       DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(bed_line), HMI_ValueStruct.Bed_Temp);
1377 1367
     }
@@ -1415,8 +1405,7 @@ void HMI_Move_Z() {
1415 1405
         return;
1416 1406
       }
1417 1407
       // Fan_speed limit
1418
-      NOMORE(HMI_ValueStruct.Fan_speed, FANON);
1419
-      NOLESS(HMI_ValueStruct.Fan_speed, FANOFF);
1408
+      LIMIT(HMI_ValueStruct.Fan_speed, FANOFF, FANON);
1420 1409
       // Fan_speed value
1421 1410
       DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(fan_line), HMI_ValueStruct.Fan_speed);
1422 1411
     }
@@ -1435,8 +1424,7 @@ void HMI_PrintSpeed() {
1435 1424
       return;
1436 1425
     }
1437 1426
     // print_speed limit
1438
-    NOMORE(HMI_ValueStruct.print_speed, MAX_PRINT_SPEED);
1439
-    NOLESS(HMI_ValueStruct.print_speed, MIN_PRINT_SPEED);
1427
+    LIMIT(HMI_ValueStruct.print_speed, MIN_PRINT_SPEED, MAX_PRINT_SPEED);
1440 1428
     // print_speed value
1441 1429
     DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(select_tune.now + MROWS - index_tune), HMI_ValueStruct.print_speed);
1442 1430
   }
@@ -1491,20 +1479,20 @@ void HMI_MaxAccelerationXYZE() {
1491 1479
   void HMI_MaxJerkXYZE() {
1492 1480
     ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
1493 1481
     if (encoder_diffState != ENCODER_DIFF_NO) {
1494
-      if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Max_Jerk)) {
1482
+      if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Max_Jerk_scaled)) {
1495 1483
         checkkey = MaxJerk;
1496 1484
         EncoderRate.enabled = false;
1497 1485
         if (WITHIN(HMI_flag.jerk_axis, X_AXIS, E_AXIS))
1498
-          planner.set_max_jerk(HMI_flag.jerk_axis, HMI_ValueStruct.Max_Jerk / 10);
1499
-        DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(select_jerk.now), HMI_ValueStruct.Max_Jerk);
1486
+          planner.set_max_jerk(HMI_flag.jerk_axis, HMI_ValueStruct.Max_Jerk_scaled / 10);
1487
+        DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(select_jerk.now), HMI_ValueStruct.Max_Jerk_scaled);
1500 1488
         return;
1501 1489
       }
1502 1490
       // MaxJerk limit
1503 1491
       if (WITHIN(HMI_flag.jerk_axis, X_AXIS, E_AXIS))
1504
-        NOMORE(HMI_ValueStruct.Max_Jerk, default_max_jerk[HMI_flag.jerk_axis] * 2 * MINUNITMULT);
1505
-      NOLESS(HMI_ValueStruct.Max_Jerk, (MIN_MAXJERK) * MINUNITMULT);
1492
+        NOMORE(HMI_ValueStruct.Max_Jerk_scaled, default_max_jerk[HMI_flag.jerk_axis] * 2 * MINUNITMULT);
1493
+      NOLESS(HMI_ValueStruct.Max_Jerk_scaled, (MIN_MAXJERK) * MINUNITMULT);
1506 1494
       // MaxJerk value
1507
-      DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, UNITFDIGITS, 210, MBASE(select_jerk.now), HMI_ValueStruct.Max_Jerk);
1495
+      DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, UNITFDIGITS, 210, MBASE(select_jerk.now), HMI_ValueStruct.Max_Jerk_scaled);
1508 1496
     }
1509 1497
   }
1510 1498
 
@@ -1513,43 +1501,41 @@ void HMI_MaxAccelerationXYZE() {
1513 1501
 void HMI_StepXYZE() {
1514 1502
   ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
1515 1503
   if (encoder_diffState != ENCODER_DIFF_NO) {
1516
-    if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Max_Step)) {
1504
+    if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Max_Step_scaled)) {
1517 1505
       checkkey = Step;
1518 1506
       EncoderRate.enabled = false;
1519 1507
       if (WITHIN(HMI_flag.step_axis, X_AXIS, E_AXIS))
1520
-        planner.settings.axis_steps_per_mm[HMI_flag.step_axis] = HMI_ValueStruct.Max_Step / 10;
1521
-      DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(select_step.now), HMI_ValueStruct.Max_Step);
1508
+        planner.settings.axis_steps_per_mm[HMI_flag.step_axis] = HMI_ValueStruct.Max_Step_scaled / 10;
1509
+      DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(select_step.now), HMI_ValueStruct.Max_Step_scaled);
1522 1510
       return;
1523 1511
     }
1524 1512
     // Step limit
1525 1513
     if (WITHIN(HMI_flag.step_axis, X_AXIS, E_AXIS))
1526
-      NOMORE(HMI_ValueStruct.Max_Step, 999.9 * MINUNITMULT);
1527
-    NOLESS(HMI_ValueStruct.Max_Step, MIN_STEP);
1514
+      NOMORE(HMI_ValueStruct.Max_Step_scaled, 999.9 * MINUNITMULT);
1515
+    NOLESS(HMI_ValueStruct.Max_Step_scaled, MIN_STEP);
1528 1516
     // Step value
1529
-    DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, UNITFDIGITS, 210, MBASE(select_step.now), HMI_ValueStruct.Max_Step);
1517
+    DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, UNITFDIGITS, 210, MBASE(select_step.now), HMI_ValueStruct.Max_Step_scaled);
1530 1518
   }
1531 1519
 }
1532 1520
 
1533 1521
 void update_variable() {
1534
-  #if HAS_HOTEND
1535
-    static float last_temp_hotend_target = 0, last_temp_hotend_current = 0;
1536
-  #endif
1537
-  #if HAS_HEATED_BED
1538
-    static float last_temp_bed_target = 0, last_temp_bed_current = 0;
1539
-  #endif
1540
-  #if HAS_FAN
1541
-    static uint8_t last_fan_speed = 0;
1542
-  #endif
1522
+  TERN_(HAS_HOTEND, static float last_temp_hotend_target = 0);
1523
+  TERN_(HAS_HEATED_BED, static float last_temp_bed_target = 0);
1524
+  TERN_(HAS_FAN, static uint8_t last_fan_speed = 0);
1543 1525
 
1544 1526
   /* Tune page temperature update */
1545 1527
   if (checkkey == Tune) {
1546 1528
     #if HAS_HOTEND
1547
-      if (last_temp_hotend_target != thermalManager.temp_hotend[0].target)
1529
+      if (last_temp_hotend_target != thermalManager.temp_hotend[0].target) {
1548 1530
         DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(TUNE_CASE_TEMP + MROWS - index_tune), thermalManager.temp_hotend[0].target);
1531
+        last_temp_hotend_target = thermalManager.temp_hotend[0].target;
1532
+      }
1549 1533
     #endif
1550 1534
     #if HAS_HEATED_BED
1551
-      if (last_temp_bed_target != thermalManager.temp_bed.target)
1535
+      if (last_temp_bed_target != thermalManager.temp_bed.target) {
1552 1536
         DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(TUNE_CASE_BED + MROWS - index_tune), thermalManager.temp_bed.target);
1537
+        last_temp_bed_target = thermalManager.temp_bed.target;
1538
+      }
1553 1539
     #endif
1554 1540
     #if HAS_FAN
1555 1541
       if (last_fan_speed != thermalManager.fan_speed[0]) {
@@ -1562,12 +1548,16 @@ void update_variable() {
1562 1548
   /* Temperature page temperature update */
1563 1549
   if (checkkey == TemperatureID) {
1564 1550
     #if HAS_HOTEND
1565
-      if (last_temp_hotend_target != thermalManager.temp_hotend[0].target)
1551
+      if (last_temp_hotend_target != thermalManager.temp_hotend[0].target) {
1566 1552
         DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(TEMP_CASE_TEMP), thermalManager.temp_hotend[0].target);
1553
+        last_temp_hotend_target = thermalManager.temp_hotend[0].target;
1554
+      }
1567 1555
     #endif
1568 1556
     #if HAS_HEATED_BED
1569
-      if (last_temp_bed_target != thermalManager.temp_bed.target)
1557
+      if (last_temp_bed_target != thermalManager.temp_bed.target) {
1570 1558
         DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(TEMP_CASE_BED), thermalManager.temp_bed.target);
1559
+        last_temp_bed_target = thermalManager.temp_bed.target;
1560
+      }
1571 1561
     #endif
1572 1562
     #if HAS_FAN
1573 1563
       if (last_fan_speed != thermalManager.fan_speed[0]) {
@@ -1579,9 +1569,10 @@ void update_variable() {
1579 1569
 
1580 1570
   /* Bottom temperature update */
1581 1571
   #if HAS_HOTEND
1582
-    if (last_temp_hotend_current != thermalManager.temp_hotend[0].celsius) {
1572
+    static float _hotendtemp = 0;
1573
+    if (_hotendtemp != thermalManager.temp_hotend[0].celsius) {
1583 1574
       DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 33, 382, thermalManager.temp_hotend[0].celsius);
1584
-      last_temp_hotend_current = thermalManager.temp_hotend[0].celsius;
1575
+      _hotendtemp = thermalManager.temp_hotend[0].celsius;
1585 1576
     }
1586 1577
     if (last_temp_hotend_target != thermalManager.temp_hotend[0].target) {
1587 1578
       DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 33 + 4 * STAT_CHR_W + 6, 382, thermalManager.temp_hotend[0].target);
@@ -1589,9 +1580,10 @@ void update_variable() {
1589 1580
     }
1590 1581
   #endif
1591 1582
   #if HAS_HEATED_BED
1592
-    if (last_temp_bed_current != thermalManager.temp_bed.celsius) {
1583
+    static float _bedtemp = 0;
1584
+    if (_bedtemp != thermalManager.temp_bed.celsius) {
1593 1585
       DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 178, 382, thermalManager.temp_bed.celsius);
1594
-      last_temp_bed_current = thermalManager.temp_bed.celsius;
1586
+      _bedtemp = thermalManager.temp_bed.celsius;
1595 1587
     }
1596 1588
     if (last_temp_bed_target != thermalManager.temp_bed.target) {
1597 1589
       DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 178 + 4 * STAT_CHR_W + 6, 382, thermalManager.temp_bed.target);
@@ -2135,13 +2127,11 @@ void HMI_Printing() {
2135 2127
           char cmd[40];
2136 2128
           cmd[0] = '\0';
2137 2129
 
2138
-          #if ENABLED(PAUSE_HEAT)
2139
-            #if HAS_HEATED_BED
2140
-              if (tempbed) sprintf_P(cmd, PSTR("M190 S%i\n"), tempbed);
2141
-            #endif
2142
-            #if HAS_HOTEND
2143
-              if (temphot) sprintf_P(&cmd[strlen(cmd)], PSTR("M109 S%i\n"), temphot);
2144
-            #endif
2130
+          #if BOTH(HAS_HOTEND, PAUSE_HEAT)
2131
+            if (resume_hotend_temp) sprintf_P(&cmd[strlen(cmd)], PSTR("M109 S%i\n"), resume_hotend_temp);
2132
+          #endif
2133
+          #if BOTH(HAS_HEATED_BED, PAUSE_HEAT)
2134
+            if (resume_bed_temp) sprintf_P(cmd, PSTR("M190 S%i\n"), resume_bed_temp);
2145 2135
           #endif
2146 2136
 
2147 2137
           strcat_P(cmd, M24_STR);
@@ -2322,8 +2312,8 @@ void HMI_Prepare() {
2322 2312
         DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, UNITFDIGITS, 216, MBASE(2), current_position.y * MINUNITMULT);
2323 2313
         DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, UNITFDIGITS, 216, MBASE(3), current_position.z * MINUNITMULT);
2324 2314
         #if HAS_HOTEND
2325
-          HMI_ValueStruct.Move_E_scale = current_position.e * MINUNITMULT;
2326
-          DWIN_Draw_Signed_Float(font8x16, Color_Bg_Black, 3, 1, 216, MBASE(4), HMI_ValueStruct.Move_E_scale);
2315
+          HMI_ValueStruct.Move_E_scaled = current_position.e * MINUNITMULT;
2316
+          DWIN_Draw_Signed_Float(font8x16, Color_Bg_Black, 3, 1, 216, MBASE(4), HMI_ValueStruct.Move_E_scaled);
2327 2317
         #endif
2328 2318
         break;
2329 2319
       case PREPARE_CASE_DISA: // Disable steppers
@@ -2573,11 +2563,11 @@ void HMI_AxisMove() {
2573 2563
     if (HMI_flag.ETempTooLow_flag) {
2574 2564
       if (encoder_diffState == ENCODER_DIFF_ENTER) {
2575 2565
         HMI_flag.ETempTooLow_flag = false;
2576
-        HMI_ValueStruct.Move_E_scale = current_position.e * MINUNITMULT;
2566
+        HMI_ValueStruct.Move_E_scaled = current_position.e * MINUNITMULT;
2577 2567
         Draw_Move_Menu();
2578
-        DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(1), HMI_ValueStruct.Move_X_scale);
2579
-        DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(2), HMI_ValueStruct.Move_Y_scale);
2580
-        DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(3), HMI_ValueStruct.Move_Z_scale);
2568
+        DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(1), HMI_ValueStruct.Move_X_scaled);
2569
+        DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(2), HMI_ValueStruct.Move_Y_scaled);
2570
+        DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(3), HMI_ValueStruct.Move_Z_scaled);
2581 2571
         DWIN_Draw_Signed_Float(font8x16, Color_Bg_Black, 3, 1, 216, MBASE(4), 0);
2582 2572
         DWIN_UpdateLCD();
2583 2573
       }
@@ -2602,20 +2592,20 @@ void HMI_AxisMove() {
2602 2592
         break;
2603 2593
       case 1: // X axis move
2604 2594
         checkkey = Move_X;
2605
-        HMI_ValueStruct.Move_X_scale = current_position.x * MINUNITMULT;
2606
-        DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 1, 216, MBASE(1), HMI_ValueStruct.Move_X_scale);
2595
+        HMI_ValueStruct.Move_X_scaled = current_position.x * MINUNITMULT;
2596
+        DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 1, 216, MBASE(1), HMI_ValueStruct.Move_X_scaled);
2607 2597
         EncoderRate.enabled = true;
2608 2598
         break;
2609 2599
       case 2: // Y axis move
2610 2600
         checkkey = Move_Y;
2611
-        HMI_ValueStruct.Move_Y_scale = current_position.y * MINUNITMULT;
2612
-        DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 1, 216, MBASE(2), HMI_ValueStruct.Move_Y_scale);
2601
+        HMI_ValueStruct.Move_Y_scaled = current_position.y * MINUNITMULT;
2602
+        DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 1, 216, MBASE(2), HMI_ValueStruct.Move_Y_scaled);
2613 2603
         EncoderRate.enabled = true;
2614 2604
         break;
2615 2605
       case 3: // Z axis move
2616 2606
         checkkey = Move_Z;
2617
-        HMI_ValueStruct.Move_Z_scale = current_position.z * MINUNITMULT;
2618
-        DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 1, 216, MBASE(3), HMI_ValueStruct.Move_Z_scale);
2607
+        HMI_ValueStruct.Move_Z_scaled = current_position.z * MINUNITMULT;
2608
+        DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 1, 216, MBASE(3), HMI_ValueStruct.Move_Z_scaled);
2619 2609
         EncoderRate.enabled = true;
2620 2610
         break;
2621 2611
         #if HAS_HOTEND
@@ -2630,8 +2620,8 @@ void HMI_AxisMove() {
2630 2620
               }
2631 2621
             #endif
2632 2622
             checkkey = Extruder;
2633
-            HMI_ValueStruct.Move_E_scale = current_position.e * MINUNITMULT;
2634
-            DWIN_Draw_Signed_Float(font8x16, Select_Color, 3, 1, 216, MBASE(4), HMI_ValueStruct.Move_E_scale);
2623
+            HMI_ValueStruct.Move_E_scaled = current_position.e * MINUNITMULT;
2624
+            DWIN_Draw_Signed_Float(font8x16, Select_Color, 3, 1, 216, MBASE(4), HMI_ValueStruct.Move_E_scaled);
2635 2625
             EncoderRate.enabled = true;
2636 2626
             break;
2637 2627
         #endif
@@ -3417,8 +3407,8 @@ void HMI_MaxAcceleration() {
3417 3407
       if (WITHIN(select_jerk.now, 1, 4)) {
3418 3408
         checkkey = MaxJerk_value;
3419 3409
         HMI_flag.jerk_axis = AxisEnum(select_jerk.now - 1);
3420
-        HMI_ValueStruct.Max_Jerk = planner.max_jerk[HMI_flag.jerk_axis] * MINUNITMULT;
3421
-        DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, UNITFDIGITS, 210, MBASE(select_jerk.now), HMI_ValueStruct.Max_Jerk);
3410
+        HMI_ValueStruct.Max_Jerk_scaled = planner.max_jerk[HMI_flag.jerk_axis] * MINUNITMULT;
3411
+        DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, UNITFDIGITS, 210, MBASE(select_jerk.now), HMI_ValueStruct.Max_Jerk_scaled);
3422 3412
         EncoderRate.enabled = true;
3423 3413
       }
3424 3414
       else { // Back
@@ -3447,8 +3437,8 @@ void HMI_Step() {
3447 3437
     if (WITHIN(select_step.now, 1, 4)) {
3448 3438
       checkkey = Step_value;
3449 3439
       HMI_flag.step_axis = AxisEnum(select_step.now - 1);
3450
-      HMI_ValueStruct.Max_Step = planner.settings.axis_steps_per_mm[HMI_flag.step_axis] * MINUNITMULT;
3451
-      DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, UNITFDIGITS, 210, MBASE(select_step.now), HMI_ValueStruct.Max_Step);
3440
+      HMI_ValueStruct.Max_Step_scaled = planner.settings.axis_steps_per_mm[HMI_flag.step_axis] * MINUNITMULT;
3441
+      DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, UNITFDIGITS, 210, MBASE(select_step.now), HMI_ValueStruct.Max_Step_scaled);
3452 3442
       EncoderRate.enabled = true;
3453 3443
     }
3454 3444
     else { // Back
@@ -3499,7 +3489,7 @@ void EachMomentUpdate() {
3499 3489
       planner.finish_and_disable();
3500 3490
 
3501 3491
       // show percent bar and value
3502
-      Percentrecord = 0;
3492
+      _card_percent = 0;
3503 3493
       Draw_Print_ProgressBar();
3504 3494
 
3505 3495
       // show print done confirm
@@ -3517,12 +3507,8 @@ void EachMomentUpdate() {
3517 3507
   if (HMI_flag.pause_action && printingIsPaused() && !planner.has_blocks_queued()) {
3518 3508
     HMI_flag.pause_action = false;
3519 3509
     #if ENABLED(PAUSE_HEAT)
3520
-      #if HAS_HEATED_BED
3521
-        tempbed = thermalManager.temp_bed.target;
3522
-      #endif
3523
-      #if HAS_HOTEND
3524
-        temphot = thermalManager.temp_hotend[0].target;
3525
-      #endif
3510
+      TERN_(HAS_HOTEND, resume_hotend_temp = thermalManager.temp_hotend[0].target);
3511
+      TERN_(HAS_HEATED_BED, resume_bed_temp = thermalManager.temp_bed.target);
3526 3512
       thermalManager.disable_all_heaters();
3527 3513
     #endif
3528 3514
     queue.inject_P(PSTR("G1 F1200 X0 Y0"));
@@ -3534,7 +3520,7 @@ void EachMomentUpdate() {
3534 3520
     if (last_cardpercentValue != card_pct) { // print percent
3535 3521
       last_cardpercentValue = card_pct;
3536 3522
       if (card_pct) {
3537
-        Percentrecord = card_pct;
3523
+        _card_percent = card_pct;
3538 3524
         Draw_Print_ProgressBar();
3539 3525
       }
3540 3526
     }
@@ -3551,8 +3537,8 @@ void EachMomentUpdate() {
3551 3537
 
3552 3538
     // Estimate remaining time every 20 seconds
3553 3539
     static millis_t next_remain_time_update = 0;
3554
-    if (Percentrecord > 1 && ELAPSED(ms, next_remain_time_update) && !HMI_flag.heat_flag) {
3555
-      remain_time = (elapsed.value - dwin_heat_time) / (Percentrecord * 0.01f) - (elapsed.value - dwin_heat_time);
3540
+    if (_card_percent > 1 && ELAPSED(ms, next_remain_time_update) && !HMI_flag.heat_flag) {
3541
+      _remain_time = (elapsed.value - dwin_heat_time) / (_card_percent * 0.01f) - (elapsed.value - dwin_heat_time);
3556 3542
       next_remain_time_update += SEC_TO_MS(20);
3557 3543
       Draw_Print_ProgressRemain();
3558 3544
     }

+ 6
- 6
Marlin/src/lcd/dwin/e3v2/dwin.h 파일 보기

@@ -240,13 +240,13 @@ typedef struct {
240 240
   int16_t print_speed     = 100;
241 241
   float Max_Feedspeed     = 0;
242 242
   float Max_Acceleration  = 0;
243
-  float Max_Jerk          = 0;
244
-  float Max_Step          = 0;
245
-  float Move_X_scale      = 0;
246
-  float Move_Y_scale      = 0;
247
-  float Move_Z_scale      = 0;
243
+  float Max_Jerk_scaled   = 0;
244
+  float Max_Step_scaled   = 0;
245
+  float Move_X_scaled     = 0;
246
+  float Move_Y_scaled     = 0;
247
+  float Move_Z_scaled     = 0;
248 248
   #if HAS_HOTEND
249
-    float Move_E_scale    = 0;
249
+    float Move_E_scaled   = 0;
250 250
   #endif
251 251
   float offset_value      = 0;
252 252
   int8_t show_mode        = 0; // -1: Temperature control    0: Printing temperature

Loading…
취소
저장