🔧 Temp report precision option (#26253)

This commit is contained in:
Scott Lahteine 2023-10-03 14:52:04 -05:00 committed by GitHub
parent 102de7dac3
commit 15dfbabc9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4205,12 +4205,14 @@ void Temperature::isr() {
case H_REDUNDANT: k = 'R'; break;
#endif
}
#define SFP _MIN(SERIAL_FLOAT_PRECISION, 2)
#ifndef HEATER_STATE_FLOAT_PRECISION
#define HEATER_STATE_FLOAT_PRECISION _MIN(SERIAL_FLOAT_PRECISION, 2)
#endif
SString<50> s(' ', k);
if (TERN0(HAS_MULTI_HOTEND, e >= 0)) s += char('0' + e);
s += ':'; s += p_float_t(c, SFP);
if (show_t) { s += F(" /"); s += p_float_t(t, SFP); }
s += ':'; s += p_float_t(c, HEATER_STATE_FLOAT_PRECISION);
if (show_t) { s += F(" /"); s += p_float_t(t, HEATER_STATE_FLOAT_PRECISION); }
#if ENABLED(SHOW_TEMP_ADC_VALUES)
// Temperature MAX SPI boards do not have an OVERSAMPLENR defined
s.append(F(" ("), TERN(HAS_MAXTC_LIBRARIES, k == 'T', false) ? r : r * RECIPROCAL(OVERSAMPLENR), ')');