From bb29d50f312a2b7f9f7af4403396a2ab3a732dee Mon Sep 17 00:00:00 2001 From: jbernardis Date: Mon, 19 Jan 2015 22:56:44 -0500 Subject: [PATCH] temp.c: also report target temperatures. It's handy and some hosts actually expect this. --- config/printer.mendel.h | 8 ++++++++ config/printer.wolfstrap.h | 8 ++++++++ temp.c | 5 +++++ 3 files changed, 21 insertions(+) diff --git a/config/printer.mendel.h b/config/printer.mendel.h index 1f54f11..e83b496 100644 --- a/config/printer.mendel.h +++ b/config/printer.mendel.h @@ -194,6 +194,14 @@ */ #define TEMP_EWMA 1.0 +/** \def REPORT_TARGET_TEMPS + With this enabled, M105 commands will return the current temperatures along + with the target temps, separated by a slash: ok T:xxx.x/xxx.x B:xxx.x/xxx.x + With this disabled, only temps will be returned: ok T:xxx.x B:xxx.x + Enabling adds 78 bytes to the image. +*/ +#define REPORT_TARGET_TEMPS + /** \def HEATER_SANITY_CHECK Check if heater responds to changes in target temperature, disable and spit errors if not largely untested, please comment in forum if this works, or diff --git a/config/printer.wolfstrap.h b/config/printer.wolfstrap.h index 2f4152e..0a56c96 100644 --- a/config/printer.wolfstrap.h +++ b/config/printer.wolfstrap.h @@ -194,6 +194,14 @@ */ #define TEMP_EWMA 1.0 +/** \def REPORT_TARGET_TEMPS + With this enabled, M105 commands will return the current temperatures along + with the target temps, separated by a slash: ok T:xxx.x/xxx.x B:xxx.x/xxx.x + With this disabled, only temps will be returned: ok T:xxx.x B:xxx.x + Enabling adds 78 bytes to the image. +*/ +#define REPORT_TARGET_TEMPS + /** \def HEATER_SANITY_CHECK Check if heater responds to changes in target temperature, disable and spit errors if not largely untested, please comment in forum if this works, or diff --git a/temp.c b/temp.c index dd4253c..1f6d147 100644 --- a/temp.c +++ b/temp.c @@ -370,6 +370,11 @@ uint16_t temp_get(temp_sensor_t index) { static void single_temp_print(temp_sensor_t index) { uint8_t c = (temp_sensors_runtime[index].last_read_temp & 3) * 25; sersendf_P(PSTR("%u.%u"), temp_sensors_runtime[index].last_read_temp >> 2, c); + #ifdef REPORT_TARGET_TEMPS + sersendf_P(PSTR("/")); + c = (temp_sensors_runtime[index].target_temp & 3) * 25; + sersendf_P(PSTR("%u.%u"), temp_sensors_runtime[index].target_temp >> 2, c); + #endif } /// send temperatures to host