Browse Source

🐛 Fix heater timeout PID output (#24682)

FB4S_WIFI^2^2
Giuliano Zaro 2 years ago
committed by Scott Lahteine
parent
commit
85a47d61e6
  1. 7
      Marlin/src/module/temperature.cpp

7
Marlin/src/module/temperature.cpp

@ -1394,6 +1394,8 @@ void Temperature::min_temp_error(const heater_id_t heater_id) {
float Temperature::get_pid_output_hotend(const uint8_t E_NAME) {
const uint8_t ee = HOTEND_INDEX;
const bool is_idling = TERN0(HEATER_IDLE_HANDLER, heater_idle[ee].timed_out);
#if ENABLED(PIDTEMP)
typedef PIDRunner<hotend_info_t, 0, PID_MAX> PIDRunnerHotend;
@ -1403,7 +1405,7 @@ void Temperature::min_temp_error(const heater_id_t heater_id) {
REPEAT(HOTENDS, _HOTENDPID)
};
const float pid_output = hotend_pid[ee].get_pid_output();
const float pid_output = is_idling ? 0 : hotend_pid[ee].get_pid_output();
#if ENABLED(PID_DEBUG)
if (ee == active_extruder)
@ -1466,7 +1468,7 @@ void Temperature::min_temp_error(const heater_id_t heater_id) {
hotend.modeled_ambient_temp += delta_to_apply > 0.f ? _MAX(delta_to_apply, MPC_MIN_AMBIENT_CHANGE * MPC_dT) : _MIN(delta_to_apply, -MPC_MIN_AMBIENT_CHANGE * MPC_dT);
float power = 0.0;
if (hotend.target != 0 && TERN1(HEATER_IDLE_HANDLER, !heater_idle[ee].timed_out)) {
if (hotend.target != 0 && !is_idling) {
// Plan power level to get to target temperature in 2 seconds
power = (hotend.target - hotend.modeled_block_temp) * constants.block_heat_capacity / 2.0f;
power -= (hotend.modeled_ambient_temp - hotend.modeled_block_temp) * ambient_xfer_coeff;
@ -1492,7 +1494,6 @@ void Temperature::min_temp_error(const heater_id_t heater_id) {
#else // No PID or MPC enabled
const bool is_idling = TERN0(HEATER_IDLE_HANDLER, heater_idle[ee].timed_out);
const float pid_output = (!is_idling && temp_hotend[ee].is_below_target()) ? BANG_MAX : 0;
#endif

Loading…
Cancel
Save