Fix temperature printing.
Remove the assumption there's always an extruder temperature sensor and make reading on single sensors (e.g. M105 P2) more usable. Apparently works very well, but *sigh* yet another 100 bytes of binary size.
This commit is contained in:
parent
24561919bf
commit
37933c8a85
|
|
@ -500,7 +500,7 @@ void process_gcode_command() {
|
|||
queue_wait();
|
||||
#endif
|
||||
if ( ! next_target.seen_P)
|
||||
next_target.P = HEATER_EXTRUDER;
|
||||
next_target.P = TEMP_SENSOR_none;
|
||||
temp_print(next_target.P);
|
||||
break;
|
||||
|
||||
|
|
|
|||
38
temp.c
38
temp.c
|
|
@ -358,26 +358,30 @@ uint8_t temp_all_zero() {
|
|||
|
||||
// extruder doesn't have sersendf_P
|
||||
#ifndef EXTRUDER
|
||||
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);
|
||||
}
|
||||
|
||||
/// send temperatures to host
|
||||
/// \param index sensor value to send
|
||||
void temp_print(temp_sensor_t index) {
|
||||
uint8_t c = 0;
|
||||
|
||||
if (index >= NUM_TEMP_SENSORS)
|
||||
return;
|
||||
|
||||
c = (temp_sensors_runtime[index].last_read_temp & 3) * 25;
|
||||
|
||||
#if REPRAP_HOST_COMPATIBILITY >= 20110509
|
||||
sersendf_P(PSTR("T:%u.%u"), temp_sensors_runtime[index].last_read_temp >> 2, c);
|
||||
#else
|
||||
sersendf_P(PSTR("\nT:%u.%u"), temp_sensors_runtime[index].last_read_temp >> 2, c);
|
||||
#endif
|
||||
#ifdef HEATER_BED
|
||||
c = (temp_sensors_runtime[HEATER_BED].last_read_temp & 3) * 25;
|
||||
|
||||
sersendf_P(PSTR(" B:%u.%u"), temp_sensors_runtime[HEATER_BED].last_read_temp >> 2 , c);
|
||||
#endif
|
||||
|
||||
if (index == TEMP_SENSOR_none) { // standard behaviour
|
||||
#ifdef HEATER_EXTRUDER
|
||||
sersendf_P(PSTR("T:"));
|
||||
single_temp_print(HEATER_EXTRUDER);
|
||||
#endif
|
||||
#ifdef HEATER_BED
|
||||
sersendf_P(PSTR(" B:"));
|
||||
single_temp_print(HEATER_BED);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
if (index >= NUM_TEMP_SENSORS)
|
||||
return;
|
||||
sersendf_P(PSTR("T[%su]:"), index);
|
||||
single_temp_print(index);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue