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

@ -2179,3 +2179,80 @@ void Temperature::isr() {
in_temp_isr = false;
ENABLE_TEMPERATURE_INTERRUPT(); //re-enable Temperature ISR
}
#if HAS_TEMP_HOTEND || HAS_TEMP_BED
#include "../gcode/gcode.h"
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 Temperature::print_heaterstates() {
#if HAS_TEMP_HOTEND
print_heater_state(degHotend(gcode.target_extruder), degTargetHotend(gcode.target_extruder)
#if ENABLED(SHOW_TEMP_ADC_VALUES)
, rawHotendTemp(gcode.target_extruder)
#endif
);
#endif
#if HAS_TEMP_BED
print_heater_state(degBed(), degTargetBed(),
#if ENABLED(SHOW_TEMP_ADC_VALUES)
rawBedTemp(),
#endif
-1 // BED
);
#endif
#if HOTENDS > 1
HOTEND_LOOP() print_heater_state(degHotend(e), degTargetHotend(e),
#if ENABLED(SHOW_TEMP_ADC_VALUES)
rawHotendTemp(e),
#endif
e
);
#endif
SERIAL_PROTOCOLPGM(" @:");
SERIAL_PROTOCOL(getHeaterPower(gcode.target_extruder));
#if HAS_TEMP_BED
SERIAL_PROTOCOLPGM(" B@:");
SERIAL_PROTOCOL(getHeaterPower(-1));
#endif
#if HOTENDS > 1
HOTEND_LOOP() {
SERIAL_PROTOCOLPAIR(" @", e);
SERIAL_PROTOCOLCHAR(':');
SERIAL_PROTOCOL(getHeaterPower(e));
}
#endif
}
#endif // HAS_TEMP_HOTEND || HAS_TEMP_BED

View File

@ -525,6 +525,10 @@ class Temperature {
#endif
#endif
#if HAS_TEMP_HOTEND || HAS_TEMP_BED
static void print_heaterstates();
#endif
private:
#if ENABLED(FAST_PWM_FAN)