temp.c: also report target temperatures.

It's handy and some hosts actually expect this.
This commit is contained in:
jbernardis 2015-01-19 22:56:44 -05:00 committed by Markus Hitter
parent 443c3eb8ad
commit bb29d50f31
3 changed files with 21 additions and 0 deletions

View File

@ -194,6 +194,14 @@
*/ */
#define TEMP_EWMA 1.0 #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 /** \def HEATER_SANITY_CHECK
Check if heater responds to changes in target temperature, disable and spit 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 errors if not largely untested, please comment in forum if this works, or

View File

@ -194,6 +194,14 @@
*/ */
#define TEMP_EWMA 1.0 #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 /** \def HEATER_SANITY_CHECK
Check if heater responds to changes in target temperature, disable and spit 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 errors if not largely untested, please comment in forum if this works, or

5
temp.c
View File

@ -370,6 +370,11 @@ uint16_t temp_get(temp_sensor_t index) {
static void single_temp_print(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; 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); 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 /// send temperatures to host