Browse Source

Fix pid_output declaration

Scott Lahteine 5 years ago
parent
commit
3819f79945
1 changed files with 3 additions and 2 deletions
  1. 3
    2
      Marlin/src/module/temperature.cpp

+ 3
- 2
Marlin/src/module/temperature.cpp View File

@@ -821,7 +821,6 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
821 821
     #endif
822 822
     E_UNUSED();
823 823
     const uint8_t ee = HOTEND_INDEX;
824
-    float pid_output;
825 824
     #if ENABLED(PIDTEMP)
826 825
       #if DISABLED(PID_OPENLOOP)
827 826
         static hotend_pid_t work_pid[HOTENDS];
@@ -830,6 +829,8 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
830 829
         static bool pid_reset[HOTENDS] = { false };
831 830
         const float pid_error = temp_hotend[ee].target - temp_hotend[ee].celsius;
832 831
 
832
+        float pid_output;
833
+
833 834
         if (temp_hotend[ee].target == 0
834 835
           || pid_error < -(PID_FUNCTIONAL_RANGE)
835 836
           #if HEATER_IDLE_HANDLER
@@ -914,7 +915,7 @@ void Temperature::min_temp_error(const heater_ind_t heater) {
914 915
       #else
915 916
         #define _TIMED_OUT_TEST false
916 917
       #endif
917
-      pid_output = (!_TIMED_OUT_TEST && temp_hotend[ee].celsius < temp_hotend[ee].target) ? BANG_MAX : 0;
918
+      const float pid_output = (!_TIMED_OUT_TEST && temp_hotend[ee].celsius < temp_hotend[ee].target) ? BANG_MAX : 0;
918 919
       #undef _TIMED_OUT_TEST
919 920
 
920 921
     #endif

Loading…
Cancel
Save