Inline manage_inactivity, tweak autoreport_paused
This commit is contained in:
parent
2b788e9aa6
commit
a1f026f57a
|
@ -204,10 +204,6 @@ bool wait_for_heatup = true;
|
||||||
bool wait_for_user; // = false;
|
bool wait_for_user; // = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_AUTO_REPORTING || ENABLED(HOST_KEEPALIVE_FEATURE)
|
|
||||||
bool suspend_auto_report; // = false
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Inactivity shutdown
|
// Inactivity shutdown
|
||||||
millis_t max_inactive_time, // = 0
|
millis_t max_inactive_time, // = 0
|
||||||
stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL;
|
stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL;
|
||||||
|
@ -432,7 +428,7 @@ void startOrResumeJob() {
|
||||||
* - Pulse FET_SAFETY_PIN if it exists
|
* - Pulse FET_SAFETY_PIN if it exists
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
|
inline void manage_inactivity(const bool ignore_stepper_queue=false) {
|
||||||
|
|
||||||
#if HAS_FILAMENT_SENSOR
|
#if HAS_FILAMENT_SENSOR
|
||||||
runout.run();
|
runout.run();
|
||||||
|
@ -697,7 +693,7 @@ void idle(
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_AUTO_REPORTING
|
#if HAS_AUTO_REPORTING
|
||||||
if (!suspend_auto_report) {
|
if (!gcode.autoreport_paused) {
|
||||||
#if ENABLED(AUTO_REPORT_TEMPERATURES)
|
#if ENABLED(AUTO_REPORT_TEMPERATURES)
|
||||||
thermalManager.auto_report_temperatures();
|
thermalManager.auto_report_temperatures();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -44,8 +44,6 @@ void idle(
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
void manage_inactivity(const bool ignore_stepper_queue=false);
|
|
||||||
|
|
||||||
#if ENABLED(EXPERIMENTAL_I2CBUS)
|
#if ENABLED(EXPERIMENTAL_I2CBUS)
|
||||||
#include "feature/twibus.h"
|
#include "feature/twibus.h"
|
||||||
extern TWIBus i2c;
|
extern TWIBus i2c;
|
||||||
|
@ -84,10 +82,6 @@ extern bool wait_for_heatup;
|
||||||
extern bool wait_for_user;
|
extern bool wait_for_user;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_AUTO_REPORTING || ENABLED(HOST_KEEPALIVE_FEATURE)
|
|
||||||
extern bool suspend_auto_report;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Inactivity shutdown timer
|
// Inactivity shutdown timer
|
||||||
extern millis_t max_inactive_time, stepper_inactive_time;
|
extern millis_t max_inactive_time, stepper_inactive_time;
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,18 @@ void safe_delay(millis_t ms) {
|
||||||
thermalManager.manage_heater(); // This keeps us safe if too many small safe_delay() calls are made
|
thermalManager.manage_heater(); // This keeps us safe if too many small safe_delay() calls are made
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A delay to provide brittle hosts time to receive bytes
|
||||||
|
#if ENABLED(SERIAL_OVERRUN_PROTECTION)
|
||||||
|
|
||||||
|
#include "../gcode/gcode.h" // for set_autoreport_paused
|
||||||
|
|
||||||
|
void serial_delay(const millis_t ms) {
|
||||||
|
const bool was = gcode.set_autoreport_paused(true);
|
||||||
|
safe_delay(ms);
|
||||||
|
gcode.set_autoreport_paused(was);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
|
|
||||||
#include "../module/probe.h"
|
#include "../module/probe.h"
|
||||||
|
|
|
@ -27,14 +27,11 @@
|
||||||
// Delay that ensures heaters and watchdog are kept alive
|
// Delay that ensures heaters and watchdog are kept alive
|
||||||
void safe_delay(millis_t ms);
|
void safe_delay(millis_t ms);
|
||||||
|
|
||||||
// A delay to provide brittle hosts time to receive bytes
|
#if ENABLED(SERIAL_OVERRUN_PROTECTION)
|
||||||
inline void serial_delay(const millis_t ms) {
|
void serial_delay(const millis_t ms);
|
||||||
#if ENABLED(SERIAL_OVERRUN_PROTECTION)
|
#else
|
||||||
safe_delay(ms);
|
inline void serial_delay(const millis_t) {}
|
||||||
#else
|
#endif
|
||||||
UNUSED(ms);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#if GRID_MAX_POINTS_X && GRID_MAX_POINTS_Y
|
#if GRID_MAX_POINTS_X && GRID_MAX_POINTS_Y
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
|
|
||||||
unified_bed_leveling ubl;
|
unified_bed_leveling ubl;
|
||||||
|
|
||||||
|
#include "../../../MarlinCore.h"
|
||||||
|
|
||||||
#include "../../../module/configuration_store.h"
|
#include "../../../module/configuration_store.h"
|
||||||
#include "../../../module/planner.h"
|
#include "../../../module/planner.h"
|
||||||
#include "../../../module/motion.h"
|
#include "../../../module/motion.h"
|
||||||
|
@ -151,9 +153,7 @@
|
||||||
* 4: Compact Human-Readable
|
* 4: Compact Human-Readable
|
||||||
*/
|
*/
|
||||||
void unified_bed_leveling::display_map(const int map_type) {
|
void unified_bed_leveling::display_map(const int map_type) {
|
||||||
#if HAS_AUTO_REPORTING || ENABLED(HOST_KEEPALIVE_FEATURE)
|
const bool was = gcode.set_autoreport_paused(true);
|
||||||
suspend_auto_report = true;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
constexpr uint8_t eachsp = 1 + 6 + 1, // [-3.567]
|
constexpr uint8_t eachsp = 1 + 6 + 1, // [-3.567]
|
||||||
twixt = eachsp * (GRID_MAX_POINTS_X) - 9 * 2; // Leading 4sp, Coordinates 9sp each
|
twixt = eachsp * (GRID_MAX_POINTS_X) - 9 * 2; // Leading 4sp, Coordinates 9sp each
|
||||||
|
@ -229,9 +229,7 @@
|
||||||
SERIAL_EOL();
|
SERIAL_EOL();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAS_AUTO_REPORTING || ENABLED(HOST_KEEPALIVE_FEATURE)
|
set_gcode.set_autoreport_paused(was);
|
||||||
suspend_auto_report = false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool unified_bed_leveling::sanity_check() {
|
bool unified_bed_leveling::sanity_check() {
|
||||||
|
|
|
@ -53,7 +53,7 @@ GcodeSuite gcode;
|
||||||
#include "../feature/cancel_object.h"
|
#include "../feature/cancel_object.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../MarlinCore.h" // for idle() and suspend_auto_report
|
#include "../MarlinCore.h" // for idle()
|
||||||
|
|
||||||
millis_t GcodeSuite::previous_move_ms;
|
millis_t GcodeSuite::previous_move_ms;
|
||||||
|
|
||||||
|
@ -66,6 +66,10 @@ uint8_t GcodeSuite::axis_relative = (
|
||||||
| (ar_init.e ? _BV(REL_E) : 0)
|
| (ar_init.e ? _BV(REL_E) : 0)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#if HAS_AUTO_REPORTING || ENABLED(HOST_KEEPALIVE_FEATURE)
|
||||||
|
bool GcodeSuite::autoreport_paused; // = false
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ENABLED(HOST_KEEPALIVE_FEATURE)
|
#if ENABLED(HOST_KEEPALIVE_FEATURE)
|
||||||
GcodeSuite::MarlinBusyState GcodeSuite::busy_state = NOT_BUSY;
|
GcodeSuite::MarlinBusyState GcodeSuite::busy_state = NOT_BUSY;
|
||||||
uint8_t GcodeSuite::host_keepalive_interval = DEFAULT_KEEPALIVE_INTERVAL;
|
uint8_t GcodeSuite::host_keepalive_interval = DEFAULT_KEEPALIVE_INTERVAL;
|
||||||
|
@ -942,7 +946,7 @@ void GcodeSuite::process_subcommands_now(char * gcode) {
|
||||||
void GcodeSuite::host_keepalive() {
|
void GcodeSuite::host_keepalive() {
|
||||||
const millis_t ms = millis();
|
const millis_t ms = millis();
|
||||||
static millis_t next_busy_signal_ms = 0;
|
static millis_t next_busy_signal_ms = 0;
|
||||||
if (!suspend_auto_report && host_keepalive_interval && busy_state != NOT_BUSY) {
|
if (!autoreport_paused && host_keepalive_interval && busy_state != NOT_BUSY) {
|
||||||
if (PENDING(ms, next_busy_signal_ms)) return;
|
if (PENDING(ms, next_busy_signal_ms)) return;
|
||||||
switch (busy_state) {
|
switch (busy_state) {
|
||||||
case IN_HANDLER:
|
case IN_HANDLER:
|
||||||
|
|
|
@ -351,6 +351,18 @@ public:
|
||||||
process_subcommands_now_P(G28_STR);
|
process_subcommands_now_P(G28_STR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if HAS_AUTO_REPORTING || ENABLED(HOST_KEEPALIVE_FEATURE)
|
||||||
|
static bool autoreport_paused;
|
||||||
|
static inline bool set_autoreport_paused(const bool p) {
|
||||||
|
const bool was = autoreport_paused;
|
||||||
|
autoreport_paused = p;
|
||||||
|
return was;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
static constexpr bool autoreport_paused = false;
|
||||||
|
static inline bool set_autoreport_paused(const bool) { return false; }
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ENABLED(HOST_KEEPALIVE_FEATURE)
|
#if ENABLED(HOST_KEEPALIVE_FEATURE)
|
||||||
/**
|
/**
|
||||||
* States for managing Marlin and host communication
|
* States for managing Marlin and host communication
|
||||||
|
|
Loading…
Reference in a new issue