Move M155 to cpp, auto-report to Temperature

This commit is contained in:
Scott Lahteine
2017-09-16 13:05:01 -05:00
parent df031ab100
commit df0432c7c8
5 changed files with 41 additions and 28 deletions

View File

@ -2259,4 +2259,19 @@ void Temperature::isr() {
#endif
}
#if ENABLED(AUTO_REPORT_TEMPERATURES)
uint8_t Temperature::auto_report_temp_interval;
millis_t Temperature::next_temp_report_ms;
void Temperature::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();
SERIAL_EOL();
}
}
#endif // AUTO_REPORT_TEMPERATURES
#endif // HAS_TEMP_HOTEND || HAS_TEMP_BED

View File

@ -527,6 +527,16 @@ class Temperature {
#if HAS_TEMP_HOTEND || HAS_TEMP_BED
static void print_heaterstates();
#if ENABLED(AUTO_REPORT_TEMPERATURES)
static uint8_t auto_report_temp_interval;
static millis_t next_temp_report_ms;
static void auto_report_temperatures(void);
FORCE_INLINE void set_auto_report_interval(uint8_t v) {
NOMORE(v, 60);
auto_report_temp_interval = v;
next_temp_report_ms = millis() + 1000UL * v;
}
#endif
#endif
private: