From 60be3d264b6fd0b5b5eab384d0c7254d5d116bfd Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 31 Mar 2017 20:06:38 -0500 Subject: [PATCH] Macros to print floats, hiding imprecision --- Marlin/serial.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Marlin/serial.h b/Marlin/serial.h index 864a9d8f66..b6e7add430 100644 --- a/Marlin/serial.h +++ b/Marlin/serial.h @@ -65,6 +65,12 @@ extern const char errormagic[] PROGMEM; #define SERIAL_ERRORLN(x) SERIAL_PROTOCOLLN(x) #define SERIAL_ERRORLNPGM(x) SERIAL_PROTOCOLLNPGM(x) +// These macros compensate for float imprecision +#define SERIAL_PROTOCOLPAIR_F(name, value) SERIAL_PROTOCOLPAIR(name, FIXFLOAT(value)) +#define SERIAL_PROTOCOLLNPAIR_F(name, value) SERIAL_PROTOCOLLNPAIR(name, FIXFLOAT(value)) +#define SERIAL_ECHOPAIR_F(name,value) SERIAL_ECHOPAIR(name, FIXFLOAT(value)) +#define SERIAL_ECHOLNPAIR_F(name, value) SERIAL_ECHOLNPAIR(name, FIXFLOAT(value)) + void serial_echopair_P(const char* s_P, const char *v); void serial_echopair_P(const char* s_P, char v); void serial_echopair_P(const char* s_P, int v);