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

This commit is contained in:
Tim Moore 2019-06-27 19:29:53 -07:00 committed by Scott Lahteine
parent 39c0c2aebe
commit 81209f5310
3 changed files with 47 additions and 20 deletions

View File

@ -33,7 +33,11 @@ void GcodeSuite::M105() {
#if HAS_TEMP_SENSOR #if HAS_TEMP_SENSOR
SERIAL_ECHOPGM(MSG_OK); 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 #else // !HAS_TEMP_SENSOR
SERIAL_ERROR_MSG(MSG_ERR_NO_THERMISTORS); SERIAL_ERROR_MSG(MSG_ERR_NO_THERMISTORS);
#endif #endif

View File

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

View File

@ -756,7 +756,11 @@ class Temperature {
#endif // HEATER_IDLE_HANDLER #endif // HEATER_IDLE_HANDLER
#if HAS_TEMP_SENSOR #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) #if ENABLED(AUTO_REPORT_TEMPERATURES)
static uint8_t auto_report_temp_interval; static uint8_t auto_report_temp_interval;
static millis_t next_temp_report_ms; static millis_t next_temp_report_ms;