Browse Source

Named indices for Temperature class (#14479)

Scott Lahteine 6 years ago
parent
commit
720bc7c00b
No account linked to committer's email address
3 changed files with 132 additions and 131 deletions
  1. 12
    13
      Marlin/src/gcode/temperature/M303.cpp
  2. 91
    97
      Marlin/src/module/temperature.cpp
  3. 29
    21
      Marlin/src/module/temperature.h

+ 12
- 13
Marlin/src/gcode/temperature/M303.cpp View File

36
  *       U<bool> with a non-zero value will apply the result to current settings
36
  *       U<bool> with a non-zero value will apply the result to current settings
37
  */
37
  */
38
 void GcodeSuite::M303() {
38
 void GcodeSuite::M303() {
39
-
40
-  const int8_t e = parser.intval('E');
41
-
42
-  if (!WITHIN(e, 0
43
-    #if ENABLED(PIDTEMPBED)
44
-      -1
45
-    #endif
46
-    ,
47
-    #if ENABLED(PIDTEMP)
48
-      HOTENDS
49
-    #endif
50
-    -1
51
-  )) {
39
+  #if ENABLED(PIDTEMPBED)
40
+    #define SI H_BED
41
+  #else
42
+    #define SI H_E0
43
+  #endif
44
+  #if ENABLED(PIDTEMP)
45
+    #define EI HOTENDS - 1
46
+  #else
47
+    #define EI H_BED
48
+  #endif
49
+  const heater_ind_t e = (heater_ind_t)parser.intval('E');
50
+  if (!WITHIN(e, SI, EI)) {
52
     SERIAL_ECHOLNPGM(MSG_PID_BAD_EXTRUDER_NUM);
51
     SERIAL_ECHOLNPGM(MSG_PID_BAD_EXTRUDER_NUM);
53
     return;
52
     return;
54
   }
53
   }

+ 91
- 97
Marlin/src/module/temperature.cpp View File

94
  */
94
  */
95
 
95
 
96
 #if HAS_HEATED_BED
96
 #if HAS_HEATED_BED
97
-  #define _BED_PSTR(M,E) (E) == -1 ? PSTR(M) :
97
+  #define _BED_PSTR(M,E) (E) == H_BED ? PSTR(M) :
98
 #else
98
 #else
99
   #define _BED_PSTR(M,E)
99
   #define _BED_PSTR(M,E)
100
 #endif
100
 #endif
101
 #if HAS_HEATED_CHAMBER
101
 #if HAS_HEATED_CHAMBER
102
-  #define _CHAMBER_PSTR(M,E) (E) == -2 ? PSTR(M) :
102
+  #define _CHAMBER_PSTR(M,E) (E) == H_CHAMBER ? PSTR(M) :
103
 #else
103
 #else
104
   #define _CHAMBER_PSTR(M,E)
104
   #define _CHAMBER_PSTR(M,E)
105
 #endif
105
 #endif
345
    * Needs sufficient heater power to make some overshoot at target
345
    * Needs sufficient heater power to make some overshoot at target
346
    * temperature to succeed.
346
    * temperature to succeed.
347
    */
347
    */
348
-  void Temperature::PID_autotune(const float &target, const int8_t heater, const int8_t ncycles, const bool set_result/*=false*/) {
348
+  void Temperature::PID_autotune(const float &target, const heater_ind_t heater, const int8_t ncycles, const bool set_result/*=false*/) {
349
     float current = 0.0;
349
     float current = 0.0;
350
     int cycles = 0;
350
     int cycles = 0;
351
     bool heating = true;
351
     bool heating = true;
357
     PID_t tune_pid = { 0, 0, 0 };
357
     PID_t tune_pid = { 0, 0, 0 };
358
     float max = 0, min = 10000;
358
     float max = 0, min = 10000;
359
 
359
 
360
-    const bool isbed = (heater < 0);
360
+    const bool isbed = (heater == H_BED);
361
 
361
 
362
     #if HAS_PID_FOR_BOTH
362
     #if HAS_PID_FOR_BOTH
363
       #define GHV(B,H) (isbed ? (B) : (H))
363
       #define GHV(B,H) (isbed ? (B) : (H))
618
 
618
 
619
 Temperature::Temperature() { }
619
 Temperature::Temperature() { }
620
 
620
 
621
-int16_t Temperature::getHeaterPower(const int8_t heater) {
622
-  return (
623
-    #if HAS_HEATED_CHAMBER
624
-      #if HAS_HEATED_BED
625
-        heater == -2
626
-      #else
627
-        heater < 0
628
-      #endif
629
-      ? temp_chamber.soft_pwm_amount :
630
-    #endif
621
+int16_t Temperature::getHeaterPower(const heater_ind_t heater_id) {
622
+  switch (heater_id) {
623
+    default: return temp_hotend[heater_id].soft_pwm_amount;
631
     #if HAS_HEATED_BED
624
     #if HAS_HEATED_BED
632
-      #if HAS_HEATED_CHAMBER
633
-        heater == -1
634
-      #else
635
-        heater < 0
636
-      #endif
637
-      ? temp_bed.soft_pwm_amount :
625
+      case H_BED: return temp_bed.soft_pwm_amount;
626
+    #endif
627
+    #if HAS_HEATED_CHAMBER
628
+      case H_CHAMBER: return temp_chamber.soft_pwm_amount;
638
     #endif
629
     #endif
639
-    temp_hotend[heater].soft_pwm_amount
640
-  );
630
+  }
641
 }
631
 }
642
 
632
 
643
 #if HAS_AUTO_FAN
633
 #if HAS_AUTO_FAN
756
 //
746
 //
757
 // Temperature Error Handlers
747
 // Temperature Error Handlers
758
 //
748
 //
759
-void Temperature::_temp_error(const int8_t heater, PGM_P const serial_msg, PGM_P const lcd_msg) {
749
+void Temperature::_temp_error(const heater_ind_t heater, PGM_P const serial_msg, PGM_P const lcd_msg) {
760
   static bool killed = false;
750
   static bool killed = false;
761
   if (IsRunning()) {
751
   if (IsRunning()) {
762
     SERIAL_ERROR_START();
752
     SERIAL_ERROR_START();
764
     SERIAL_ECHOPGM(MSG_STOPPED_HEATER);
754
     SERIAL_ECHOPGM(MSG_STOPPED_HEATER);
765
     if (heater >= 0) SERIAL_ECHO((int)heater);
755
     if (heater >= 0) SERIAL_ECHO((int)heater);
766
     #if HAS_HEATED_CHAMBER
756
     #if HAS_HEATED_CHAMBER
767
-      else if (heater == -2) SERIAL_ECHOPGM(MSG_HEATER_CHAMBER);
757
+      else if (heater == H_CHAMBER) SERIAL_ECHOPGM(MSG_HEATER_CHAMBER);
768
     #endif
758
     #endif
769
     else SERIAL_ECHOPGM(MSG_HEATER_BED);
759
     else SERIAL_ECHOPGM(MSG_HEATER_BED);
770
     SERIAL_EOL();
760
     SERIAL_EOL();
794
   #endif
784
   #endif
795
 }
785
 }
796
 
786
 
797
-void Temperature::max_temp_error(const int8_t heater) {
787
+void Temperature::max_temp_error(const heater_ind_t heater) {
798
   _temp_error(heater, PSTR(MSG_T_MAXTEMP), TEMP_ERR_PSTR(MSG_ERR_MAXTEMP, heater));
788
   _temp_error(heater, PSTR(MSG_T_MAXTEMP), TEMP_ERR_PSTR(MSG_ERR_MAXTEMP, heater));
799
 }
789
 }
800
 
790
 
801
-void Temperature::min_temp_error(const int8_t heater) {
791
+void Temperature::min_temp_error(const heater_ind_t heater) {
802
   _temp_error(heater, PSTR(MSG_T_MINTEMP), TEMP_ERR_PSTR(MSG_ERR_MINTEMP, heater));
792
   _temp_error(heater, PSTR(MSG_T_MINTEMP), TEMP_ERR_PSTR(MSG_ERR_MINTEMP, heater));
803
 }
793
 }
804
 
794
 
805
-float Temperature::get_pid_output(const int8_t e) {
795
+float Temperature::get_pid_output_hotend(const uint8_t e) {
806
   #if HOTENDS == 1
796
   #if HOTENDS == 1
807
     #define _HOTEND_TEST true
797
     #define _HOTEND_TEST true
808
   #else
798
   #else
809
     #define _HOTEND_TEST (e == active_extruder)
799
     #define _HOTEND_TEST (e == active_extruder)
810
   #endif
800
   #endif
811
   E_UNUSED();
801
   E_UNUSED();
802
+  const uint8_t ee = HOTEND_INDEX;
812
   float pid_output;
803
   float pid_output;
813
   #if ENABLED(PIDTEMP)
804
   #if ENABLED(PIDTEMP)
814
     #if DISABLED(PID_OPENLOOP)
805
     #if DISABLED(PID_OPENLOOP)
816
       static float temp_iState[HOTENDS] = { 0 },
807
       static float temp_iState[HOTENDS] = { 0 },
817
                    temp_dState[HOTENDS] = { 0 };
808
                    temp_dState[HOTENDS] = { 0 };
818
       static bool pid_reset[HOTENDS] = { false };
809
       static bool pid_reset[HOTENDS] = { false };
819
-      const float pid_error = temp_hotend[HOTEND_INDEX].target - temp_hotend[HOTEND_INDEX].current;
810
+      const float pid_error = temp_hotend[ee].target - temp_hotend[ee].current;
820
 
811
 
821
-      if (temp_hotend[HOTEND_INDEX].target == 0
812
+      if (temp_hotend[ee].target == 0
822
         || pid_error < -(PID_FUNCTIONAL_RANGE)
813
         || pid_error < -(PID_FUNCTIONAL_RANGE)
823
         #if HEATER_IDLE_HANDLER
814
         #if HEATER_IDLE_HANDLER
824
-          || hotend_idle[HOTEND_INDEX].timed_out
815
+          || hotend_idle[ee].timed_out
825
         #endif
816
         #endif
826
       ) {
817
       ) {
827
         pid_output = 0;
818
         pid_output = 0;
828
-        pid_reset[HOTEND_INDEX] = true;
819
+        pid_reset[ee] = true;
829
       }
820
       }
830
       else if (pid_error > PID_FUNCTIONAL_RANGE) {
821
       else if (pid_error > PID_FUNCTIONAL_RANGE) {
831
         pid_output = BANG_MAX;
822
         pid_output = BANG_MAX;
832
-        pid_reset[HOTEND_INDEX] = true;
823
+        pid_reset[ee] = true;
833
       }
824
       }
834
       else {
825
       else {
835
-        if (pid_reset[HOTEND_INDEX]) {
836
-          temp_iState[HOTEND_INDEX] = 0.0;
837
-          work_pid[HOTEND_INDEX].Kd = 0.0;
838
-          pid_reset[HOTEND_INDEX] = false;
826
+        if (pid_reset[ee]) {
827
+          temp_iState[ee] = 0.0;
828
+          work_pid[ee].Kd = 0.0;
829
+          pid_reset[ee] = false;
839
         }
830
         }
840
 
831
 
841
-        work_pid[HOTEND_INDEX].Kd = work_pid[HOTEND_INDEX].Kd + PID_K2 * (PID_PARAM(Kd, HOTEND_INDEX) * (temp_dState[HOTEND_INDEX] - temp_hotend[HOTEND_INDEX].current) - work_pid[HOTEND_INDEX].Kd);
842
-        const float max_power_over_i_gain = (float)PID_MAX / PID_PARAM(Ki, HOTEND_INDEX);
843
-        temp_iState[HOTEND_INDEX] = constrain(temp_iState[HOTEND_INDEX] + pid_error, 0, max_power_over_i_gain);
844
-        work_pid[HOTEND_INDEX].Kp = PID_PARAM(Kp, HOTEND_INDEX) * pid_error;
845
-        work_pid[HOTEND_INDEX].Ki = PID_PARAM(Ki, HOTEND_INDEX) * temp_iState[HOTEND_INDEX];
832
+        work_pid[ee].Kd = work_pid[ee].Kd + PID_K2 * (PID_PARAM(Kd, ee) * (temp_dState[ee] - temp_hotend[ee].current) - work_pid[ee].Kd);
833
+        const float max_power_over_i_gain = (float)PID_MAX / PID_PARAM(Ki, ee);
834
+        temp_iState[ee] = constrain(temp_iState[ee] + pid_error, 0, max_power_over_i_gain);
835
+        work_pid[ee].Kp = PID_PARAM(Kp, ee) * pid_error;
836
+        work_pid[ee].Ki = PID_PARAM(Ki, ee) * temp_iState[ee];
846
 
837
 
847
-        pid_output = work_pid[HOTEND_INDEX].Kp + work_pid[HOTEND_INDEX].Ki + work_pid[HOTEND_INDEX].Kd;
838
+        pid_output = work_pid[ee].Kp + work_pid[ee].Ki + work_pid[ee].Kd;
848
 
839
 
849
         #if ENABLED(PID_EXTRUSION_SCALING)
840
         #if ENABLED(PID_EXTRUSION_SCALING)
850
-          work_pid[HOTEND_INDEX].Kc = 0;
841
+          work_pid[ee].Kc = 0;
851
           if (_HOTEND_TEST) {
842
           if (_HOTEND_TEST) {
852
             const long e_position = stepper.position(E_AXIS);
843
             const long e_position = stepper.position(E_AXIS);
853
             if (e_position > last_e_position) {
844
             if (e_position > last_e_position) {
858
               lpq[lpq_ptr] = 0;
849
               lpq[lpq_ptr] = 0;
859
 
850
 
860
             if (++lpq_ptr >= lpq_len) lpq_ptr = 0;
851
             if (++lpq_ptr >= lpq_len) lpq_ptr = 0;
861
-            work_pid[HOTEND_INDEX].Kc = (lpq[lpq_ptr] * planner.steps_to_mm[E_AXIS]) * PID_PARAM(Kc, HOTEND_INDEX);
862
-            pid_output += work_pid[HOTEND_INDEX].Kc;
852
+            work_pid[ee].Kc = (lpq[lpq_ptr] * planner.steps_to_mm[E_AXIS]) * PID_PARAM(Kc, ee);
853
+            pid_output += work_pid[ee].Kc;
863
           }
854
           }
864
         #endif // PID_EXTRUSION_SCALING
855
         #endif // PID_EXTRUSION_SCALING
865
 
856
 
866
         pid_output = constrain(pid_output, 0, PID_MAX);
857
         pid_output = constrain(pid_output, 0, PID_MAX);
867
       }
858
       }
868
-      temp_dState[HOTEND_INDEX] = temp_hotend[HOTEND_INDEX].current;
859
+      temp_dState[ee] = temp_hotend[ee].current;
869
 
860
 
870
     #else // PID_OPENLOOP
861
     #else // PID_OPENLOOP
871
 
862
 
872
-      const float pid_output = constrain(temp_hotend[HOTEND_INDEX].target, 0, PID_MAX);
863
+      const float pid_output = constrain(temp_hotend[ee].target, 0, PID_MAX);
873
 
864
 
874
     #endif // PID_OPENLOOP
865
     #endif // PID_OPENLOOP
875
 
866
 
876
     #if ENABLED(PID_DEBUG)
867
     #if ENABLED(PID_DEBUG)
877
       SERIAL_ECHO_START();
868
       SERIAL_ECHO_START();
878
       SERIAL_ECHOPAIR(
869
       SERIAL_ECHOPAIR(
879
-        MSG_PID_DEBUG, HOTEND_INDEX,
880
-        MSG_PID_DEBUG_INPUT, temp_hotend[HOTEND_INDEX].current,
870
+        MSG_PID_DEBUG, ee,
871
+        MSG_PID_DEBUG_INPUT, temp_hotend[ee].current,
881
         MSG_PID_DEBUG_OUTPUT, pid_output
872
         MSG_PID_DEBUG_OUTPUT, pid_output
882
       );
873
       );
883
       #if DISABLED(PID_OPENLOOP)
874
       #if DISABLED(PID_OPENLOOP)
884
         SERIAL_ECHOPAIR(
875
         SERIAL_ECHOPAIR(
885
-          MSG_PID_DEBUG_PTERM, work_pid[HOTEND_INDEX].Kp,
886
-          MSG_PID_DEBUG_ITERM, work_pid[HOTEND_INDEX].Ki,
887
-          MSG_PID_DEBUG_DTERM, work_pid[HOTEND_INDEX].Kd
876
+          MSG_PID_DEBUG_PTERM, work_pid[ee].Kp,
877
+          MSG_PID_DEBUG_ITERM, work_pid[ee].Ki,
878
+          MSG_PID_DEBUG_DTERM, work_pid[ee].Kd
888
           #if ENABLED(PID_EXTRUSION_SCALING)
879
           #if ENABLED(PID_EXTRUSION_SCALING)
889
-            , MSG_PID_DEBUG_CTERM, work_pid[HOTEND_INDEX].Kc
880
+            , MSG_PID_DEBUG_CTERM, work_pid[ee].Kc
890
           #endif
881
           #endif
891
         );
882
         );
892
       #endif
883
       #endif
893
       SERIAL_EOL();
884
       SERIAL_EOL();
894
     #endif // PID_DEBUG
885
     #endif // PID_DEBUG
895
 
886
 
896
-  #else /* PID off */
887
+  #else // No PID enabled
888
+
897
     #if HEATER_IDLE_HANDLER
889
     #if HEATER_IDLE_HANDLER
898
-      #define _TIMED_OUT_TEST hotend_idle[HOTEND_INDEX].timed_out
890
+      #define _TIMED_OUT_TEST hotend_idle[ee].timed_out
899
     #else
891
     #else
900
       #define _TIMED_OUT_TEST false
892
       #define _TIMED_OUT_TEST false
901
     #endif
893
     #endif
902
-    pid_output = (!_TIMED_OUT_TEST && temp_hotend[HOTEND_INDEX].current < temp_hotend[HOTEND_INDEX].target) ? BANG_MAX : 0;
894
+    pid_output = (!_TIMED_OUT_TEST && temp_hotend[ee].current < temp_hotend[ee].target) ? BANG_MAX : 0;
903
     #undef _TIMED_OUT_TEST
895
     #undef _TIMED_OUT_TEST
896
+
904
   #endif
897
   #endif
905
 
898
 
906
   return pid_output;
899
   return pid_output;
983
   updateTemperaturesFromRawValues(); // also resets the watchdog
976
   updateTemperaturesFromRawValues(); // also resets the watchdog
984
 
977
 
985
   #if ENABLED(HEATER_0_USES_MAX6675)
978
   #if ENABLED(HEATER_0_USES_MAX6675)
986
-    if (temp_hotend[0].current > MIN(HEATER_0_MAXTEMP, HEATER_0_MAX6675_TMAX - 1.0)) max_temp_error(0);
987
-    if (temp_hotend[0].current < MAX(HEATER_0_MINTEMP, HEATER_0_MAX6675_TMIN + .01)) min_temp_error(0);
979
+    if (temp_hotend[0].current > MIN(HEATER_0_MAXTEMP, HEATER_0_MAX6675_TMAX - 1.0)) max_temp_error(H_E0);
980
+    if (temp_hotend[0].current < MAX(HEATER_0_MINTEMP, HEATER_0_MAX6675_TMIN + .01)) min_temp_error(H_E0);
988
   #endif
981
   #endif
989
 
982
 
990
   #if ENABLED(HEATER_1_USES_MAX6675)
983
   #if ENABLED(HEATER_1_USES_MAX6675)
991
-    if (temp_hotend[1].current > MIN(HEATER_1_MAXTEMP, HEATER_1_MAX6675_TMAX - 1.0)) max_temp_error(1);
992
-    if (temp_hotend[1].current < MAX(HEATER_1_MINTEMP, HEATER_1_MAX6675_TMIN + .01)) min_temp_error(1);
984
+    if (temp_hotend[1].current > MIN(HEATER_1_MAXTEMP, HEATER_1_MAX6675_TMAX - 1.0)) max_temp_error(H_E1);
985
+    if (temp_hotend[1].current < MAX(HEATER_1_MINTEMP, HEATER_1_MAX6675_TMIN + .01)) min_temp_error(H_E1);
993
   #endif
986
   #endif
994
 
987
 
995
   #define HAS_THERMAL_PROTECTION (ENABLED(THERMAL_PROTECTION_HOTENDS) || HAS_THERMALLY_PROTECTED_BED || ENABLED(THERMAL_PROTECTION_CHAMBER))
988
   #define HAS_THERMAL_PROTECTION (ENABLED(THERMAL_PROTECTION_HOTENDS) || HAS_THERMALLY_PROTECTED_BED || ENABLED(THERMAL_PROTECTION_CHAMBER))
1010
   HOTEND_LOOP() {
1003
   HOTEND_LOOP() {
1011
     #if ENABLED(THERMAL_PROTECTION_HOTENDS)
1004
     #if ENABLED(THERMAL_PROTECTION_HOTENDS)
1012
       if (!grace_period && degHotend(e) > temp_range[e].maxtemp)
1005
       if (!grace_period && degHotend(e) > temp_range[e].maxtemp)
1013
-        _temp_error(e, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, e));
1006
+        _temp_error((heater_ind_t)e, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, e));
1014
     #endif
1007
     #endif
1015
 
1008
 
1016
     #if HEATER_IDLE_HANDLER
1009
     #if HEATER_IDLE_HANDLER
1019
 
1012
 
1020
     #if ENABLED(THERMAL_PROTECTION_HOTENDS)
1013
     #if ENABLED(THERMAL_PROTECTION_HOTENDS)
1021
       // Check for thermal runaway
1014
       // Check for thermal runaway
1022
-      thermal_runaway_protection(tr_state_machine[e], temp_hotend[e].current, temp_hotend[e].target, e, THERMAL_PROTECTION_PERIOD, THERMAL_PROTECTION_HYSTERESIS);
1015
+      thermal_runaway_protection(tr_state_machine[e], temp_hotend[e].current, temp_hotend[e].target, (heater_ind_t)e, THERMAL_PROTECTION_PERIOD, THERMAL_PROTECTION_HYSTERESIS);
1023
     #endif
1016
     #endif
1024
 
1017
 
1025
-    temp_hotend[e].soft_pwm_amount = (temp_hotend[e].current > temp_range[e].mintemp || is_preheating(e)) && temp_hotend[e].current < temp_range[e].maxtemp ? (int)get_pid_output(e) >> 1 : 0;
1018
+    temp_hotend[e].soft_pwm_amount = (temp_hotend[e].current > temp_range[e].mintemp || is_preheating(e)) && temp_hotend[e].current < temp_range[e].maxtemp ? (int)get_pid_output_hotend(e) >> 1 : 0;
1026
 
1019
 
1027
     #if WATCH_HOTENDS
1020
     #if WATCH_HOTENDS
1028
       // Make sure temperature is increasing
1021
       // Make sure temperature is increasing
1029
       if (watch_hotend[e].next_ms && ELAPSED(ms, watch_hotend[e].next_ms)) { // Time to check this extruder?
1022
       if (watch_hotend[e].next_ms && ELAPSED(ms, watch_hotend[e].next_ms)) { // Time to check this extruder?
1030
         if (degHotend(e) < watch_hotend[e].target)                             // Failed to increase enough?
1023
         if (degHotend(e) < watch_hotend[e].target)                             // Failed to increase enough?
1031
-          _temp_error(e, PSTR(MSG_T_HEATING_FAILED), TEMP_ERR_PSTR(MSG_HEATING_FAILED_LCD, e));
1024
+          _temp_error((heater_ind_t)e, PSTR(MSG_T_HEATING_FAILED), TEMP_ERR_PSTR(MSG_HEATING_FAILED_LCD, e));
1032
         else                                                                 // Start again if the target is still far off
1025
         else                                                                 // Start again if the target is still far off
1033
-          start_watching_heater(e);
1026
+          start_watching_hotend(e);
1034
       }
1027
       }
1035
     #endif
1028
     #endif
1036
 
1029
 
1037
     #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
1030
     #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
1038
       // Make sure measured temperatures are close together
1031
       // Make sure measured temperatures are close together
1039
       if (ABS(temp_hotend[0].current - redundant_temperature) > MAX_REDUNDANT_TEMP_SENSOR_DIFF)
1032
       if (ABS(temp_hotend[0].current - redundant_temperature) > MAX_REDUNDANT_TEMP_SENSOR_DIFF)
1040
-        _temp_error(0, PSTR(MSG_REDUNDANCY), PSTR(MSG_ERR_REDUNDANT_TEMP));
1033
+        _temp_error(H_E0, PSTR(MSG_REDUNDANCY), PSTR(MSG_ERR_REDUNDANT_TEMP));
1041
     #endif
1034
     #endif
1042
 
1035
 
1043
   } // HOTEND_LOOP
1036
   } // HOTEND_LOOP
1066
 
1059
 
1067
     #if ENABLED(THERMAL_PROTECTION_BED)
1060
     #if ENABLED(THERMAL_PROTECTION_BED)
1068
       if (!grace_period && degBed() > BED_MAXTEMP)
1061
       if (!grace_period && degBed() > BED_MAXTEMP)
1069
-        _temp_error(-1, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, -1));
1062
+        _temp_error(H_BED, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, H_BED));
1070
     #endif
1063
     #endif
1071
 
1064
 
1072
     #if WATCH_BED
1065
     #if WATCH_BED
1073
       // Make sure temperature is increasing
1066
       // Make sure temperature is increasing
1074
       if (watch_bed.elapsed(ms)) {        // Time to check the bed?
1067
       if (watch_bed.elapsed(ms)) {        // Time to check the bed?
1075
         if (degBed() < watch_bed.target)                                // Failed to increase enough?
1068
         if (degBed() < watch_bed.target)                                // Failed to increase enough?
1076
-          _temp_error(-1, PSTR(MSG_T_HEATING_FAILED), TEMP_ERR_PSTR(MSG_HEATING_FAILED_LCD, -1));
1069
+          _temp_error(H_BED, PSTR(MSG_T_HEATING_FAILED), TEMP_ERR_PSTR(MSG_HEATING_FAILED_LCD, H_BED));
1077
         else                                                            // Start again if the target is still far off
1070
         else                                                            // Start again if the target is still far off
1078
           start_watching_bed();
1071
           start_watching_bed();
1079
       }
1072
       }
1098
       #endif
1091
       #endif
1099
 
1092
 
1100
       #if HAS_THERMALLY_PROTECTED_BED
1093
       #if HAS_THERMALLY_PROTECTED_BED
1101
-        thermal_runaway_protection(tr_state_machine_bed, temp_bed.current, temp_bed.target, -1, THERMAL_PROTECTION_BED_PERIOD, THERMAL_PROTECTION_BED_HYSTERESIS);
1094
+        thermal_runaway_protection(tr_state_machine_bed, temp_bed.current, temp_bed.target, H_BED, THERMAL_PROTECTION_BED_PERIOD, THERMAL_PROTECTION_BED_HYSTERESIS);
1102
       #endif
1095
       #endif
1103
 
1096
 
1104
       #if HEATER_IDLE_HANDLER
1097
       #if HEATER_IDLE_HANDLER
1144
 
1137
 
1145
     #if ENABLED(THERMAL_PROTECTION_CHAMBER)
1138
     #if ENABLED(THERMAL_PROTECTION_CHAMBER)
1146
       if (!grace_period && degChamber() > CHAMBER_MAXTEMP)
1139
       if (!grace_period && degChamber() > CHAMBER_MAXTEMP)
1147
-        _temp_error(-2, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, -2));
1140
+        _temp_error(H_CHAMBER, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, H_CHAMBER));
1148
     #endif
1141
     #endif
1149
 
1142
 
1150
     #if WATCH_CHAMBER
1143
     #if WATCH_CHAMBER
1151
       // Make sure temperature is increasing
1144
       // Make sure temperature is increasing
1152
       if (watch_chamber.elapsed(ms)) {              // Time to check the chamber?
1145
       if (watch_chamber.elapsed(ms)) {              // Time to check the chamber?
1153
         if (degChamber() < watch_chamber.target)    // Failed to increase enough?
1146
         if (degChamber() < watch_chamber.target)    // Failed to increase enough?
1154
-          _temp_error(-2, PSTR(MSG_T_HEATING_FAILED), TEMP_ERR_PSTR(MSG_HEATING_FAILED_LCD, -2));
1147
+          _temp_error(H_CHAMBER, PSTR(MSG_T_HEATING_FAILED), TEMP_ERR_PSTR(MSG_HEATING_FAILED_LCD, H_CHAMBER));
1155
         else
1148
         else
1156
           start_watching_chamber();                 // Start again if the target is still far off
1149
           start_watching_chamber();                 // Start again if the target is still far off
1157
       }
1150
       }
1176
       }
1169
       }
1177
 
1170
 
1178
       #if ENABLED(THERMAL_PROTECTION_CHAMBER)
1171
       #if ENABLED(THERMAL_PROTECTION_CHAMBER)
1179
-        thermal_runaway_protection(tr_state_machine_chamber, temp_chamber.current, temp_chamber.target, -2, THERMAL_PROTECTION_CHAMBER_PERIOD, THERMAL_PROTECTION_CHAMBER_HYSTERESIS);
1172
+        thermal_runaway_protection(tr_state_machine_chamber, temp_chamber.current, temp_chamber.target, H_CHAMBER, THERMAL_PROTECTION_CHAMBER_PERIOD, THERMAL_PROTECTION_CHAMBER_HYSTERESIS);
1180
       #endif
1173
       #endif
1181
     }
1174
     }
1182
 
1175
 
1782
    * their target temperature by a configurable margin.
1775
    * their target temperature by a configurable margin.
1783
    * This is called when the temperature is set. (M104, M109)
1776
    * This is called when the temperature is set. (M104, M109)
1784
    */
1777
    */
1785
-  void Temperature::start_watching_heater(const uint8_t e) {
1778
+  void Temperature::start_watching_hotend(const uint8_t e) {
1786
     E_UNUSED();
1779
     E_UNUSED();
1787
-    if (degTargetHotend(HOTEND_INDEX) && degHotend(HOTEND_INDEX) < degTargetHotend(HOTEND_INDEX) - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1)) {
1788
-      watch_hotend[HOTEND_INDEX].target = degHotend(HOTEND_INDEX) + WATCH_TEMP_INCREASE;
1789
-      watch_hotend[HOTEND_INDEX].next_ms = millis() + (WATCH_TEMP_PERIOD) * 1000UL;
1780
+    const uint8_t ee = HOTEND_INDEX;
1781
+    if (degTargetHotend(ee) && degHotend(ee) < degTargetHotend(ee) - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1)) {
1782
+      watch_hotend[ee].target = degHotend(ee) + WATCH_TEMP_INCREASE;
1783
+      watch_hotend[ee].next_ms = millis() + (WATCH_TEMP_PERIOD) * 1000UL;
1790
     }
1784
     }
1791
     else
1785
     else
1792
-      watch_hotend[HOTEND_INDEX].next_ms = 0;
1786
+      watch_hotend[ee].next_ms = 0;
1793
   }
1787
   }
1794
 #endif
1788
 #endif
1795
 
1789
 
1837
     Temperature::tr_state_machine_t Temperature::tr_state_machine_chamber; // = { TRInactive, 0 };
1831
     Temperature::tr_state_machine_t Temperature::tr_state_machine_chamber; // = { TRInactive, 0 };
1838
   #endif
1832
   #endif
1839
 
1833
 
1840
-  void Temperature::thermal_runaway_protection(Temperature::tr_state_machine_t &sm, const float &current, const float &target, const int8_t heater_id, const uint16_t period_seconds, const uint16_t hysteresis_degc) {
1834
+  void Temperature::thermal_runaway_protection(Temperature::tr_state_machine_t &sm, const float &current, const float &target, const heater_ind_t heater_id, const uint16_t period_seconds, const uint16_t hysteresis_degc) {
1841
 
1835
 
1842
     static float tr_target_temperature[HOTENDS + 1] = { 0.0 };
1836
     static float tr_target_temperature[HOTENDS + 1] = { 0.0 };
1843
 
1837
 
1844
     /**
1838
     /**
1845
       SERIAL_ECHO_START();
1839
       SERIAL_ECHO_START();
1846
       SERIAL_ECHOPGM("Thermal Thermal Runaway Running. Heater ID: ");
1840
       SERIAL_ECHOPGM("Thermal Thermal Runaway Running. Heater ID: ");
1847
-      if (heater_id == -2) SERIAL_ECHOPGM("chamber");
1841
+      if (heater_id == H_CHAMBER) SERIAL_ECHOPGM("chamber");
1848
       if (heater_id < 0) SERIAL_ECHOPGM("bed"); else SERIAL_ECHO(heater_id);
1842
       if (heater_id < 0) SERIAL_ECHOPGM("bed"); else SERIAL_ECHO(heater_id);
1849
       SERIAL_ECHOPAIR(" ;  State:", sm.state, " ;  Timer:", sm.timer, " ;  Temperature:", current, " ;  Target Temp:", target);
1843
       SERIAL_ECHOPAIR(" ;  State:", sm.state, " ;  Timer:", sm.timer, " ;  Temperature:", current, " ;  Target Temp:", target);
1850
       if (heater_id >= 0)
1844
       if (heater_id >= 0)
2233
           || temp_hotend[e].soft_pwm_amount > 0
2227
           || temp_hotend[e].soft_pwm_amount > 0
2234
         #endif
2228
         #endif
2235
       );
2229
       );
2236
-      if (rawtemp > temp_range[e].raw_max * tdir) max_temp_error(e);
2230
+      if (rawtemp > temp_range[e].raw_max * tdir) max_temp_error((heater_ind_t)e);
2237
       if (heater_on && rawtemp < temp_range[e].raw_min * tdir && !is_preheating(e)) {
2231
       if (heater_on && rawtemp < temp_range[e].raw_min * tdir && !is_preheating(e)) {
2238
         #ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED
2232
         #ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED
2239
           if (++consecutive_low_temperature_error[e] >= MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED)
2233
           if (++consecutive_low_temperature_error[e] >= MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED)
2240
         #endif
2234
         #endif
2241
-          min_temp_error(e);
2235
+          min_temp_error((heater_ind_t)e);
2242
       }
2236
       }
2243
       #ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED
2237
       #ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED
2244
         else
2238
         else
2258
         || (temp_bed.soft_pwm_amount > 0)
2252
         || (temp_bed.soft_pwm_amount > 0)
2259
       #endif
2253
       #endif
2260
     ;
2254
     ;
2261
-    if (BEDCMP(temp_bed.raw, maxtemp_raw_BED)) max_temp_error(-1);
2262
-    if (bed_on && BEDCMP(mintemp_raw_BED, temp_bed.raw)) min_temp_error(-1);
2255
+    if (BEDCMP(temp_bed.raw, maxtemp_raw_BED)) max_temp_error(H_BED);
2256
+    if (bed_on && BEDCMP(mintemp_raw_BED, temp_bed.raw)) min_temp_error(H_BED);
2263
   #endif
2257
   #endif
2264
 
2258
 
2265
   #if HAS_HEATED_CHAMBER
2259
   #if HAS_HEATED_CHAMBER
2269
       #define CHAMBERCMP(A,B) ((A)>=(B))
2263
       #define CHAMBERCMP(A,B) ((A)>=(B))
2270
     #endif
2264
     #endif
2271
     const bool chamber_on = (temp_chamber.target > 0);
2265
     const bool chamber_on = (temp_chamber.target > 0);
2272
-    if (CHAMBERCMP(temp_chamber.raw, maxtemp_raw_CHAMBER)) max_temp_error(-2);
2273
-    if (chamber_on && CHAMBERCMP(mintemp_raw_CHAMBER, temp_chamber.raw)) min_temp_error(-2);
2266
+    if (CHAMBERCMP(temp_chamber.raw, maxtemp_raw_CHAMBER)) max_temp_error(H_CHAMBER);
2267
+    if (chamber_on && CHAMBERCMP(mintemp_raw_CHAMBER, temp_chamber.raw)) min_temp_error(H_CHAMBER);
2274
   #endif
2268
   #endif
2275
 }
2269
 }
2276
 
2270
 
2782
     #if ENABLED(SHOW_TEMP_ADC_VALUES)
2776
     #if ENABLED(SHOW_TEMP_ADC_VALUES)
2783
       , const float r
2777
       , const float r
2784
     #endif
2778
     #endif
2785
-    , const int8_t e=-3
2779
+    , const heater_ind_t e=INDEX_NONE
2786
   ) {
2780
   ) {
2787
     char k;
2781
     char k;
2788
     switch (e) {
2782
     switch (e) {
2789
       #if HAS_TEMP_CHAMBER
2783
       #if HAS_TEMP_CHAMBER
2790
-        case -2: k = 'C'; break;
2784
+        case H_CHAMBER: k = 'C'; break;
2791
       #endif
2785
       #endif
2792
       #if HAS_TEMP_HOTEND
2786
       #if HAS_TEMP_HOTEND
2793
         default: k = 'T'; break;
2787
         default: k = 'T'; break;
2794
         #if HAS_HEATED_BED
2788
         #if HAS_HEATED_BED
2795
-          case -1: k = 'B'; break;
2789
+          case H_BED: k = 'B'; break;
2796
         #endif
2790
         #endif
2797
         #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
2791
         #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
2798
-          case -3: k = 'R'; break;
2792
+          case H_REDUNDANT: k = 'R'; break;
2799
         #endif
2793
         #endif
2800
       #elif HAS_HEATED_BED
2794
       #elif HAS_HEATED_BED
2801
         default: k = 'B'; break;
2795
         default: k = 'B'; break;
2832
           #if ENABLED(SHOW_TEMP_ADC_VALUES)
2826
           #if ENABLED(SHOW_TEMP_ADC_VALUES)
2833
             , redundant_temperature_raw
2827
             , redundant_temperature_raw
2834
           #endif
2828
           #endif
2835
-          , -3 // REDUNDANT
2829
+          , H_REDUNDANT
2836
         );
2830
         );
2837
       #endif
2831
       #endif
2838
     #endif
2832
     #endif
2841
         #if ENABLED(SHOW_TEMP_ADC_VALUES)
2835
         #if ENABLED(SHOW_TEMP_ADC_VALUES)
2842
           , rawBedTemp()
2836
           , rawBedTemp()
2843
         #endif
2837
         #endif
2844
-        , -1 // BED
2838
+        , H_BED
2845
       );
2839
       );
2846
     #endif
2840
     #endif
2847
     #if HAS_TEMP_CHAMBER
2841
     #if HAS_TEMP_CHAMBER
2854
         #if ENABLED(SHOW_TEMP_ADC_VALUES)
2848
         #if ENABLED(SHOW_TEMP_ADC_VALUES)
2855
           , rawChamberTemp()
2849
           , rawChamberTemp()
2856
         #endif
2850
         #endif
2857
-        , -2 // CHAMBER
2851
+        , H_CHAMBER
2858
       );
2852
       );
2859
     #endif // HAS_TEMP_CHAMBER
2853
     #endif // HAS_TEMP_CHAMBER
2860
     #if HOTENDS > 1
2854
     #if HOTENDS > 1
2862
         #if ENABLED(SHOW_TEMP_ADC_VALUES)
2856
         #if ENABLED(SHOW_TEMP_ADC_VALUES)
2863
           , rawHotendTemp(e)
2857
           , rawHotendTemp(e)
2864
         #endif
2858
         #endif
2865
-        , e
2859
+        , (heater_ind_t)e
2866
       );
2860
       );
2867
     #endif
2861
     #endif
2868
-    SERIAL_ECHOPAIR(" @:", getHeaterPower(target_extruder));
2862
+    SERIAL_ECHOPAIR(" @:", getHeaterPower((heater_ind_t)target_extruder));
2869
     #if HAS_HEATED_BED
2863
     #if HAS_HEATED_BED
2870
-      SERIAL_ECHOPAIR(" B@:", getHeaterPower(-1));
2864
+      SERIAL_ECHOPAIR(" B@:", getHeaterPower(H_BED));
2871
     #endif
2865
     #endif
2872
     #if HAS_HEATED_CHAMBER
2866
     #if HAS_HEATED_CHAMBER
2873
-      SERIAL_ECHOPAIR(" C@:", getHeaterPower(-2));
2867
+      SERIAL_ECHOPAIR(" C@:", getHeaterPower(H_CHAMBER));
2874
     #endif
2868
     #endif
2875
     #if HOTENDS > 1
2869
     #if HOTENDS > 1
2876
       HOTEND_LOOP() {
2870
       HOTEND_LOOP() {
2877
         SERIAL_ECHOPAIR(" @", e);
2871
         SERIAL_ECHOPAIR(" @", e);
2878
         SERIAL_CHAR(':');
2872
         SERIAL_CHAR(':');
2879
-        SERIAL_ECHO(getHeaterPower(e));
2873
+        SERIAL_ECHO(getHeaterPower((heater_ind_t)e));
2880
       }
2874
       }
2881
     #endif
2875
     #endif
2882
   }
2876
   }

+ 29
- 21
Marlin/src/module/temperature.h View File

45
   #define E_UNUSED()
45
   #define E_UNUSED()
46
 #endif
46
 #endif
47
 
47
 
48
+// Identifiers for other heaters
49
+typedef enum : int8_t {
50
+  INDEX_NONE = -4,
51
+  H_REDUNDANT, H_CHAMBER, H_BED,
52
+  H_E0, H_E1, H_E2, H_E3, H_E4, H_E5
53
+} heater_ind_t;
54
+
48
 // PID storage
55
 // PID storage
49
 typedef struct { float Kp, Ki, Kd;     } PID_t;
56
 typedef struct { float Kp, Ki, Kd;     } PID_t;
50
 typedef struct { float Kp, Ki, Kd, Kc; } PIDC_t;
57
 typedef struct { float Kp, Ki, Kd, Kc; } PIDC_t;
580
     }
587
     }
581
 
588
 
582
     #if WATCH_HOTENDS
589
     #if WATCH_HOTENDS
583
-      static void start_watching_heater(const uint8_t e=0);
590
+      static void start_watching_hotend(const uint8_t e=0);
584
     #else
591
     #else
585
-      static inline void start_watching_heater(const uint8_t e=0) { UNUSED(e); }
592
+      static inline void start_watching_hotend(const uint8_t e=0) { UNUSED(e); }
586
     #endif
593
     #endif
587
 
594
 
588
     #if HAS_LCD_MENU
595
     #if HAS_LCD_MENU
589
-      static inline void start_watching_E0() { start_watching_heater(0); }
590
-      static inline void start_watching_E1() { start_watching_heater(1); }
591
-      static inline void start_watching_E2() { start_watching_heater(2); }
592
-      static inline void start_watching_E3() { start_watching_heater(3); }
593
-      static inline void start_watching_E4() { start_watching_heater(4); }
594
-      static inline void start_watching_E5() { start_watching_heater(5); }
596
+      static inline void start_watching_E0() { start_watching_hotend(0); }
597
+      static inline void start_watching_E1() { start_watching_hotend(1); }
598
+      static inline void start_watching_E2() { start_watching_hotend(2); }
599
+      static inline void start_watching_E3() { start_watching_hotend(3); }
600
+      static inline void start_watching_E4() { start_watching_hotend(4); }
601
+      static inline void start_watching_E5() { start_watching_hotend(5); }
595
     #endif
602
     #endif
596
 
603
 
597
     static void setTargetHotend(const int16_t celsius, const uint8_t e) {
604
     static void setTargetHotend(const int16_t celsius, const uint8_t e) {
598
       E_UNUSED();
605
       E_UNUSED();
606
+      const uint8_t ee = HOTEND_INDEX;
599
       #ifdef MILLISECONDS_PREHEAT_TIME
607
       #ifdef MILLISECONDS_PREHEAT_TIME
600
         if (celsius == 0)
608
         if (celsius == 0)
601
-          reset_preheat_time(HOTEND_INDEX);
602
-        else if (temp_hotend[HOTEND_INDEX].target == 0)
603
-          start_preheat_time(HOTEND_INDEX);
609
+          reset_preheat_time(ee);
610
+        else if (temp_hotend[ee].target == 0)
611
+          start_preheat_time(ee);
604
       #endif
612
       #endif
605
       #if ENABLED(AUTO_POWER_CONTROL)
613
       #if ENABLED(AUTO_POWER_CONTROL)
606
         powerManager.power_on();
614
         powerManager.power_on();
607
       #endif
615
       #endif
608
-      temp_hotend[HOTEND_INDEX].target = MIN(celsius, temp_range[HOTEND_INDEX].maxtemp - 15);
609
-      start_watching_heater(HOTEND_INDEX);
616
+      temp_hotend[ee].target = MIN(celsius, temp_range[ee].maxtemp - 15);
617
+      start_watching_hotend(ee);
610
     }
618
     }
611
 
619
 
612
     #if WATCH_CHAMBER
620
     #if WATCH_CHAMBER
705
     /**
713
     /**
706
      * The software PWM power for a heater
714
      * The software PWM power for a heater
707
      */
715
      */
708
-    static int16_t getHeaterPower(const int8_t heater);
716
+    static int16_t getHeaterPower(const heater_ind_t heater);
709
 
717
 
710
     /**
718
     /**
711
      * Switch off all heaters, set all target temperatures to 0
719
      * Switch off all heaters, set all target temperatures to 0
716
      * Perform auto-tuning for hotend or bed in response to M303
724
      * Perform auto-tuning for hotend or bed in response to M303
717
      */
725
      */
718
     #if HAS_PID_HEATING
726
     #if HAS_PID_HEATING
719
-      static void PID_autotune(const float &target, const int8_t hotend, const int8_t ncycles, const bool set_result=false);
727
+      static void PID_autotune(const float &target, const heater_ind_t hotend, const int8_t ncycles, const bool set_result=false);
720
 
728
 
721
       #if ENABLED(NO_FAN_SLOWING_IN_PID_TUNING)
729
       #if ENABLED(NO_FAN_SLOWING_IN_PID_TUNING)
722
         static bool adaptive_fan_slowing;
730
         static bool adaptive_fan_slowing;
747
       static void reset_heater_idle_timer(const uint8_t e) {
755
       static void reset_heater_idle_timer(const uint8_t e) {
748
         E_UNUSED();
756
         E_UNUSED();
749
         hotend_idle[HOTEND_INDEX].reset();
757
         hotend_idle[HOTEND_INDEX].reset();
750
-        start_watching_heater(HOTEND_INDEX);
758
+        start_watching_hotend(HOTEND_INDEX);
751
       }
759
       }
752
 
760
 
753
       #if HAS_HEATED_BED
761
       #if HAS_HEATED_BED
806
 
814
 
807
     static void checkExtruderAutoFans();
815
     static void checkExtruderAutoFans();
808
 
816
 
809
-    static float get_pid_output(const int8_t e);
817
+    static float get_pid_output_hotend(const uint8_t e);
810
 
818
 
811
     #if ENABLED(PIDTEMPBED)
819
     #if ENABLED(PIDTEMPBED)
812
       static float get_pid_output_bed();
820
       static float get_pid_output_bed();
816
       static float get_pid_output_chamber();
824
       static float get_pid_output_chamber();
817
     #endif
825
     #endif
818
 
826
 
819
-    static void _temp_error(const int8_t e, PGM_P const serial_msg, PGM_P const lcd_msg);
820
-    static void min_temp_error(const int8_t e);
821
-    static void max_temp_error(const int8_t e);
827
+    static void _temp_error(const heater_ind_t e, PGM_P const serial_msg, PGM_P const lcd_msg);
828
+    static void min_temp_error(const heater_ind_t e);
829
+    static void max_temp_error(const heater_ind_t e);
822
 
830
 
823
     #if ENABLED(THERMAL_PROTECTION_HOTENDS) || HAS_THERMALLY_PROTECTED_BED || ENABLED(THERMAL_PROTECTION_CHAMBER)
831
     #if ENABLED(THERMAL_PROTECTION_HOTENDS) || HAS_THERMALLY_PROTECTED_BED || ENABLED(THERMAL_PROTECTION_CHAMBER)
824
 
832
 
839
         static tr_state_machine_t tr_state_machine_chamber;
847
         static tr_state_machine_t tr_state_machine_chamber;
840
       #endif
848
       #endif
841
 
849
 
842
-      static void thermal_runaway_protection(tr_state_machine_t &state, const float &current, const float &target, const int8_t heater_id, const uint16_t period_seconds, const uint16_t hysteresis_degc);
850
+      static void thermal_runaway_protection(tr_state_machine_t &state, const float &current, const float &target, const heater_ind_t heater_id, const uint16_t period_seconds, const uint16_t hysteresis_degc);
843
 
851
 
844
     #endif // THERMAL_PROTECTION
852
     #endif // THERMAL_PROTECTION
845
 };
853
 };

Loading…
Cancel
Save