This commit is contained in:
Luu Lac 2020-11-13 13:50:28 +01:00 committed by GitHub
commit 395d75dbb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 7 deletions

View file

@ -765,7 +765,7 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
// Auto-report Temperatures / SD Status // Auto-report Temperatures / SD Status
#if HAS_AUTO_REPORTING #if HAS_AUTO_REPORTING
if (!gcode.autoreport_paused) { if (!gcode.autoreport.paused) {
TERN_(AUTO_REPORT_TEMPERATURES, thermalManager.auto_report_temperatures()); TERN_(AUTO_REPORT_TEMPERATURES, thermalManager.auto_report_temperatures());
TERN_(AUTO_REPORT_SD_STATUS, card.auto_report_sd_status()); TERN_(AUTO_REPORT_SD_STATUS, card.auto_report_sd_status());
} }

View file

@ -78,7 +78,7 @@ uint8_t GcodeSuite::axis_relative = (
); );
#if EITHER(HAS_AUTO_REPORTING, HOST_KEEPALIVE_FEATURE) #if EITHER(HAS_AUTO_REPORTING, HOST_KEEPALIVE_FEATURE)
bool GcodeSuite::autoreport_paused; // = false GcodeSuite::autoreport_t GcodeSuite::autoreport{0};
#endif #endif
#if ENABLED(HOST_KEEPALIVE_FEATURE) #if ENABLED(HOST_KEEPALIVE_FEATURE)
@ -1022,7 +1022,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 (!autoreport_paused && 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:

View file

@ -373,15 +373,21 @@ public:
process_subcommands_now_P(G28_STR); process_subcommands_now_P(G28_STR);
} }
typedef struct {
bool paused:1;
bool position:1;
} autoreport_t;
#if EITHER(HAS_AUTO_REPORTING, HOST_KEEPALIVE_FEATURE) #if EITHER(HAS_AUTO_REPORTING, HOST_KEEPALIVE_FEATURE)
static bool autoreport_paused; static autoreport_t autoreport;
static inline bool set_autoreport_paused(const bool p) { static inline bool set_autoreport_paused(const bool p) {
const bool was = autoreport_paused; const bool was = autoreport.paused;
autoreport_paused = p; autoreport.paused = p;
return was; return was;
} }
#else #else
static constexpr bool autoreport_paused = false; static constexpr autoreport_t{false};
static inline bool set_autoreport_paused(const bool) { return false; } static inline bool set_autoreport_paused(const bool) { return false; }
#endif #endif

View file

@ -32,6 +32,9 @@
*/ */
void GcodeSuite::M155() { void GcodeSuite::M155() {
if (parser.seen('P'))
autoreport.position = parser.value_bool();
if (parser.seenval('S')) if (parser.seenval('S'))
thermalManager.set_auto_report_interval(parser.value_byte()); thermalManager.set_auto_report_interval(parser.value_byte());

View file

@ -3092,6 +3092,7 @@ void Temperature::tick() {
PORT_REDIRECT(SERIAL_BOTH); PORT_REDIRECT(SERIAL_BOTH);
print_heater_states(active_extruder); print_heater_states(active_extruder);
SERIAL_EOL(); SERIAL_EOL();
if (gcode.autoreport.position) report_current_position_projected();
} }
} }