Move heater output to Temperature class

This commit is contained in:
Scott Lahteine
2017-09-16 04:44:37 -05:00
parent 63228fc453
commit 71aefc2e22
8 changed files with 980 additions and 83 deletions

View File

@@ -2392,81 +2392,6 @@ static bool pin_is_protected(const int8_t pin) {
#include "gcode/stats/M78.h"
#endif
#if HAS_TEMP_HOTEND || HAS_TEMP_BED
void print_heater_state(const float &c, const float &t,
#if ENABLED(SHOW_TEMP_ADC_VALUES)
const float r,
#endif
const int8_t e=-2
) {
#if !(HAS_TEMP_BED && HAS_TEMP_HOTEND) && HOTENDS <= 1
UNUSED(e);
#endif
SERIAL_PROTOCOLCHAR(' ');
SERIAL_PROTOCOLCHAR(
#if HAS_TEMP_BED && HAS_TEMP_HOTEND
e == -1 ? 'B' : 'T'
#elif HAS_TEMP_HOTEND
'T'
#else
'B'
#endif
);
#if HOTENDS > 1
if (e >= 0) SERIAL_PROTOCOLCHAR('0' + e);
#endif
SERIAL_PROTOCOLCHAR(':');
SERIAL_PROTOCOL(c);
SERIAL_PROTOCOLPAIR(" /" , t);
#if ENABLED(SHOW_TEMP_ADC_VALUES)
SERIAL_PROTOCOLPAIR(" (", r / OVERSAMPLENR);
SERIAL_PROTOCOLCHAR(')');
#endif
}
void print_heaterstates() {
#if HAS_TEMP_HOTEND
print_heater_state(thermalManager.degHotend(gcode.target_extruder), thermalManager.degTargetHotend(gcode.target_extruder)
#if ENABLED(SHOW_TEMP_ADC_VALUES)
, thermalManager.rawHotendTemp(gcode.target_extruder)
#endif
);
#endif
#if HAS_TEMP_BED
print_heater_state(thermalManager.degBed(), thermalManager.degTargetBed(),
#if ENABLED(SHOW_TEMP_ADC_VALUES)
thermalManager.rawBedTemp(),
#endif
-1 // BED
);
#endif
#if HOTENDS > 1
HOTEND_LOOP() print_heater_state(thermalManager.degHotend(e), thermalManager.degTargetHotend(e),
#if ENABLED(SHOW_TEMP_ADC_VALUES)
thermalManager.rawHotendTemp(e),
#endif
e
);
#endif
SERIAL_PROTOCOLPGM(" @:");
SERIAL_PROTOCOL(thermalManager.getHeaterPower(gcode.target_extruder));
#if HAS_TEMP_BED
SERIAL_PROTOCOLPGM(" B@:");
SERIAL_PROTOCOL(thermalManager.getHeaterPower(-1));
#endif
#if HOTENDS > 1
HOTEND_LOOP() {
SERIAL_PROTOCOLPAIR(" @", e);
SERIAL_PROTOCOLCHAR(':');
SERIAL_PROTOCOL(thermalManager.getHeaterPower(e));
}
#endif
}
#endif // HAS_TEMP_HOTEND || HAS_TEMP_BED
#include "gcode/temperature/M105.h"
#if ENABLED(AUTO_REPORT_TEMPERATURES) && (HAS_TEMP_HOTEND || HAS_TEMP_BED)
@@ -2477,7 +2402,7 @@ static bool pin_is_protected(const int8_t pin) {
inline void auto_report_temperatures() {
if (auto_report_temp_interval && ELAPSED(millis(), next_temp_report_ms)) {
next_temp_report_ms = millis() + 1000UL * auto_report_temp_interval;
print_heaterstates();
thermalManager.print_heaterstates();
SERIAL_EOL();
}
}