瀏覽代碼

E3 V2 DWIN: Z-Offset, cleanup, versatility (#19384)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
cosmoderp 4 年之前
父節點
當前提交
073b7f1e3a
沒有連結到貢獻者的電子郵件帳戶。

+ 1
- 1
Marlin/Configuration_adv.h 查看文件

@@ -1572,6 +1572,7 @@
1572 1572
 #if ENABLED(BABYSTEPPING)
1573 1573
   //#define INTEGRATED_BABYSTEPPING         // EXPERIMENTAL integration of babystepping into the Stepper ISR
1574 1574
   //#define BABYSTEP_WITHOUT_HOMING
1575
+  //#define BABYSTEP_ALWAYS_AVAILABLE       // Allow babystepping at all times (not just during movement).
1575 1576
   //#define BABYSTEP_XY                     // Also enable X/Y Babystepping. Not supported on DELTA!
1576 1577
   #define BABYSTEP_INVERT_Z false           // Change if Z babysteps should go the other way
1577 1578
   //#define BABYSTEP_MILLIMETER_UNITS       // Specify BABYSTEP_MULTIPLICATOR_(XY|Z) in mm instead of micro-steps
@@ -1582,7 +1583,6 @@
1582 1583
   #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING)
1583 1584
     #define DOUBLECLICK_MAX_INTERVAL 1250   // Maximum interval between clicks, in milliseconds.
1584 1585
                                             // Note: Extra time may be added to mitigate controller latency.
1585
-    //#define BABYSTEP_ALWAYS_AVAILABLE     // Allow babystepping at all times (not just during movement).
1586 1586
     //#define MOVE_Z_WHEN_IDLE              // Jump to the move Z menu on doubleclick when printer is idle.
1587 1587
     #if ENABLED(MOVE_Z_WHEN_IDLE)
1588 1588
       #define MOVE_Z_IDLE_MULTIPLICATOR 1   // Multiply 1mm by this factor for the move step size.

+ 1
- 1
Marlin/src/inc/Conditionals_adv.h 查看文件

@@ -59,7 +59,7 @@
59 59
 #if TEMP_SENSOR_BED == 0
60 60
   #undef THERMAL_PROTECTION_BED
61 61
   #undef THERMAL_PROTECTION_BED_PERIOD
62
-#endif 
62
+#endif
63 63
 
64 64
 #if TEMP_SENSOR_CHAMBER == 0
65 65
   #undef THERMAL_PROTECTION_CHAMBER

+ 1263
- 989
Marlin/src/lcd/dwin/e3v2/dwin.cpp
文件差異過大導致無法顯示
查看文件


+ 70
- 66
Marlin/src/lcd/dwin/e3v2/dwin.h 查看文件

@@ -29,9 +29,16 @@
29 29
 #include "rotary_encoder.h"
30 30
 #include "../../../libs/BL24CXX.h"
31 31
 
32
-#include <stdint.h>
32
+#include "../../../inc/MarlinConfigPre.h"
33 33
 
34
-enum processID {
34
+#if ANY(HAS_HOTEND, HAS_HEATED_BED, HAS_FAN) && PREHEAT_COUNT
35
+  #define HAS_PREHEAT 1
36
+  #if PREHEAT_COUNT < 2
37
+    #error "Creality DWIN requires two material preheat presets."
38
+  #endif
39
+#endif
40
+
41
+enum processID : uint8_t {
35 42
   // Process ID
36 43
   MainMenu,
37 44
   SelectFile,
@@ -44,7 +51,7 @@ enum processID {
44 51
   Motion,
45 52
   Info,
46 53
   Tune,
47
-  #if HAS_HOTEND
54
+  #if HAS_PREHEAT
48 55
     PLAPreheat,
49 56
     ABSPreheat,
50 57
   #endif
@@ -218,7 +225,7 @@ enum processID {
218 225
 #define BarFill_Color     0x10E4  // fill color of progress bar
219 226
 #define Select_Color      0x33BB  // selected color
220 227
 
221
-extern int checkkey, last_checkkey;
228
+extern uint8_t checkkey;
222 229
 extern float zprobe_zoffset;
223 230
 extern char print_filename[16];
224 231
 
@@ -227,7 +234,7 @@ extern millis_t dwin_heat_time;
227 234
 typedef struct {
228 235
   TERN_(HAS_HOTEND,     int16_t E_Temp    = 0);
229 236
   TERN_(HAS_HEATED_BED, int16_t Bed_Temp  = 0);
230
-  TERN_(HAS_FAN,        int16_t Fan_speed = 0);
237
+  TERN_(HAS_PREHEAT,    int16_t Fan_speed = 0);
231 238
   int16_t print_speed     = 100;
232 239
   float Max_Feedspeed     = 0;
233 240
   float Max_Acceleration  = 0;
@@ -236,7 +243,7 @@ typedef struct {
236 243
   float Move_X_scale      = 0;
237 244
   float Move_Y_scale      = 0;
238 245
   float Move_Z_scale      = 0;
239
-  #if EXTRUDERS
246
+  #if HAS_HOTEND
240 247
     float Move_E_scale    = 0;
241 248
   #endif
242 249
   float offset_value      = 0;
@@ -246,33 +253,27 @@ typedef struct {
246 253
 typedef struct {
247 254
   bool language_chinese;  // 0: EN, 1: CN
248 255
   bool pause_flag:1;
256
+  bool pause_action:1;
249 257
   bool print_finish:1;
250
-  bool confirm_flag:1;
258
+  bool done_confirm_flag:1;
251 259
   bool select_flag:1;
252 260
   bool home_flag:1;
253 261
   bool heat_flag:1;  // 0: heating done  1: during heating
254
-  #if HAS_HOTEND
262
+  #if ENABLED(PREVENT_COLD_EXTRUSION)
255 263
     bool ETempTooLow_flag:1;
256 264
   #endif
257 265
   #if HAS_LEVELING
258 266
     bool leveling_offset_flag:1;
259 267
   #endif
260 268
   #if HAS_FAN
261
-    AxisEnum feedspeed_flag;
269
+    AxisEnum feedspeed_axis;
262 270
   #endif
263
-  AxisEnum acc_flag;
264
-  AxisEnum jerk_flag;
265
-  AxisEnum step_flag;
271
+  AxisEnum acc_axis, jerk_axis, step_axis;
266 272
 } HMI_Flag;
267 273
 
268 274
 extern HMI_value_t HMI_ValueStruct;
269 275
 extern HMI_Flag    HMI_flag;
270 276
 
271
-// Language
272
-void HMI_SetLanguage(void);
273
-void HMI_SetAndSaveLanguageWestern(void);
274
-void HMI_SetAndSaveLanguageChinese(void);
275
-
276 277
 // Show ICO
277 278
 void ICON_Print(bool show);
278 279
 void ICON_Prepare(bool show);
@@ -285,44 +286,47 @@ void ICON_Pause(bool show);
285 286
 void ICON_Continue(bool show);
286 287
 void ICON_Stop(bool show);
287 288
 
288
-// Popup window tips
289
+#if HAS_HOTEND || HAS_HEATED_BED
290
+  // Popup message window
291
+  void DWIN_Popup_Temperature(const bool toohigh);
292
+#endif
293
+
289 294
 #if HAS_HOTEND
290
-  void Popup_Window_Temperature(const bool toohigh);
291
-  void Popup_Window_ETempTooLow(void);
295
+  void Popup_Window_ETempTooLow();
292 296
 #endif
293 297
 
294
-void Popup_Window_Resume(void);
295
-void Popup_Window_Home(void);
296
-void Popup_Window_Leveling(void);
298
+void Popup_Window_Resume();
299
+void Popup_Window_Home(const bool parking=false);
300
+void Popup_Window_Leveling();
297 301
 
298
-void Goto_PrintProcess(void);
299
-void Goto_MainMenu(void);
302
+void Goto_PrintProcess();
303
+void Goto_MainMenu();
300 304
 
301 305
 // Variable control
302
-void HMI_Move_X(void);
303
-void HMI_Move_Y(void);
304
-void HMI_Move_Z(void);
305
-void HMI_Move_E(void);
306
+void HMI_Move_X();
307
+void HMI_Move_Y();
308
+void HMI_Move_Z();
309
+void HMI_Move_E();
306 310
 
307
-void HMI_Zoffset(void);
311
+void HMI_Zoffset();
308 312
 
309
-TERN_(HAS_HOTEND,     void HMI_ETemp(void));
310
-TERN_(HAS_HEATED_BED, void HMI_BedTemp(void));
311
-TERN_(HAS_FAN,        void HMI_FanSpeed(void));
313
+TERN_(HAS_HOTEND,     void HMI_ETemp());
314
+TERN_(HAS_HEATED_BED, void HMI_BedTemp());
315
+TERN_(HAS_FAN,        void HMI_FanSpeed());
312 316
 
313
-void HMI_PrintSpeed(void);
317
+void HMI_PrintSpeed();
314 318
 
315
-void HMI_MaxFeedspeedXYZE(void);
316
-void HMI_MaxAccelerationXYZE(void);
317
-void HMI_MaxJerkXYZE(void);
318
-void HMI_StepXYZE(void);
319
+void HMI_MaxFeedspeedXYZE();
320
+void HMI_MaxAccelerationXYZE();
321
+void HMI_MaxJerkXYZE();
322
+void HMI_StepXYZE();
319 323
 
320
-void update_variable(void);
324
+void update_variable();
321 325
 void DWIN_Draw_Signed_Float(uint8_t size, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, long value);
322 326
 
323 327
 // SD Card
324
-void HMI_SDCardInit(void);
325
-void HMI_SDCardUpdate(void);
328
+void HMI_SDCardInit();
329
+void HMI_SDCardUpdate();
326 330
 
327 331
 // Main Process
328 332
 void Icon_print(bool value);
@@ -333,32 +337,32 @@ void Icon_leveling(bool value);
333 337
 // Other
334 338
 bool Pause_HeatStatus();
335 339
 void HMI_StartFrame(const bool with_update); // Startup screen
336
-void HMI_MainMenu(void);    // Main process screen
337
-void HMI_SelectFile(void);  // File page
338
-void HMI_Printing(void);    // Print page
339
-void HMI_Prepare(void);     // Prepare page
340
-void HMI_Control(void);     // Control page
341
-void HMI_Leveling(void);    // Level the page
342
-void HMI_AxisMove(void);    // Axis movement menu
343
-void HMI_Temperature(void); // Temperature menu
344
-void HMI_Motion(void);      // Sports menu
345
-void HMI_Info(void);        // Information menu
346
-void HMI_Tune(void);        // Adjust the menu
347
-
348
-#if HAS_HOTEND
349
-  void HMI_PLAPreheatSetting(void); // PLA warm-up setting
350
-  void HMI_ABSPreheatSetting(void); // ABS warm-up setting
340
+void HMI_MainMenu();    // Main process screen
341
+void HMI_SelectFile();  // File page
342
+void HMI_Printing();    // Print page
343
+void HMI_Prepare();     // Prepare page
344
+void HMI_Control();     // Control page
345
+void HMI_Leveling();    // Level the page
346
+void HMI_AxisMove();    // Axis movement menu
347
+void HMI_Temperature(); // Temperature menu
348
+void HMI_Motion();      // Sports menu
349
+void HMI_Info();        // Information menu
350
+void HMI_Tune();        // Adjust the menu
351
+
352
+#if HAS_PREHEAT
353
+  void HMI_PLAPreheatSetting(); // PLA warm-up setting
354
+  void HMI_ABSPreheatSetting(); // ABS warm-up setting
351 355
 #endif
352 356
 
353
-void HMI_MaxSpeed(void);        // Maximum speed submenu
354
-void HMI_MaxAcceleration(void); // Maximum acceleration submenu
355
-void HMI_MaxJerk(void);         // Maximum jerk speed submenu
356
-void HMI_Step(void);            // Transmission ratio
357
+void HMI_MaxSpeed();        // Maximum speed submenu
358
+void HMI_MaxAcceleration(); // Maximum acceleration submenu
359
+void HMI_MaxJerk();         // Maximum jerk speed submenu
360
+void HMI_Step();            // Transmission ratio
357 361
 
358
-void HMI_Init(void);
359
-void DWIN_Update(void);
360
-void EachMomentUpdate(void);
361
-void DWIN_HandleScreen(void);
362
+void HMI_Init();
363
+void DWIN_Update();
364
+void EachMomentUpdate();
365
+void DWIN_HandleScreen();
362 366
 
363
-void DWIN_CompletedHoming(void);
364
-void DWIN_CompletedLeveling(void);
367
+void DWIN_CompletedHoming();
368
+void DWIN_CompletedLeveling();

+ 1
- 1
Marlin/src/lcd/dwin/e3v2/rotary_encoder.cpp 查看文件

@@ -124,7 +124,7 @@ ENCODER_DiffState Encoder_ReceiveAnalyze(void) {
124 124
       int32_t encoderMultiplier = 1;
125 125
 
126 126
       // if must encoder rati multiplier
127
-      if (EncoderRate.encoderRateEnabled) {
127
+      if (EncoderRate.enabled) {
128 128
         const float abs_diff = ABS(temp_diff),
129 129
                     encoderMovementSteps = abs_diff / (ENCODER_PULSES_PER_STEP);
130 130
         if (EncoderRate.lastEncoderTime) {

+ 1
- 1
Marlin/src/lcd/dwin/e3v2/rotary_encoder.h 查看文件

@@ -44,7 +44,7 @@
44 44
 #define BUTTON_PRESSED(BN) !READ(BTN_## BN)
45 45
 
46 46
 typedef struct {
47
-  bool encoderRateEnabled = 0;
47
+  bool enabled = false;
48 48
   int encoderMoveValue = 0;
49 49
   millis_t lastEncoderTime = 0;
50 50
 } ENCODER_Rate;

+ 12
- 14
Marlin/src/module/temperature.cpp 查看文件

@@ -576,7 +576,7 @@ volatile bool Temperature::raw_temps_ready = false;
576 576
         #define MAX_CYCLE_TIME_PID_AUTOTUNE 20L
577 577
       #endif
578 578
       if ((ms - _MIN(t1, t2)) > (MAX_CYCLE_TIME_PID_AUTOTUNE * 60L * 1000L)) {
579
-        TERN_(DWIN_CREALITY_LCD, Popup_Window_Temperature(0));
579
+        TERN_(DWIN_CREALITY_LCD, DWIN_Popup_Temperature(0));
580 580
         TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TUNING_TIMEOUT));
581 581
         SERIAL_ECHOLNPGM(STR_PID_TIMEOUT);
582 582
         break;
@@ -812,12 +812,16 @@ void Temperature::_temp_error(const heater_id_t heater_id, PGM_P const serial_ms
812 812
 }
813 813
 
814 814
 void Temperature::max_temp_error(const heater_id_t heater_id) {
815
-  TERN_(DWIN_CREALITY_LCD, Popup_Window_Temperature(1));
815
+  #if ENABLED(DWIN_CREALITY_LCD) && (HAS_HOTEND || HAS_HEATED_BED)
816
+    DWIN_Popup_Temperature(1);
817
+  #endif
816 818
   _temp_error(heater_id, PSTR(STR_T_MAXTEMP), GET_TEXT(MSG_ERR_MAXTEMP));
817 819
 }
818 820
 
819 821
 void Temperature::min_temp_error(const heater_id_t heater_id) {
820
-  TERN_(DWIN_CREALITY_LCD, Popup_Window_Temperature(0));
822
+  #if ENABLED(DWIN_CREALITY_LCD) && (HAS_HOTEND || HAS_HEATED_BED)
823
+    DWIN_Popup_Temperature(0);
824
+  #endif
821 825
   _temp_error(heater_id, PSTR(STR_T_MINTEMP), GET_TEXT(MSG_ERR_MINTEMP));
822 826
 }
823 827
 
@@ -1055,7 +1059,7 @@ void Temperature::manage_heater() {
1055 1059
         // Make sure temperature is increasing
1056 1060
         if (watch_hotend[e].next_ms && ELAPSED(ms, watch_hotend[e].next_ms)) {  // Time to check this extruder?
1057 1061
           if (degHotend(e) < watch_hotend[e].target) {                          // Failed to increase enough?
1058
-            TERN_(DWIN_CREALITY_LCD, Popup_Window_Temperature(0));
1062
+            TERN_(DWIN_CREALITY_LCD, DWIN_Popup_Temperature(0));
1059 1063
             _temp_error((heater_id_t)e, str_t_heating_failed, GET_TEXT(MSG_HEATING_FAILED_LCD));
1060 1064
           }
1061 1065
           else                                                                  // Start again if the target is still far off
@@ -1098,7 +1102,7 @@ void Temperature::manage_heater() {
1098 1102
       // Make sure temperature is increasing
1099 1103
       if (watch_bed.elapsed(ms)) {        // Time to check the bed?
1100 1104
         if (degBed() < watch_bed.target) {                              // Failed to increase enough?
1101
-          TERN_(DWIN_CREALITY_LCD, Popup_Window_Temperature(0));
1105
+          TERN_(DWIN_CREALITY_LCD, DWIN_Popup_Temperature(0));
1102 1106
           _temp_error(H_BED, str_t_heating_failed, GET_TEXT(MSG_HEATING_FAILED_LCD));
1103 1107
         }
1104 1108
         else                                                            // Start again if the target is still far off
@@ -2023,7 +2027,7 @@ void Temperature::init() {
2023 2027
         state = TRRunaway;
2024 2028
 
2025 2029
       case TRRunaway:
2026
-        TERN_(DWIN_CREALITY_LCD, Popup_Window_Temperature(0));
2030
+        TERN_(DWIN_CREALITY_LCD, DWIN_Popup_Temperature(0));
2027 2031
         _temp_error(heater_id, str_t_thermal_runaway, GET_TEXT(MSG_THERMAL_RUNAWAY));
2028 2032
     }
2029 2033
   }
@@ -2440,14 +2444,8 @@ void Temperature::tick() {
2440 2444
 
2441 2445
   #if DISABLED(SLOW_PWM_HEATERS)
2442 2446
 
2443
-    #if HAS_HOTEND || HAS_HEATED_BED || HAS_HEATED_CHAMBER
2444
-      constexpr uint8_t pwm_mask =
2445
-        #if ENABLED(SOFT_PWM_DITHER)
2446
-          _BV(SOFT_PWM_SCALE) - 1
2447
-        #else
2448
-          0
2449
-        #endif
2450
-      ;
2447
+    #if ANY(HAS_HOTEND, HAS_HEATED_BED, HAS_HEATED_CHAMBER, FAN_SOFT_PWM)
2448
+      constexpr uint8_t pwm_mask = TERN0(SOFT_PWM_DITHER, _BV(SOFT_PWM_SCALE) - 1);
2451 2449
       #define _PWM_MOD(N,S,T) do{                           \
2452 2450
         const bool on = S.add(pwm_mask, T.soft_pwm_amount); \
2453 2451
         WRITE_HEATER_##N(on);                               \

+ 0
- 4
buildroot/share/PlatformIO/scripts/common-dependencies.h 查看文件

@@ -89,10 +89,6 @@
89 89
   #define HAS_GCODE_M876
90 90
 #endif
91 91
 
92
-#if PREHEAT_COUNT
93
-  #define HAS_PREHEAT_COUNT
94
-#endif
95
-
96 92
 #if EXTRUDERS
97 93
   #define HAS_EXTRUDERS
98 94
   #if EXTRUDERS > 1

+ 0
- 2
platformio.ini 查看文件

@@ -153,7 +153,6 @@ default_src_filter = +<src/*> -<src/config> -<src/HAL> +<src/HAL/shared>
153 153
   -<src/gcode/host/M360.cpp>
154 154
   -<src/gcode/host/M876.cpp>
155 155
   -<src/gcode/lcd/M0_M1.cpp>
156
-  -<src/gcode/lcd/M145.cpp>
157 156
   -<src/gcode/lcd/M250.cpp>
158 157
   -<src/gcode/lcd/M73.cpp>
159 158
   -<src/gcode/lcd/M995.cpp>
@@ -330,7 +329,6 @@ HOST_KEEPALIVE_FEATURE  = src_filter=+<src/gcode/host/M113.cpp>
330 329
 REPETIER_GCODE_M360     = src_filter=+<src/gcode/host/M360.cpp>
331 330
 HAS_GCODE_M876          = src_filter=+<src/gcode/host/M876.cpp>
332 331
 HAS_RESUME_CONTINUE     = src_filter=+<src/gcode/lcd/M0_M1.cpp>
333
-HAS_PREHEAT_COUNT       = src_filter=+<src/gcode/lcd/M145.cpp>
334 332
 HAS_LCD_CONTRAST        = src_filter=+<src/gcode/lcd/M250.cpp>
335 333
 LCD_SET_PROGRESS_MANUALLY = src_filter=+<src/gcode/lcd/M73.cpp>
336 334
 TOUCH_SCREEN_CALIBRATION = src_filter=+<src/gcode/lcd/M995.cpp>

Loading…
取消
儲存