Browse Source

'M105 R' to report redundant temp sensor (#14324)

Tim Moore 5 years ago
parent
commit
81209f5310

+ 5
- 1
Marlin/src/gcode/temperature/M105.cpp View File

@@ -33,7 +33,11 @@ void GcodeSuite::M105() {
33 33
 
34 34
   #if HAS_TEMP_SENSOR
35 35
     SERIAL_ECHOPGM(MSG_OK);
36
-    thermalManager.print_heater_states(target_extruder);
36
+    thermalManager.print_heater_states(target_extruder
37
+      #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
38
+        , parser.boolval('R')
39
+      #endif
40
+    );
37 41
   #else // !HAS_TEMP_SENSOR
38 42
     SERIAL_ERROR_MSG(MSG_ERR_NO_THERMISTORS);
39 43
   #endif

+ 37
- 18
Marlin/src/module/temperature.cpp View File

@@ -112,7 +112,11 @@ Temperature thermalManager;
112 112
   bool Temperature::adaptive_fan_slowing = true;
113 113
 #endif
114 114
 
115
-hotend_info_t Temperature::temp_hotend[HOTENDS]; // = { 0 }
115
+hotend_info_t Temperature::temp_hotend[HOTENDS
116
+  #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
117
+    + 1
118
+  #endif
119
+]; // = { 0 }
116 120
 
117 121
 #if ENABLED(AUTO_POWER_E_FANS)
118 122
   uint8_t Temperature::autofan_speed[HOTENDS]; // = { 0 }
@@ -2773,22 +2777,25 @@ void Temperature::isr() {
2773 2777
     #endif
2774 2778
     , const int8_t e=-3
2775 2779
   ) {
2776
-    #if !(HAS_HEATED_BED && HAS_TEMP_HOTEND && HAS_TEMP_CHAMBER) && HOTENDS <= 1
2777
-      UNUSED(e);
2778
-    #endif
2779
-
2780
-    SERIAL_CHAR(' ');
2781
-    SERIAL_CHAR(
2782
-      #if HAS_TEMP_CHAMBER && HAS_HEATED_BED && HAS_TEMP_HOTEND
2783
-        e == -2 ? 'C' : e == -1 ? 'B' : 'T'
2784
-      #elif HAS_HEATED_BED && HAS_TEMP_HOTEND
2785
-        e == -1 ? 'B' : 'T'
2786
-      #elif HAS_TEMP_HOTEND
2787
-        'T'
2788
-      #else
2789
-        'B'
2780
+    char k;
2781
+    switch (e) {
2782
+      #if HAS_TEMP_CHAMBER
2783
+        case -2: k = 'C'; break;
2790 2784
       #endif
2791
-    );
2785
+      #if HAS_TEMP_HOTEND
2786
+        default: k = 'T'; break;
2787
+        #if HAS_HEATED_BED
2788
+          case -1: k = 'B'; break;
2789
+        #endif
2790
+        #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
2791
+          case -3: k = 'R'; break;
2792
+        #endif
2793
+      #elif HAS_HEATED_BED
2794
+        default: k = 'B'; break;
2795
+      #endif
2796
+    }
2797
+    SERIAL_CHAR(' ');
2798
+    SERIAL_CHAR(k);
2792 2799
     #if HOTENDS > 1
2793 2800
       if (e >= 0) SERIAL_CHAR('0' + e);
2794 2801
     #endif
@@ -2796,19 +2803,31 @@ void Temperature::isr() {
2796 2803
     SERIAL_ECHO(c);
2797 2804
     SERIAL_ECHOPAIR(" /" , t);
2798 2805
     #if ENABLED(SHOW_TEMP_ADC_VALUES)
2799
-      SERIAL_ECHOPAIR(" (", r / OVERSAMPLENR);
2806
+      SERIAL_ECHOPAIR(" (", r * RECIPROCAL(OVERSAMPLENR));
2800 2807
       SERIAL_CHAR(')');
2801 2808
     #endif
2802 2809
     delay(2);
2803 2810
   }
2804 2811
 
2805
-  void Temperature::print_heater_states(const uint8_t target_extruder) {
2812
+  void Temperature::print_heater_states(const uint8_t target_extruder
2813
+    #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
2814
+      , const bool include_r/*=false*/
2815
+    #endif
2816
+  ) {
2806 2817
     #if HAS_TEMP_HOTEND
2807 2818
       print_heater_state(degHotend(target_extruder), degTargetHotend(target_extruder)
2808 2819
         #if ENABLED(SHOW_TEMP_ADC_VALUES)
2809 2820
           , rawHotendTemp(target_extruder)
2810 2821
         #endif
2811 2822
       );
2823
+      #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
2824
+        if (include_r) print_heater_state(redundant_temperature, degTargetHotend(target_extruder)
2825
+          #if ENABLED(SHOW_TEMP_ADC_VALUES)
2826
+            , redundant_temperature_raw
2827
+          #endif
2828
+          , -3 // REDUNDANT
2829
+        );
2830
+      #endif
2812 2831
     #endif
2813 2832
     #if HAS_HEATED_BED
2814 2833
       print_heater_state(degBed(), degTargetBed()

+ 5
- 1
Marlin/src/module/temperature.h View File

@@ -756,7 +756,11 @@ class Temperature {
756 756
     #endif // HEATER_IDLE_HANDLER
757 757
 
758 758
     #if HAS_TEMP_SENSOR
759
-      static void print_heater_states(const uint8_t target_extruder);
759
+      static void print_heater_states(const uint8_t target_extruder
760
+        #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
761
+          , const bool include_r=false
762
+        #endif
763
+      );
760 764
       #if ENABLED(AUTO_REPORT_TEMPERATURES)
761 765
         static uint8_t auto_report_temp_interval;
762 766
         static millis_t next_temp_report_ms;

Loading…
Cancel
Save