Skip to content

Commit

Permalink
🚸 Set M122 interval only with S0 or Pn
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Aug 10, 2021
1 parent eafd0ed commit 418743c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Marlin/src/gcode/feature/trinamic/M122.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ void GcodeSuite::M122() {

#if ENABLED(TMC_DEBUG)
#if ENABLED(MONITOR_DRIVER_STATUS)
uint16_t interval = MONITOR_DRIVER_STATUS_INTERVAL_MS;
if (parser.seen('S') && !parser.value_bool()) interval = 0;
if (parser.seenval('P')) NOMORE(interval, parser.value_ushort());
tmc_set_report_interval(interval);
const bool sflag = parser.seen_test('S'), sval = sflag && parser.value_bool();
if (sflag && !sval)
tmc_set_report_interval(0);
else if (parser.seenval('P'))
tmc_set_report_interval(_MAX(250, parser.value_ushort()));
else if (sval)
tmc_set_report_interval(MONITOR_DRIVER_STATUS_INTERVAL_MS);
#endif

if (parser.seen_test('V'))
Expand Down

0 comments on commit 418743c

Please sign in to comment.