Browse Source

Fix PID + Thermal Protection combos (#18023)

Jason Smith 4 years ago
parent
commit
94063e3a87
No account linked to committer's email address

+ 9
- 5
Marlin/Configuration.h View File

479
 #define BANG_MAX 255     // Limits current to nozzle while in bang-bang mode; 255=full current
479
 #define BANG_MAX 255     // Limits current to nozzle while in bang-bang mode; 255=full current
480
 #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
480
 #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
481
 #define PID_K1 0.95      // Smoothing factor within any PID loop
481
 #define PID_K1 0.95      // Smoothing factor within any PID loop
482
+
482
 #if ENABLED(PIDTEMP)
483
 #if ENABLED(PIDTEMP)
483
   //#define PID_EDIT_MENU         // Add PID editing to the "Advanced Settings" menu. (~700 bytes of PROGMEM)
484
   //#define PID_EDIT_MENU         // Add PID editing to the "Advanced Settings" menu. (~700 bytes of PROGMEM)
484
   //#define PID_AUTOTUNE_MENU     // Add PID auto-tuning to the "Advanced Settings" menu. (~250 bytes of PROGMEM)
485
   //#define PID_AUTOTUNE_MENU     // Add PID auto-tuning to the "Advanced Settings" menu. (~250 bytes of PROGMEM)
485
-  //#define PID_DEBUG             // Sends debug data to the serial port. Use 'M303 D' to toggle activation.
486
-  //#define PID_OPENLOOP 1        // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
487
-  //#define SLOW_PWM_HEATERS      // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
488
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
486
   //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
489
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
487
                                   // Set/get with gcode: M301 E[extruder number, 0-2]
490
-  #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
491
-                                  // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
492
 
488
 
493
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
489
   // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
494
 
490
 
557
   // FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles.
553
   // FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles.
558
 #endif // PIDTEMPBED
554
 #endif // PIDTEMPBED
559
 
555
 
556
+#if EITHER(PIDTEMP, PIDTEMPBED)
557
+  //#define PID_DEBUG             // Sends debug data to the serial port. Use 'M303 D' to toggle activation.
558
+  //#define PID_OPENLOOP          // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
559
+  //#define SLOW_PWM_HEATERS      // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
560
+  #define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
561
+                                  // is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
562
+#endif 
563
+
560
 // @section extruder
564
 // @section extruder
561
 
565
 
562
 /**
566
 /**

+ 7
- 7
Marlin/src/module/temperature.cpp View File

381
       #define ONHEATINGSTART() printerEventLEDs.onHotendHeatingStart()
381
       #define ONHEATINGSTART() printerEventLEDs.onHotendHeatingStart()
382
       #define ONHEATING(S,C,T) printerEventLEDs.onHotendHeating(S,C,T)
382
       #define ONHEATING(S,C,T) printerEventLEDs.onHotendHeating(S,C,T)
383
     #endif
383
     #endif
384
+    #define WATCH_PID BOTH(WATCH_BED, PIDTEMPBED) || BOTH(WATCH_HOTENDS, PIDTEMP)
384
 
385
 
385
-    #if WATCH_BED || WATCH_HOTENDS
386
-      #define HAS_TP_BED BOTH(THERMAL_PROTECTION_BED, PIDTEMPBED)
387
-      #if HAS_TP_BED && BOTH(THERMAL_PROTECTION_HOTENDS, PIDTEMP)
386
+    #if WATCH_PID
387
+      #if ALL(THERMAL_PROTECTION_HOTENDS, PIDTEMP, THERMAL_PROTECTION_BED, PIDTEMPBED)
388
         #define GTV(B,H) (isbed ? (B) : (H))
388
         #define GTV(B,H) (isbed ? (B) : (H))
389
-      #elif HAS_TP_BED
390
-        #define GTV(B,H) (B)
391
-      #else
389
+      #elif BOTH(THERMAL_PROTECTION_HOTENDS, PIDTEMP)
392
         #define GTV(B,H) (H)
390
         #define GTV(B,H) (H)
391
+      #else
392
+        #define GTV(B,H) (B)
393
       #endif
393
       #endif
394
       const uint16_t watch_temp_period = GTV(WATCH_BED_TEMP_PERIOD, WATCH_TEMP_PERIOD);
394
       const uint16_t watch_temp_period = GTV(WATCH_BED_TEMP_PERIOD, WATCH_TEMP_PERIOD);
395
       const uint8_t watch_temp_increase = GTV(WATCH_BED_TEMP_INCREASE, WATCH_TEMP_INCREASE);
395
       const uint8_t watch_temp_increase = GTV(WATCH_BED_TEMP_INCREASE, WATCH_TEMP_INCREASE);
528
         next_temp_ms = ms + 2000UL;
528
         next_temp_ms = ms + 2000UL;
529
 
529
 
530
         // Make sure heating is actually working
530
         // Make sure heating is actually working
531
-        #if WATCH_BED || WATCH_HOTENDS
531
+        #if WATCH_PID
532
           if (BOTH(WATCH_BED, WATCH_HOTENDS) || isbed == DISABLED(WATCH_HOTENDS)) {
532
           if (BOTH(WATCH_BED, WATCH_HOTENDS) || isbed == DISABLED(WATCH_HOTENDS)) {
533
             if (!heated) {                                            // If not yet reached target...
533
             if (!heated) {                                            // If not yet reached target...
534
               if (current_temp > next_watch_temp) {                   // Over the watch temp?
534
               if (current_temp > next_watch_temp) {                   // Over the watch temp?

+ 4
- 2
buildroot/share/tests/mks_robin_pro-tests View File

10
 opt_set SDCARD_CONNECTION LCD
10
 opt_set SDCARD_CONNECTION LCD
11
 opt_set X_DRIVER_TYPE TMC2209
11
 opt_set X_DRIVER_TYPE TMC2209
12
 opt_set Y_DRIVER_TYPE TMC2130
12
 opt_set Y_DRIVER_TYPE TMC2130
13
-exec_test $1 $2 "MKS Robin Pro with TMC Drivers "
13
+opt_set TEMP_SENSOR_BED 1
14
+opt_disable THERMAL_PROTECTION_HOTENDS
15
+exec_test $1 $2 "MKS Robin Pro with TMC Drivers, hotend thermal protection disabled"
14
 
16
 
15
 # cleanup
17
 # cleanup
16
-restore_configs
18
+#restore_configs

+ 5
- 1
buildroot/share/tests/rumba32_f446ve-tests View File

10
 restore_configs
10
 restore_configs
11
 opt_set MOTHERBOARD BOARD_RUMBA32_AUS3D
11
 opt_set MOTHERBOARD BOARD_RUMBA32_AUS3D
12
 opt_set SERIAL_PORT -1
12
 opt_set SERIAL_PORT -1
13
+opt_disable PIDTEMP
14
+opt_enable PIDTEMPBED
15
+opt_set TEMP_SENSOR_BED 1
16
+opt_disable THERMAL_PROTECTION_BED
13
 opt_set X_DRIVER_TYPE TMC2130
17
 opt_set X_DRIVER_TYPE TMC2130
14
-exec_test $1 $2 "rumba32_f446ve Default Config with TMC2130"
18
+exec_test $1 $2 "rumba32_f446ve with TMC2130, PID Bed, and bed thermal protection disabled"
15
 
19
 
16
 # cleanup
20
 # cleanup
17
 restore_configs
21
 restore_configs

Loading…
Cancel
Save