From 5c120222a49990702bec327860f82848b8ca14ec Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 8 May 2018 05:42:14 -0500 Subject: [PATCH] Show correct units in M503 --- Marlin/configuration_store.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/Marlin/configuration_store.cpp b/Marlin/configuration_store.cpp index a6632a6bcf..ab49001df5 100644 --- a/Marlin/configuration_store.cpp +++ b/Marlin/configuration_store.cpp @@ -1904,6 +1904,16 @@ void MarlinSettings::reset() { void say_M603() { SERIAL_ECHOPGM(" M603 "); } #endif + inline void say_units(const bool colon=false) { + serialprintPGM( + #if ENABLED(INCH_MODE_SUPPORT) + parser.linear_unit_factor != 1.0 ? PSTR(" (in)") : + #endif + PSTR(" (mm)") + ); + if (colon) SERIAL_ECHOLNPGM(":"); + } + /** * M503 - Report current settings in RAM * @@ -1920,13 +1930,15 @@ void MarlinSettings::reset() { #define VOLUMETRIC_UNIT(N) (float(N) / (parser.volumetric_enabled ? parser.volumetric_unit_factor : parser.linear_unit_factor)) SERIAL_ECHOPGM(" G2"); SERIAL_CHAR(parser.linear_unit_factor == 1.0 ? '1' : '0'); - SERIAL_ECHOPGM(" ; Units in "); - serialprintPGM(parser.linear_unit_factor == 1.0 ? PSTR("mm\n") : PSTR("inches\n")); + SERIAL_ECHOPGM(" ;"); + say_units(); #else #define LINEAR_UNIT(N) (N) #define VOLUMETRIC_UNIT(N) (N) - SERIAL_ECHOLNPGM(" G21 ; Units in mm"); + SERIAL_ECHOPGM(" G21 ;"); + say_units(); #endif + SERIAL_EOL(); #if ENABLED(ULTIPANEL) @@ -2338,7 +2350,8 @@ void MarlinSettings::reset() { #if HAS_BED_PROBE if (!forReplay) { CONFIG_ECHO_START; - SERIAL_ECHOLNPGM("Z-Probe Offset (mm):"); + SERIAL_ECHOPGM("Z-Probe Offset"); + say_units(true); } CONFIG_ECHO_START; SERIAL_ECHOLNPAIR(" M851 Z", LINEAR_UNIT(zprobe_zoffset));