From 4201d165e1d1659f625cf7b3e07cde7f423cfadc Mon Sep 17 00:00:00 2001 From: shitcreek Date: Thu, 5 Dec 2019 21:19:27 -0600 Subject: [PATCH] Add condition for frequency limit - fixes issues with laser The frequency limit causes blurry raster engraving (https://github.com/MarlinFirmware/Marlin/issues/16058) and for the new yet to be merged laser improvements PR (https://github.com/MarlinFirmware/Marlin/pull/15335), it causes the laser to stay on after a job has finished --- Marlin/Configuration_adv.h | 8 ++++++++ Marlin/src/Marlin.cpp | 14 +++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 0717a3ac5489..b9604b3ad392 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -320,6 +320,14 @@ #define TEMP_SENSOR_AD8495_OFFSET 0.0 #define TEMP_SENSOR_AD8495_GAIN 1.0 +/** + * + * Limit check_axes_activity frequency to 10Hz + * Affects M106 + * Undefine this if laser engraving with M106 produces blurry results +*/ +// #define LIMIT_FREQUENCY + /** * Controller Fan * To cool down the stepper drivers and MOSFETs. diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp index 2198672ff875..09d997f1ac48 100644 --- a/Marlin/src/Marlin.cpp +++ b/Marlin/src/Marlin.cpp @@ -608,12 +608,16 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) { L6470.monitor_driver(); #endif - // Limit check_axes_activity frequency to 10Hz - static millis_t next_check_axes_ms = 0; - if (ELAPSED(ms, next_check_axes_ms)) { +// Limit check_axes_activity frequency to 10Hz + #if ENABLED(LIMIT_FREQUENCY) + static millis_t next_check_axes_ms = 0; + if (ELAPSED(ms, next_check_axes_ms)) { + planner.check_axes_activity(); + next_check_axes_ms = ms + 100UL; + } + #else planner.check_axes_activity(); - next_check_axes_ms = ms + 100UL; - } + #endif #if PIN_EXISTS(FET_SAFETY) static millis_t FET_next;