|
|
@ -215,6 +215,12 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS],
|
|
|
|
|
|
|
|
|
|
|
|
#if HAS_PID_HEATING
|
|
|
|
#if HAS_PID_HEATING
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* PID Autotuning (M303)
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* Alternately heat and cool the nozzle, observing its behavior to
|
|
|
|
|
|
|
|
* determine the best PID values to achieve a stable temperature.
|
|
|
|
|
|
|
|
*/
|
|
|
|
void Temperature::PID_autotune(const float temp, const int8_t hotend, const int8_t ncycles, const bool set_result/*=false*/) {
|
|
|
|
void Temperature::PID_autotune(const float temp, const int8_t hotend, const int8_t ncycles, const bool set_result/*=false*/) {
|
|
|
|
float input = 0.0;
|
|
|
|
float input = 0.0;
|
|
|
|
int cycles = 0;
|
|
|
|
int cycles = 0;
|
|
|
@ -466,7 +472,7 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS],
|
|
|
|
bedKp = workKp; \
|
|
|
|
bedKp = workKp; \
|
|
|
|
bedKi = scalePID_i(workKi); \
|
|
|
|
bedKi = scalePID_i(workKi); \
|
|
|
|
bedKd = scalePID_d(workKd); \
|
|
|
|
bedKd = scalePID_d(workKd); \
|
|
|
|
updatePID(); }while(0)
|
|
|
|
}while(0)
|
|
|
|
|
|
|
|
|
|
|
|
#define _SET_EXTRUDER_PID() do { \
|
|
|
|
#define _SET_EXTRUDER_PID() do { \
|
|
|
|
PID_PARAM(Kp, hotend) = workKp; \
|
|
|
|
PID_PARAM(Kp, hotend) = workKp; \
|
|
|
@ -502,14 +508,6 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS],
|
|
|
|
|
|
|
|
|
|
|
|
Temperature::Temperature() { }
|
|
|
|
Temperature::Temperature() { }
|
|
|
|
|
|
|
|
|
|
|
|
void Temperature::updatePID() {
|
|
|
|
|
|
|
|
#if ENABLED(PIDTEMP)
|
|
|
|
|
|
|
|
#if ENABLED(PID_EXTRUSION_SCALING)
|
|
|
|
|
|
|
|
last_e_position = 0;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int Temperature::getHeaterPower(int heater) {
|
|
|
|
int Temperature::getHeaterPower(int heater) {
|
|
|
|
return heater < 0 ? soft_pwm_amount_bed : soft_pwm_amount[heater];
|
|
|
|
return heater < 0 ? soft_pwm_amount_bed : soft_pwm_amount[heater];
|
|
|
|
}
|
|
|
|
}
|
|
|
|