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
#if HAS_AUTO_REPORTING
if (!gcode.autoreport_paused) {
if (!gcode.autoreport.paused) {
TERN_(AUTO_REPORT_TEMPERATURES, thermalManager.auto_report_temperatures());
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)
bool GcodeSuite::autoreport_paused; // = false
GcodeSuite::autoreport_t GcodeSuite::autoreport{0};
#endif
#if ENABLED(HOST_KEEPALIVE_FEATURE)
@ -1022,7 +1022,7 @@ void GcodeSuite::process_subcommands_now(char * gcode) {
void GcodeSuite::host_keepalive() {
const millis_t ms = millis();
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;
switch (busy_state) {
case IN_HANDLER:

View file

@ -373,15 +373,21 @@ public:
process_subcommands_now_P(G28_STR);
}
typedef struct {
bool paused:1;
bool position:1;
} autoreport_t;
#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) {
const bool was = autoreport_paused;
autoreport_paused = p;
const bool was = autoreport.paused;
autoreport.paused = p;
return was;
}
#else
static constexpr bool autoreport_paused = false;
static constexpr autoreport_t{false};
static inline bool set_autoreport_paused(const bool) { return false; }
#endif

View file

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

View file

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