MCPcopy Create free account
hub / github.com/MarlinFirmware/Marlin / monitor_tmc_drivers

Function monitor_tmc_drivers

Marlin/src/feature/tmc_util.cpp:391–477  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

389 }
390
391 void monitor_tmc_drivers() {
392 const millis_t ms = millis();
393
394 // Poll TMC drivers at the configured interval
395 static millis_t next_poll = 0;
396 const bool need_update_error_counters = ELAPSED(ms, next_poll);
397 if (need_update_error_counters) next_poll = ms + MONITOR_DRIVER_STATUS_INTERVAL_MS;
398
399 // Also poll at intervals for debugging
400 #if ENABLED(TMC_DEBUG)
401 static millis_t next_debug_reporting = 0;
402 const bool need_debug_reporting = report_tmc_status_interval && ELAPSED(ms, next_debug_reporting);
403 if (need_debug_reporting) next_debug_reporting = ms + report_tmc_status_interval;
404 #else
405 constexpr bool need_debug_reporting = false;
406 #endif
407
408 if (need_update_error_counters || need_debug_reporting) {
409
410 #if X_IS_TRINAMIC || X2_IS_TRINAMIC
411 if ( TERN0(X_IS_TRINAMIC, monitor_tmc_driver(stepperX, need_update_error_counters, need_debug_reporting))
412 || TERN0(X2_IS_TRINAMIC, monitor_tmc_driver(stepperX2, need_update_error_counters, need_debug_reporting))
413 ) {
414 TERN_(X_IS_TRINAMIC, step_current_down(stepperX));
415 TERN_(X2_IS_TRINAMIC, step_current_down(stepperX2));
416 }
417 #endif
418
419 #if Y_IS_TRINAMIC || Y2_IS_TRINAMIC
420 if ( TERN0(Y_IS_TRINAMIC, monitor_tmc_driver(stepperY, need_update_error_counters, need_debug_reporting))
421 || TERN0(Y2_IS_TRINAMIC, monitor_tmc_driver(stepperY2, need_update_error_counters, need_debug_reporting))
422 ) {
423 TERN_(Y_IS_TRINAMIC, step_current_down(stepperY));
424 TERN_(Y2_IS_TRINAMIC, step_current_down(stepperY2));
425 }
426 #endif
427
428 #if ANY(Z_IS_TRINAMIC, Z2_IS_TRINAMIC, Z3_IS_TRINAMIC, Z4_IS_TRINAMIC)
429 if ( TERN0(Z_IS_TRINAMIC, monitor_tmc_driver(stepperZ, need_update_error_counters, need_debug_reporting))
430 || TERN0(Z2_IS_TRINAMIC, monitor_tmc_driver(stepperZ2, need_update_error_counters, need_debug_reporting))
431 || TERN0(Z3_IS_TRINAMIC, monitor_tmc_driver(stepperZ3, need_update_error_counters, need_debug_reporting))
432 || TERN0(Z4_IS_TRINAMIC, monitor_tmc_driver(stepperZ4, need_update_error_counters, need_debug_reporting))
433 ) {
434 TERN_(Z_IS_TRINAMIC, step_current_down(stepperZ));
435 TERN_(Z2_IS_TRINAMIC, step_current_down(stepperZ2));
436 TERN_(Z3_IS_TRINAMIC, step_current_down(stepperZ3));
437 TERN_(Z4_IS_TRINAMIC, step_current_down(stepperZ4));
438 }
439 #endif
440
441 #if I_IS_TRINAMIC
442 if (monitor_tmc_driver(stepperI, need_update_error_counters, need_debug_reporting))
443 step_current_down(stepperI);
444 #endif
445 #if J_IS_TRINAMIC
446 if (monitor_tmc_driver(stepperJ, need_update_error_counters, need_debug_reporting))
447 step_current_down(stepperJ);
448 #endif

Callers 1

manage_inactivityFunction · 0.85

Calls 4

monitor_tmc_driverFunction · 0.85
step_current_downFunction · 0.85
SERIAL_EOLFunction · 0.85
millisFunction · 0.50

Tested by

no test coverage detected