InsanityAutomation 3 лет назад
Родитель
Сommit
db82a25177
Аккаунт пользователя с таким Email не найден
1 измененных файлов: 28 добавлений и 50 удалений
  1. 28
    50
      Marlin/src/lcd/dwin/e3v2/dwin.cpp

+ 28
- 50
Marlin/src/lcd/dwin/e3v2/dwin.cpp Просмотреть файл

@@ -1212,69 +1212,57 @@ inline ENCODER_DiffState get_encoder_state() {
1212 1212
   return state;
1213 1213
 }
1214 1214
 
1215
+void HMI_Plan_Move(const feedRate_t fr_mm_s) {
1216
+  if (!planner.is_full()) {
1217
+    planner.synchronize();
1218
+    planner.buffer_line(current_position, fr_mm_s, active_extruder);
1219
+    DWIN_UpdateLCD();
1220
+  }
1221
+}
1222
+
1223
+void HMI_Move_Done(const AxisEnum axis) {
1224
+  EncoderRate.enabled = false;
1225
+  planner.synchronize();
1226
+  checkkey = AxisMove;
1227
+  DWIN_UpdateLCD();
1228
+}
1229
+
1215 1230
 void HMI_Move_X() {
1216 1231
   ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
1217 1232
   if (encoder_diffState != ENCODER_DIFF_NO) {
1218
-    if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Move_X_scaled)) {
1219
-      checkkey = AxisMove;
1220
-      EncoderRate.enabled = false;
1221
-      DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(1), HMI_ValueStruct.Move_X_scaled);
1222
-      if (!planner.is_full()) {
1223
-        // Wait for planner moves to finish!
1224
-        planner.synchronize();
1225
-        planner.buffer_line(current_position, homing_feedrate(X_AXIS), active_extruder);
1226
-      }
1227
-      DWIN_UpdateLCD();
1228
-      return;
1229
-    }
1233
+    if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Move_X_scaled))
1234
+      return HMI_Move_Done(X_AXIS);
1230 1235
     LIMIT(HMI_ValueStruct.Move_X_scaled, (X_MIN_POS) * MINUNITMULT, (X_MAX_POS) * MINUNITMULT);
1231 1236
     current_position.x = HMI_ValueStruct.Move_X_scaled / MINUNITMULT;
1232 1237
     DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, UNITFDIGITS, 216, MBASE(1), HMI_ValueStruct.Move_X_scaled);
1233 1238
     DWIN_UpdateLCD();
1239
+    HMI_Plan_Move(homing_feedrate(X_AXIS));
1234 1240
   }
1235 1241
 }
1236 1242
 
1237 1243
 void HMI_Move_Y() {
1238 1244
   ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
1239 1245
   if (encoder_diffState != ENCODER_DIFF_NO) {
1240
-    if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Move_Y_scaled)) {
1241
-      checkkey = AxisMove;
1242
-      EncoderRate.enabled = false;
1243
-      DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(2), HMI_ValueStruct.Move_Y_scaled);
1244
-      if (!planner.is_full()) {
1245
-        // Wait for planner moves to finish!
1246
-        planner.synchronize();
1247
-        planner.buffer_line(current_position, homing_feedrate(Y_AXIS), active_extruder);
1248
-      }
1249
-      DWIN_UpdateLCD();
1250
-      return;
1251
-    }
1246
+    if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Move_Y_scaled))
1247
+      return HMI_Move_Done(Y_AXIS);
1252 1248
     LIMIT(HMI_ValueStruct.Move_Y_scaled, (Y_MIN_POS) * MINUNITMULT, (Y_MAX_POS) * MINUNITMULT);
1253 1249
     current_position.y = HMI_ValueStruct.Move_Y_scaled / MINUNITMULT;
1254 1250
     DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, UNITFDIGITS, 216, MBASE(2), HMI_ValueStruct.Move_Y_scaled);
1255 1251
     DWIN_UpdateLCD();
1252
+    HMI_Plan_Move(homing_feedrate(Y_AXIS));
1256 1253
   }
1257 1254
 }
1258 1255
 
1259 1256
 void HMI_Move_Z() {
1260 1257
   ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
1261 1258
   if (encoder_diffState != ENCODER_DIFF_NO) {
1262
-    if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Move_Z_scaled)) {
1263
-      checkkey = AxisMove;
1264
-      EncoderRate.enabled = false;
1265
-      DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, UNITFDIGITS, 216, MBASE(3), HMI_ValueStruct.Move_Z_scaled);
1266
-      if (!planner.is_full()) {
1267
-        // Wait for planner moves to finish!
1268
-        planner.synchronize();
1269
-        planner.buffer_line(current_position, homing_feedrate(Z_AXIS), active_extruder);
1270
-      }
1271
-      DWIN_UpdateLCD();
1272
-      return;
1273
-    }
1274
-    LIMIT(HMI_ValueStruct.Move_Z_scaled, Z_MIN_POS * MINUNITMULT, Z_MAX_POS * MINUNITMULT);
1259
+    if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Move_Z_scaled))
1260
+      return HMI_Move_Done(Z_AXIS);
1261
+    LIMIT(HMI_ValueStruct.Move_Z_scaled, (Z_MIN_POS) * MINUNITMULT, (Z_MAX_POS) * MINUNITMULT);
1275 1262
     current_position.z = HMI_ValueStruct.Move_Z_scaled / MINUNITMULT;
1276 1263
     DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, UNITFDIGITS, 216, MBASE(3), HMI_ValueStruct.Move_Z_scaled);
1277 1264
     DWIN_UpdateLCD();
1265
+    HMI_Plan_Move(homing_feedrate(Z_AXIS));
1278 1266
   }
1279 1267
 }
1280 1268
 
@@ -1285,24 +1273,14 @@ void HMI_Move_Z() {
1285 1273
     ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
1286 1274
     if (encoder_diffState != ENCODER_DIFF_NO) {
1287 1275
       if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Move_E_scaled)) {
1288
-        checkkey = AxisMove;
1289
-        EncoderRate.enabled = false;
1290 1276
         last_E_scaled = HMI_ValueStruct.Move_E_scaled;
1291
-        DWIN_Draw_Signed_Float(font8x16, Color_Bg_Black, 3, UNITFDIGITS, 216, MBASE(4), HMI_ValueStruct.Move_E_scaled);
1292
-        if (!planner.is_full()) {
1293
-          planner.synchronize(); // Wait for planner moves to finish!
1294
-          planner.buffer_line(current_position, MMM_TO_MMS(FEEDRATE_E), active_extruder);
1295
-        }
1296
-        DWIN_UpdateLCD();
1297
-        return;
1277
+        return HMI_Move_Done(E_AXIS);
1298 1278
       }
1299
-      if ((HMI_ValueStruct.Move_E_scaled - last_E_scaled) > (EXTRUDE_MAXLENGTH) * MINUNITMULT)
1300
-        HMI_ValueStruct.Move_E_scaled = last_E_scaled + (EXTRUDE_MAXLENGTH) * MINUNITMULT;
1301
-      else if ((last_E_scaled - HMI_ValueStruct.Move_E_scaled) > (EXTRUDE_MAXLENGTH) * MINUNITMULT)
1302
-        HMI_ValueStruct.Move_E_scaled = last_E_scaled - (EXTRUDE_MAXLENGTH) * MINUNITMULT;
1279
+      LIMIT(HMI_ValueStruct.Move_E_scaled, last_E_scaled - (EXTRUDE_MAXLENGTH) * MINUNITMULT, last_E_scaled + (EXTRUDE_MAXLENGTH) * MINUNITMULT);
1303 1280
       current_position.e = HMI_ValueStruct.Move_E_scaled / MINUNITMULT;
1304 1281
       DWIN_Draw_Signed_Float(font8x16, Color_Bg_Black, 3, UNITFDIGITS, 216, MBASE(4), HMI_ValueStruct.Move_E_scaled);
1305 1282
       DWIN_UpdateLCD();
1283
+      HMI_Plan_Move(MMM_TO_MMS(FEEDRATE_E));
1306 1284
     }
1307 1285
   }
1308 1286
 

Загрузка…
Отмена
Сохранить