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
     #endif
821
     #endif
822
     E_UNUSED();
822
     E_UNUSED();
823
     const uint8_t ee = HOTEND_INDEX;
823
     const uint8_t ee = HOTEND_INDEX;
824
-    float pid_output;
825
     #if ENABLED(PIDTEMP)
824
     #if ENABLED(PIDTEMP)
826
       #if DISABLED(PID_OPENLOOP)
825
       #if DISABLED(PID_OPENLOOP)
827
         static hotend_pid_t work_pid[HOTENDS];
826
         static hotend_pid_t work_pid[HOTENDS];
830
         static bool pid_reset[HOTENDS] = { false };
829
         static bool pid_reset[HOTENDS] = { false };
831
         const float pid_error = temp_hotend[ee].target - temp_hotend[ee].celsius;
830
         const float pid_error = temp_hotend[ee].target - temp_hotend[ee].celsius;
832
 
831
 
832
+        float pid_output;
833
+
833
         if (temp_hotend[ee].target == 0
834
         if (temp_hotend[ee].target == 0
834
           || pid_error < -(PID_FUNCTIONAL_RANGE)
835
           || pid_error < -(PID_FUNCTIONAL_RANGE)
835
           #if HEATER_IDLE_HANDLER
836
           #if HEATER_IDLE_HANDLER
914
       #else
915
       #else
915
         #define _TIMED_OUT_TEST false
916
         #define _TIMED_OUT_TEST false
916
       #endif
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
       #undef _TIMED_OUT_TEST
919
       #undef _TIMED_OUT_TEST
919
 
920
 
920
     #endif
921
     #endif

Loading…
Cancel
Save