Fix PID + Thermal Protection combos (#18023)

This commit is contained in:
Jason Smith 2020-05-18 11:51:32 -07:00 committed by GitHub
parent 213d4b890e
commit 94063e3a87
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 15 deletions

View file

@ -479,16 +479,12 @@
#define BANG_MAX 255 // Limits current to nozzle while in bang-bang mode; 255=full current #define BANG_MAX 255 // Limits current to nozzle while in bang-bang mode; 255=full current
#define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current #define PID_MAX BANG_MAX // Limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
#define PID_K1 0.95 // Smoothing factor within any PID loop #define PID_K1 0.95 // Smoothing factor within any PID loop
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
//#define PID_EDIT_MENU // Add PID editing to the "Advanced Settings" menu. (~700 bytes of PROGMEM) //#define PID_EDIT_MENU // Add PID editing to the "Advanced Settings" menu. (~700 bytes of PROGMEM)
//#define PID_AUTOTUNE_MENU // Add PID auto-tuning to the "Advanced Settings" menu. (~250 bytes of PROGMEM) //#define PID_AUTOTUNE_MENU // Add PID auto-tuning to the "Advanced Settings" menu. (~250 bytes of PROGMEM)
//#define PID_DEBUG // Sends debug data to the serial port. Use 'M303 D' to toggle activation.
//#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
//#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
//#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders) //#define PID_PARAMS_PER_HOTEND // Uses separate PID parameters for each extruder (useful for mismatched extruders)
// Set/get with gcode: M301 E[extruder number, 0-2] // Set/get with gcode: M301 E[extruder number, 0-2]
#define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
// is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
// If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it // If you are using a pre-configured hotend then you can use one of the value sets by uncommenting it
@ -557,6 +553,14 @@
// FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles. // FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles.
#endif // PIDTEMPBED #endif // PIDTEMPBED
#if EITHER(PIDTEMP, PIDTEMPBED)
//#define PID_DEBUG // Sends debug data to the serial port. Use 'M303 D' to toggle activation.
//#define PID_OPENLOOP // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
//#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
#define PID_FUNCTIONAL_RANGE 10 // If the temperature difference between the target temperature and the actual temperature
// is more than PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
#endif
// @section extruder // @section extruder
/** /**

View file

@ -381,15 +381,15 @@ volatile bool Temperature::raw_temps_ready = false;
#define ONHEATINGSTART() printerEventLEDs.onHotendHeatingStart() #define ONHEATINGSTART() printerEventLEDs.onHotendHeatingStart()
#define ONHEATING(S,C,T) printerEventLEDs.onHotendHeating(S,C,T) #define ONHEATING(S,C,T) printerEventLEDs.onHotendHeating(S,C,T)
#endif #endif
#define WATCH_PID BOTH(WATCH_BED, PIDTEMPBED) || BOTH(WATCH_HOTENDS, PIDTEMP)
#if WATCH_BED || WATCH_HOTENDS #if WATCH_PID
#define HAS_TP_BED BOTH(THERMAL_PROTECTION_BED, PIDTEMPBED) #if ALL(THERMAL_PROTECTION_HOTENDS, PIDTEMP, THERMAL_PROTECTION_BED, PIDTEMPBED)
#if HAS_TP_BED && BOTH(THERMAL_PROTECTION_HOTENDS, PIDTEMP)
#define GTV(B,H) (isbed ? (B) : (H)) #define GTV(B,H) (isbed ? (B) : (H))
#elif HAS_TP_BED #elif BOTH(THERMAL_PROTECTION_HOTENDS, PIDTEMP)
#define GTV(B,H) (B)
#else
#define GTV(B,H) (H) #define GTV(B,H) (H)
#else
#define GTV(B,H) (B)
#endif #endif
const uint16_t watch_temp_period = GTV(WATCH_BED_TEMP_PERIOD, WATCH_TEMP_PERIOD); const uint16_t watch_temp_period = GTV(WATCH_BED_TEMP_PERIOD, WATCH_TEMP_PERIOD);
const uint8_t watch_temp_increase = GTV(WATCH_BED_TEMP_INCREASE, WATCH_TEMP_INCREASE); const uint8_t watch_temp_increase = GTV(WATCH_BED_TEMP_INCREASE, WATCH_TEMP_INCREASE);
@ -528,7 +528,7 @@ volatile bool Temperature::raw_temps_ready = false;
next_temp_ms = ms + 2000UL; next_temp_ms = ms + 2000UL;
// Make sure heating is actually working // Make sure heating is actually working
#if WATCH_BED || WATCH_HOTENDS #if WATCH_PID
if (BOTH(WATCH_BED, WATCH_HOTENDS) || isbed == DISABLED(WATCH_HOTENDS)) { if (BOTH(WATCH_BED, WATCH_HOTENDS) || isbed == DISABLED(WATCH_HOTENDS)) {
if (!heated) { // If not yet reached target... if (!heated) { // If not yet reached target...
if (current_temp > next_watch_temp) { // Over the watch temp? if (current_temp > next_watch_temp) { // Over the watch temp?

View file

@ -10,7 +10,9 @@ use_example_configs Mks/Robin_Pro
opt_set SDCARD_CONNECTION LCD opt_set SDCARD_CONNECTION LCD
opt_set X_DRIVER_TYPE TMC2209 opt_set X_DRIVER_TYPE TMC2209
opt_set Y_DRIVER_TYPE TMC2130 opt_set Y_DRIVER_TYPE TMC2130
exec_test $1 $2 "MKS Robin Pro with TMC Drivers " opt_set TEMP_SENSOR_BED 1
opt_disable THERMAL_PROTECTION_HOTENDS
exec_test $1 $2 "MKS Robin Pro with TMC Drivers, hotend thermal protection disabled"
# cleanup # cleanup
restore_configs #restore_configs

View file

@ -10,8 +10,12 @@ set -e
restore_configs restore_configs
opt_set MOTHERBOARD BOARD_RUMBA32_AUS3D opt_set MOTHERBOARD BOARD_RUMBA32_AUS3D
opt_set SERIAL_PORT -1 opt_set SERIAL_PORT -1
opt_disable PIDTEMP
opt_enable PIDTEMPBED
opt_set TEMP_SENSOR_BED 1
opt_disable THERMAL_PROTECTION_BED
opt_set X_DRIVER_TYPE TMC2130 opt_set X_DRIVER_TYPE TMC2130
exec_test $1 $2 "rumba32_f446ve Default Config with TMC2130" exec_test $1 $2 "rumba32_f446ve with TMC2130, PID Bed, and bed thermal protection disabled"
# cleanup # cleanup
restore_configs restore_configs