Browse Source

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

pull/1/head
Tim Moore 5 years ago
committed by Scott Lahteine
parent
commit
81209f5310
  1. 6
      Marlin/src/gcode/temperature/M105.cpp
  2. 55
      Marlin/src/module/temperature.cpp
  3. 6
      Marlin/src/module/temperature.h

6
Marlin/src/gcode/temperature/M105.cpp

@ -33,7 +33,11 @@ void GcodeSuite::M105() {
#if HAS_TEMP_SENSOR
SERIAL_ECHOPGM(MSG_OK);
thermalManager.print_heater_states(target_extruder);
thermalManager.print_heater_states(target_extruder
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
, parser.boolval('R')
#endif
);
#else // !HAS_TEMP_SENSOR
SERIAL_ERROR_MSG(MSG_ERR_NO_THERMISTORS);
#endif

55
Marlin/src/module/temperature.cpp

@ -112,7 +112,11 @@ Temperature thermalManager;
bool Temperature::adaptive_fan_slowing = true;
#endif
hotend_info_t Temperature::temp_hotend[HOTENDS]; // = { 0 }
hotend_info_t Temperature::temp_hotend[HOTENDS
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
+ 1
#endif
]; // = { 0 }
#if ENABLED(AUTO_POWER_E_FANS)
uint8_t Temperature::autofan_speed[HOTENDS]; // = { 0 }
@ -2773,22 +2777,25 @@ void Temperature::isr() {
#endif
, const int8_t e=-3
) {
#if !(HAS_HEATED_BED && HAS_TEMP_HOTEND && HAS_TEMP_CHAMBER) && HOTENDS <= 1
UNUSED(e);
#endif
SERIAL_CHAR(' ');
SERIAL_CHAR(
#if HAS_TEMP_CHAMBER && HAS_HEATED_BED && HAS_TEMP_HOTEND
e == -2 ? 'C' : e == -1 ? 'B' : 'T'
#elif HAS_HEATED_BED && HAS_TEMP_HOTEND
e == -1 ? 'B' : 'T'
#elif HAS_TEMP_HOTEND
'T'
#else
'B'
char k;
switch (e) {
#if HAS_TEMP_CHAMBER
case -2: k = 'C'; break;
#endif
);
#if HAS_TEMP_HOTEND
default: k = 'T'; break;
#if HAS_HEATED_BED
case -1: k = 'B'; break;
#endif
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
case -3: k = 'R'; break;
#endif
#elif HAS_HEATED_BED
default: k = 'B'; break;
#endif
}
SERIAL_CHAR(' ');
SERIAL_CHAR(k);
#if HOTENDS > 1
if (e >= 0) SERIAL_CHAR('0' + e);
#endif
@ -2796,19 +2803,31 @@ void Temperature::isr() {
SERIAL_ECHO(c);
SERIAL_ECHOPAIR(" /" , t);
#if ENABLED(SHOW_TEMP_ADC_VALUES)
SERIAL_ECHOPAIR(" (", r / OVERSAMPLENR);
SERIAL_ECHOPAIR(" (", r * RECIPROCAL(OVERSAMPLENR));
SERIAL_CHAR(')');
#endif
delay(2);
}
void Temperature::print_heater_states(const uint8_t target_extruder) {
void Temperature::print_heater_states(const uint8_t target_extruder
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
, const bool include_r/*=false*/
#endif
) {
#if HAS_TEMP_HOTEND
print_heater_state(degHotend(target_extruder), degTargetHotend(target_extruder)
#if ENABLED(SHOW_TEMP_ADC_VALUES)
, rawHotendTemp(target_extruder)
#endif
);
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
if (include_r) print_heater_state(redundant_temperature, degTargetHotend(target_extruder)
#if ENABLED(SHOW_TEMP_ADC_VALUES)
, redundant_temperature_raw
#endif
, -3 // REDUNDANT
);
#endif
#endif
#if HAS_HEATED_BED
print_heater_state(degBed(), degTargetBed()

6
Marlin/src/module/temperature.h

@ -756,7 +756,11 @@ class Temperature {
#endif // HEATER_IDLE_HANDLER
#if HAS_TEMP_SENSOR
static void print_heater_states(const uint8_t target_extruder);
static void print_heater_states(const uint8_t target_extruder
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
, const bool include_r=false
#endif
);
#if ENABLED(AUTO_REPORT_TEMPERATURES)
static uint8_t auto_report_temp_interval;
static millis_t next_temp_report_ms;

Loading…
Cancel
Save