From e7d519c89834fe787f333646810e06a6e969a603 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 7 Mar 2018 00:53:26 -0600 Subject: [PATCH] Add suspend_auto_report flag to suppress auto-report --- Marlin/Conditionals_post.h | 2 ++ Marlin/Marlin.h | 4 ++++ Marlin/Marlin_main.cpp | 19 +++++++++++++------ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Marlin/Conditionals_post.h b/Marlin/Conditionals_post.h index 4e1d8691e..84be141d7 100644 --- a/Marlin/Conditionals_post.h +++ b/Marlin/Conditionals_post.h @@ -753,6 +753,8 @@ #undef AUTO_REPORT_TEMPERATURES #endif + #define HAS_AUTO_REPORTING (ENABLED(AUTO_REPORT_TEMPERATURES) || ENABLED(AUTO_REPORT_SD_STATUS)) + /** * This setting is also used by M109 when trying to calculate * a ballpark safe margin to prevent wait-forever situation. diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index 70ed6342a..0cce1ab8a 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -232,6 +232,10 @@ extern volatile bool wait_for_heatup; extern volatile bool wait_for_user; #endif +#if HAS_AUTO_REPORTING + extern bool suspend_auto_report; +#endif + extern float current_position[XYZE], destination[XYZE]; /** diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index c332b41c7..32289275b 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -510,6 +510,10 @@ volatile bool wait_for_heatup = true; volatile bool wait_for_user = false; #endif +#if HAS_AUTO_REPORTING + bool suspend_auto_report; // = false +#endif + const char axis_codes[XYZE] = { 'X', 'Y', 'Z', 'E' }; // Number of characters read in the current line of serial input @@ -13454,10 +13458,6 @@ void idle( host_keepalive(); - #if ENABLED(AUTO_REPORT_TEMPERATURES) && (HAS_TEMP_HOTEND || HAS_TEMP_BED) - thermalManager.auto_report_temperatures(); - #endif - manage_inactivity( #if ENABLED(ADVANCED_PAUSE_FEATURE) no_stepper_sleep @@ -13482,8 +13482,15 @@ void idle( } #endif - #if ENABLED(AUTO_REPORT_SD_STATUS) - card.auto_report_sd_status(); + #if HAS_AUTO_REPORTING + if (!suspend_auto_report) { + #if ENABLED(AUTO_REPORT_TEMPERATURES) + thermalManager.auto_report_temperatures(); + #endif + #if ENABLED(AUTO_REPORT_SD_STATUS) + card.auto_report_sd_status(); + #endif + } #endif }