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

Function loop

Marlin/src/MarlinCore.cpp:1722–1744  ·  view source on GitHub ↗

* The main Marlin program loop * * - Call idle() to handle all tasks between G-code commands * Note that no G-codes from the queue can be executed during idle() * but many G-codes can be called directly anytime like macros. * - Check whether SD card auto-start is needed now. * - Check whether SD print finishing is needed now. * - Run one G-code command from the immediate or ma

Source from the content-addressed store, hash-verified

1720 * as long as idle() or manage_inactivity() are being called.
1721 */
1722void loop() {
1723 do {
1724 idle();
1725
1726 #if HAS_MEDIA
1727 if (card.flag.abort_sd_printing) abortSDPrinting();
1728 if (marlin_state == MarlinState::MF_SD_COMPLETE) finishSDPrinting();
1729 #endif
1730
1731 queue.advance();
1732
1733 #if ANY(POWER_OFF_TIMER, POWER_OFF_WAIT_FOR_COOLDOWN)
1734 powerManager.checkAutoPowerOff();
1735 #endif
1736
1737 endstops.event_handler();
1738
1739 TERN_(HAS_TFT_LVGL_UI, printer_state_polling());
1740
1741 TERN_(MARLIN_TEST_BUILD, runPeriodicTests());
1742
1743 } while (ENABLED(__AVR__)); // Loop forever on slower (AVR) boards
1744}

Callers 3

onIdleFunction · 0.85
early_parse_M808Method · 0.85
mainFunction · 0.85

Calls 8

idleFunction · 0.85
abortSDPrintingFunction · 0.85
finishSDPrintingFunction · 0.85
printer_state_pollingFunction · 0.85
runPeriodicTestsFunction · 0.85
advanceMethod · 0.80
checkAutoPowerOffMethod · 0.80
event_handlerMethod · 0.80

Tested by

no test coverage detected