Bladeren bron

🐛 Fix heater timeout PID output (#24682)

Giuliano Zaro 2 jaren geleden
bovenliggende
commit
dc0b490bf0
No account linked to committer's email address
1 gewijzigde bestanden met toevoegingen van 4 en 3 verwijderingen
  1. 4
    3
      Marlin/src/module/temperature.cpp

+ 4
- 3
Marlin/src/module/temperature.cpp Bestand weergeven

@@ -1391,6 +1391,8 @@ void Temperature::min_temp_error(const heater_id_t heater_id) {
1391 1391
   float Temperature::get_pid_output_hotend(const uint8_t E_NAME) {
1392 1392
     const uint8_t ee = HOTEND_INDEX;
1393 1393
 
1394
+    const bool is_idling = TERN0(HEATER_IDLE_HANDLER, heater_idle[ee].timed_out);
1395
+
1394 1396
     #if ENABLED(PIDTEMP)
1395 1397
 
1396 1398
       typedef PIDRunner<hotend_info_t, 0, PID_MAX> PIDRunnerHotend;
@@ -1400,7 +1402,7 @@ void Temperature::min_temp_error(const heater_id_t heater_id) {
1400 1402
         REPEAT(HOTENDS, _HOTENDPID)
1401 1403
       };
1402 1404
 
1403
-      const float pid_output = hotend_pid[ee].get_pid_output();
1405
+      const float pid_output = is_idling ? 0 : hotend_pid[ee].get_pid_output();
1404 1406
 
1405 1407
       #if ENABLED(PID_DEBUG)
1406 1408
         if (ee == active_extruder)
@@ -1463,7 +1465,7 @@ void Temperature::min_temp_error(const heater_id_t heater_id) {
1463 1465
         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);
1464 1466
 
1465 1467
       float power = 0.0;
1466
-      if (hotend.target != 0 && TERN1(HEATER_IDLE_HANDLER, !heater_idle[ee].timed_out)) {
1468
+      if (hotend.target != 0 && !is_idling) {
1467 1469
         // Plan power level to get to target temperature in 2 seconds
1468 1470
         power = (hotend.target - hotend.modeled_block_temp) * constants.block_heat_capacity / 2.0f;
1469 1471
         power -= (hotend.modeled_ambient_temp - hotend.modeled_block_temp) * ambient_xfer_coeff;
@@ -1489,7 +1491,6 @@ void Temperature::min_temp_error(const heater_id_t heater_id) {
1489 1491
 
1490 1492
     #else // No PID or MPC enabled
1491 1493
 
1492
-      const bool is_idling = TERN0(HEATER_IDLE_HANDLER, heater_idle[ee].timed_out);
1493 1494
       const float pid_output = (!is_idling && temp_hotend[ee].is_below_target()) ? BANG_MAX : 0;
1494 1495
 
1495 1496
     #endif

Laden…
Annuleren
Opslaan