diff --git a/clock.c b/clock.c
index 081b1f9c0..06ea57499 100644
--- a/clock.c
+++ b/clock.c
@@ -94,6 +94,7 @@ static void clock_250ms(void) {
#endif
temp_residency_tick();
+ temp_periodic_print();
if (temp_waiting()) {
serial_writestr_P(PSTR("Waiting for target temp\n"));
diff --git a/gcode_process.c b/gcode_process.c
index c202246e2..d670f7150 100644
--- a/gcode_process.c
+++ b/gcode_process.c
@@ -644,7 +644,12 @@ void process_gcode_command() {
//? FIRMWARE_NAME:Teacup FIRMWARE_URL:http://github.com/traumflug/Teacup_Firmware/ PROTOCOL_VERSION:1.0 MACHINE_TYPE:Mendel EXTRUDER_COUNT:1 TEMP_SENSOR_COUNT:1 HEATER_COUNT:1
//?
- sersendf_P(PSTR("FIRMWARE_NAME:Teacup FIRMWARE_URL:http://github.com/traumflug/Teacup_Firmware/ PROTOCOL_VERSION:1.0 MACHINE_TYPE:Mendel EXTRUDER_COUNT:%d TEMP_SENSOR_COUNT:%d HEATER_COUNT:%d\n"), 1, NUM_TEMP_SENSORS, NUM_HEATERS);
+ sersendf_P(PSTR("FIRMWARE_NAME:Teacup "
+ "FIRMWARE_URL:http://github.com/traumflug/Teacup_Firmware/ "
+ "PROTOCOL_VERSION:1.0 MACHINE_TYPE:Mendel EXTRUDER_COUNT:%d "
+ "TEMP_SENSOR_COUNT:%d HEATER_COUNT:%d\n"
+ "cap:AUTOREPORT_TEMP:%d\n"),
+ 1, NUM_TEMP_SENSORS, NUM_HEATERS, 1);
break;
case 116:
@@ -790,6 +795,35 @@ void process_gcode_command() {
#endif
break;
+ case 155:
+ //? --- M155: Report Temperature(s) Periodically ---
+ //?
+ //? Example: M155 Sn
+ //?
+ //? turns on periodic reporting of the temperatures of the current
+ //? extruder and the build base in degrees Celsius. The reporting
+ //? interval is given in seconds as the S parameter. Use S0 to disable
+ //? periodic temperature reporting. The reporting format is the same
+ //? as for M105, except there is no "ok" at the start of each report.
+ //? For example, the line sent to the host periodically looks like
+ //?
+ //? T:201 B:117
+ //?
+ //? Teacup supports an optional P parameter as a zero-based temperature
+ //? sensor index to address.
+ //?
+
+ // S is required
+ if ( ! next_target.seen_S)
+ break;
+ #ifdef ENFORCE_ORDER
+ queue_wait();
+ #endif
+ if ( ! next_target.seen_P)
+ next_target.P = TEMP_SENSOR_none;
+ temp_periodic_config(next_target.S, next_target.P);
+ break;
+
case 220:
//? --- M220: Set speed factor override percentage ---
if ( ! next_target.seen_S)
diff --git a/temp.c b/temp.c
index 10ac04eec..9e36a1fb9 100644
--- a/temp.c
+++ b/temp.c
@@ -108,6 +108,11 @@ static struct {
static uint8_t wait_for_temp = 0;
+// Automatic temperature report period (AUTOREPORT_TEMP)
+static uint8_t periodic_temp_seconds;
+static temp_sensor_t periodic_temp_index;
+static uint8_t periodic_temp_timer;
+
/// Set up temp sensors.
void temp_init() {
temp_sensor_t i;
@@ -626,6 +631,27 @@ static void single_temp_print(temp_sensor_t index) {
#endif
}
+/// set parameters for periodic temperature reporting
+/// \param secs reporting interval in seconds; 0 to disable reporting
+/// \param index sensor to report
+void temp_periodic_config(uint8_t secs, temp_sensor_t index) {
+ periodic_temp_seconds = secs;
+ periodic_temp_index = index;
+ periodic_temp_timer = secs;
+}
+
+/// send temperatures to the host periodically.
+/// Called once per second from clock.c
+void temp_periodic_print() {
+ if (periodic_temp_seconds == 0)
+ return;
+ if (--periodic_temp_timer != 0)
+ return;
+
+ temp_print(periodic_temp_index);
+ periodic_temp_timer = periodic_temp_seconds;
+}
+
/// send temperatures to host
/// \param index sensor value to send
void temp_print(temp_sensor_t index) {
diff --git a/temp.h b/temp.h
index f5fec4692..ed0c3836a 100644
--- a/temp.h
+++ b/temp.h
@@ -40,6 +40,9 @@ void temp_heater_tick(void);
void temp_residency_tick(void);
+void temp_periodic_config(uint8_t secs, temp_sensor_t index);
+void temp_periodic_print(void);
+
uint8_t temp_achieved(void);
void temp_set_wait(void);