Browse Source

Clean up M122 code

Scott Lahteine 4 years ago
parent
commit
9b7807d40f
1 changed files with 4 additions and 3 deletions
  1. 4
    3
      Marlin/src/gcode/feature/trinamic/M122.cpp

+ 4
- 3
Marlin/src/gcode/feature/trinamic/M122.cpp View File

@@ -39,9 +39,10 @@ void GcodeSuite::M122() {
39 39
 
40 40
   #if ENABLED(TMC_DEBUG)
41 41
     #if ENABLED(MONITOR_DRIVER_STATUS)
42
-      const bool sflag = parser.seen('S'), s0 = sflag && !parser.value_bool();
43
-      if (sflag) tmc_set_report_interval(s0 ? 0 : MONITOR_DRIVER_STATUS_INTERVAL_MS);
44
-      if (!s0 && parser.seenval('P')) tmc_set_report_interval(_MIN(parser.value_ushort(), MONITOR_DRIVER_STATUS_INTERVAL_MS));
42
+      uint16_t interval = MONITOR_DRIVER_STATUS_INTERVAL_MS;
43
+      if (parser.seen('S') && !parser.value_bool()) interval = 0;
44
+      if (parser.seenval('P')) NOMORE(interval, parser.value_ushort());
45
+      tmc_set_report_interval(interval);
45 46
     #endif
46 47
 
47 48
     if (parser.seen('V'))

Loading…
Cancel
Save