File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -204,10 +204,6 @@ bool wait_for_heatup = true;
204204 bool wait_for_user; // = false;
205205#endif
206206
207- #if HAS_AUTO_REPORTING || ENABLED(HOST_KEEPALIVE_FEATURE)
208- bool suspend_auto_report; // = false
209- #endif
210-
211207// Inactivity shutdown
212208millis_t max_inactive_time, // = 0
213209 stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL ;
@@ -432,7 +428,7 @@ void startOrResumeJob() {
432428 * - Pulse FET_SAFETY_PIN if it exists
433429 */
434430
435- void manage_inactivity (const bool ignore_stepper_queue/* =false*/ ) {
431+ inline void manage_inactivity (const bool ignore_stepper_queue=false ) {
436432
437433 #if HAS_FILAMENT_SENSOR
438434 runout.run ();
@@ -697,7 +693,7 @@ void idle(
697693 #endif
698694
699695 #if HAS_AUTO_REPORTING
700- if (!suspend_auto_report ) {
696+ if (!gcode. autoreport_paused ) {
701697 #if ENABLED(AUTO_REPORT_TEMPERATURES)
702698 thermalManager.auto_report_temperatures ();
703699 #endif
Original file line number Diff line number Diff line change @@ -44,8 +44,6 @@ void idle(
4444 #endif
4545);
4646
47- void manage_inactivity (const bool ignore_stepper_queue = false);
48-
4947#if ENABLED (EXPERIMENTAL_I2CBUS )
5048 #include "feature/twibus.h"
5149 extern TWIBus i2c ;
@@ -84,10 +82,6 @@ extern bool wait_for_heatup;
8482 extern bool wait_for_user ;
8583#endif
8684
87- #if HAS_AUTO_REPORTING || ENABLED (HOST_KEEPALIVE_FEATURE )
88- extern bool suspend_auto_report ;
89- #endif
90-
9185// Inactivity shutdown timer
9286extern millis_t max_inactive_time , stepper_inactive_time ;
9387
Original file line number Diff line number Diff line change @@ -35,6 +35,18 @@ void safe_delay(millis_t ms) {
3535 thermalManager.manage_heater (); // This keeps us safe if too many small safe_delay() calls are made
3636}
3737
38+ // A delay to provide brittle hosts time to receive bytes
39+ #if ENABLED(SERIAL_OVERRUN_PROTECTION)
40+
41+ #include " ../gcode/gcode.h" // for set_autoreport_paused
42+
43+ void serial_delay (const millis_t ms) {
44+ const bool was = gcode.set_autoreport_paused (true );
45+ safe_delay (ms);
46+ gcode.set_autoreport_paused (was);
47+ }
48+ #endif
49+
3850#if ENABLED(DEBUG_LEVELING_FEATURE)
3951
4052 #include " ../module/probe.h"
Original file line number Diff line number Diff line change 2727// Delay that ensures heaters and watchdog are kept alive
2828void safe_delay (millis_t ms);
2929
30- // A delay to provide brittle hosts time to receive bytes
31- inline void serial_delay (const millis_t ms) {
32- #if ENABLED(SERIAL_OVERRUN_PROTECTION)
33- safe_delay (ms);
34- #else
35- UNUSED (ms);
36- #endif
37- }
30+ #if ENABLED(SERIAL_OVERRUN_PROTECTION)
31+ void serial_delay (const millis_t ms);
32+ #else
33+ inline void serial_delay (const millis_t ) {}
34+ #endif
3835
3936#if GRID_MAX_POINTS_X && GRID_MAX_POINTS_Y
4037
Original file line number Diff line number Diff line change 2828
2929 unified_bed_leveling ubl;
3030
31+ #include " ../../../MarlinCore.h"
32+
3133 #include " ../../../module/configuration_store.h"
3234 #include " ../../../module/planner.h"
3335 #include " ../../../module/motion.h"
151153 * 4: Compact Human-Readable
152154 */
153155 void unified_bed_leveling::display_map (const int map_type) {
154- #if HAS_AUTO_REPORTING || ENABLED(HOST_KEEPALIVE_FEATURE)
155- suspend_auto_report = true ;
156- #endif
156+ const bool was = gcode.set_autoreport_paused (true );
157157
158158 constexpr uint8_t eachsp = 1 + 6 + 1 , // [-3.567]
159159 twixt = eachsp * (GRID_MAX_POINTS_X) - 9 * 2 ; // Leading 4sp, Coordinates 9sp each
229229 SERIAL_EOL ();
230230 }
231231
232- #if HAS_AUTO_REPORTING || ENABLED(HOST_KEEPALIVE_FEATURE)
233- suspend_auto_report = false ;
234- #endif
232+ set_gcode.set_autoreport_paused (was);
235233 }
236234
237235 bool unified_bed_leveling::sanity_check () {
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ GcodeSuite gcode;
5353 #include " ../feature/cancel_object.h"
5454#endif
5555
56- #include " ../MarlinCore.h" // for idle() and suspend_auto_report
56+ #include " ../MarlinCore.h" // for idle()
5757
5858millis_t GcodeSuite::previous_move_ms;
5959
@@ -66,6 +66,10 @@ uint8_t GcodeSuite::axis_relative = (
6666 | (ar_init.e ? _BV(REL_E) : 0 )
6767);
6868
69+ #if HAS_AUTO_REPORTING || ENABLED(HOST_KEEPALIVE_FEATURE)
70+ bool GcodeSuite::autoreport_paused; // = false
71+ #endif
72+
6973#if ENABLED(HOST_KEEPALIVE_FEATURE)
7074 GcodeSuite::MarlinBusyState GcodeSuite::busy_state = NOT_BUSY;
7175 uint8_t GcodeSuite::host_keepalive_interval = DEFAULT_KEEPALIVE_INTERVAL;
@@ -942,7 +946,7 @@ void GcodeSuite::process_subcommands_now(char * gcode) {
942946 void GcodeSuite::host_keepalive () {
943947 const millis_t ms = millis ();
944948 static millis_t next_busy_signal_ms = 0 ;
945- if (!suspend_auto_report && host_keepalive_interval && busy_state != NOT_BUSY) {
949+ if (!autoreport_paused && host_keepalive_interval && busy_state != NOT_BUSY) {
946950 if (PENDING (ms, next_busy_signal_ms)) return ;
947951 switch (busy_state) {
948952 case IN_HANDLER:
Original file line number Diff line number Diff line change @@ -351,6 +351,18 @@ class GcodeSuite {
351351 process_subcommands_now_P (G28_STR);
352352 }
353353
354+ #if HAS_AUTO_REPORTING || ENABLED(HOST_KEEPALIVE_FEATURE)
355+ static bool autoreport_paused;
356+ static inline bool set_autoreport_paused (const bool p) {
357+ const bool was = autoreport_paused;
358+ autoreport_paused = p;
359+ return was;
360+ }
361+ #else
362+ static constexpr bool autoreport_paused = false ;
363+ static inline bool set_autoreport_paused (const bool ) { return false ; }
364+ #endif
365+
354366 #if ENABLED(HOST_KEEPALIVE_FEATURE)
355367 /* *
356368 * States for managing Marlin and host communication
You can’t perform that action at this time.
0 commit comments