Browse Source

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

Tim Moore 6 years ago
parent
commit
81209f5310

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

33
 
33
 
34
   #if HAS_TEMP_SENSOR
34
   #if HAS_TEMP_SENSOR
35
     SERIAL_ECHOPGM(MSG_OK);
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
   #else // !HAS_TEMP_SENSOR
41
   #else // !HAS_TEMP_SENSOR
38
     SERIAL_ERROR_MSG(MSG_ERR_NO_THERMISTORS);
42
     SERIAL_ERROR_MSG(MSG_ERR_NO_THERMISTORS);
39
   #endif
43
   #endif

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

112
   bool Temperature::adaptive_fan_slowing = true;
112
   bool Temperature::adaptive_fan_slowing = true;
113
 #endif
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
 #if ENABLED(AUTO_POWER_E_FANS)
121
 #if ENABLED(AUTO_POWER_E_FANS)
118
   uint8_t Temperature::autofan_speed[HOTENDS]; // = { 0 }
122
   uint8_t Temperature::autofan_speed[HOTENDS]; // = { 0 }
2773
     #endif
2777
     #endif
2774
     , const int8_t e=-3
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
       #endif
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
     #if HOTENDS > 1
2799
     #if HOTENDS > 1
2793
       if (e >= 0) SERIAL_CHAR('0' + e);
2800
       if (e >= 0) SERIAL_CHAR('0' + e);
2794
     #endif
2801
     #endif
2796
     SERIAL_ECHO(c);
2803
     SERIAL_ECHO(c);
2797
     SERIAL_ECHOPAIR(" /" , t);
2804
     SERIAL_ECHOPAIR(" /" , t);
2798
     #if ENABLED(SHOW_TEMP_ADC_VALUES)
2805
     #if ENABLED(SHOW_TEMP_ADC_VALUES)
2799
-      SERIAL_ECHOPAIR(" (", r / OVERSAMPLENR);
2806
+      SERIAL_ECHOPAIR(" (", r * RECIPROCAL(OVERSAMPLENR));
2800
       SERIAL_CHAR(')');
2807
       SERIAL_CHAR(')');
2801
     #endif
2808
     #endif
2802
     delay(2);
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
     #if HAS_TEMP_HOTEND
2817
     #if HAS_TEMP_HOTEND
2807
       print_heater_state(degHotend(target_extruder), degTargetHotend(target_extruder)
2818
       print_heater_state(degHotend(target_extruder), degTargetHotend(target_extruder)
2808
         #if ENABLED(SHOW_TEMP_ADC_VALUES)
2819
         #if ENABLED(SHOW_TEMP_ADC_VALUES)
2809
           , rawHotendTemp(target_extruder)
2820
           , rawHotendTemp(target_extruder)
2810
         #endif
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
     #endif
2831
     #endif
2813
     #if HAS_HEATED_BED
2832
     #if HAS_HEATED_BED
2814
       print_heater_state(degBed(), degTargetBed()
2833
       print_heater_state(degBed(), degTargetBed()

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

756
     #endif // HEATER_IDLE_HANDLER
756
     #endif // HEATER_IDLE_HANDLER
757
 
757
 
758
     #if HAS_TEMP_SENSOR
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
       #if ENABLED(AUTO_REPORT_TEMPERATURES)
764
       #if ENABLED(AUTO_REPORT_TEMPERATURES)
761
         static uint8_t auto_report_temp_interval;
765
         static uint8_t auto_report_temp_interval;
762
         static millis_t next_temp_report_ms;
766
         static millis_t next_temp_report_ms;

Loading…
Cancel
Save