浏览代码

Show correct current units in M503

Scott Lahteine 7 年前
父节点
当前提交
55f1f8446b
共有 1 个文件被更改,包括 27 次插入4 次删除
  1. 27
    4
      Marlin/src/module/configuration_store.cpp

+ 27
- 4
Marlin/src/module/configuration_store.cpp 查看文件

@@ -1908,6 +1908,21 @@ void MarlinSettings::reset(PORTARG_SOLO) {
1908 1908
     void say_M603(PORTARG_SOLO) { SERIAL_ECHOPGM_P(port, "  M603 "); }
1909 1909
   #endif
1910 1910
 
1911
+  inline void say_units(
1912
+    #if ADD_PORT_ARG
1913
+      PORTARG_SOLO,
1914
+    #endif
1915
+    const bool colon=false
1916
+  ) {
1917
+    serialprintPGM_P(port,
1918
+      #if ENABLED(INCH_MODE_SUPPORT)
1919
+        parser.linear_unit_factor != 1.0 ? PSTR(" (in)") :
1920
+      #endif
1921
+      PSTR(" (mm)")
1922
+    );
1923
+    if (colon) SERIAL_ECHOLNPGM_P(port, ":");
1924
+  }
1925
+
1911 1926
   /**
1912 1927
    * M503 - Report current settings in RAM
1913 1928
    *
@@ -1927,13 +1942,15 @@ void MarlinSettings::reset(PORTARG_SOLO) {
1927 1942
       #define VOLUMETRIC_UNIT(N) (float(N) / (parser.volumetric_enabled ? parser.volumetric_unit_factor : parser.linear_unit_factor))
1928 1943
       SERIAL_ECHOPGM_P(port, "  G2");
1929 1944
       SERIAL_CHAR_P(port, parser.linear_unit_factor == 1.0 ? '1' : '0');
1930
-      SERIAL_ECHOPGM_P(port, " ; Units in ");
1931
-      serialprintPGM_P(port, parser.linear_unit_factor == 1.0 ? PSTR("mm\n") : PSTR("inches\n"));
1945
+      SERIAL_ECHOPGM_P(port, " ;");
1946
+      say_units(PORTVAR_SOLO);
1932 1947
     #else
1933 1948
       #define LINEAR_UNIT(N) (N)
1934 1949
       #define VOLUMETRIC_UNIT(N) (N)
1935
-      SERIAL_ECHOLNPGM_P(port, "  G21    ; Units in mm");
1950
+      SERIAL_ECHOPGM_P(port, "  G21    ; Units in mm");
1951
+      say_units(PORTVAR_SOLO);
1936 1952
     #endif
1953
+    SERIAL_EOL_P(port);
1937 1954
 
1938 1955
     #if ENABLED(ULTIPANEL)
1939 1956
 
@@ -2345,7 +2362,13 @@ void MarlinSettings::reset(PORTARG_SOLO) {
2345 2362
     #if HAS_BED_PROBE
2346 2363
       if (!forReplay) {
2347 2364
         CONFIG_ECHO_START;
2348
-        SERIAL_ECHOLNPGM_P(port, "Z-Probe Offset (mm):");
2365
+        SERIAL_ECHOPGM_P(port, "Z-Probe Offset (mm):");
2366
+        say_units(
2367
+          #if ADD_PORT_ARG
2368
+            port,
2369
+          #endif
2370
+          true
2371
+        );
2349 2372
       }
2350 2373
       CONFIG_ECHO_START;
2351 2374
       SERIAL_ECHOLNPAIR_P(port, "  M851 Z", LINEAR_UNIT(zprobe_zoffset));

正在加载...
取消
保存