Tweaks to style

This commit is contained in:
Scott Lahteine 2020-06-25 23:04:40 -05:00 committed by Scott Lahteine
parent 0153bf8c14
commit f28a03be60
5 changed files with 19 additions and 17 deletions

View file

@ -728,7 +728,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

@ -71,8 +71,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};
bool GcodeSuite::autoreport_position; // = false
#endif #endif
#if ENABLED(HOST_KEEPALIVE_FEATURE) #if ENABLED(HOST_KEEPALIVE_FEATURE)
@ -975,7 +974,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

@ -353,16 +353,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_position; static autoreport_t autoreport;
static bool autoreport_paused;
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

@ -31,12 +31,9 @@
* M155: Set temperature auto-report interval. M155 S<seconds> * M155: Set temperature auto-report interval. M155 S<seconds>
*/ */
void GcodeSuite::M155() { void GcodeSuite::M155() {
if (parser.seen('P')) //automatically report_current_position_projected();
{ if (parser.seen('P'))
gcode.autoreport_position = true; autoreport.position = parser.value_bool();
}
else
gcode.autoreport_position = false;
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

@ -2988,9 +2988,10 @@ void Temperature::tick() {
next_temp_report_ms = millis() + 1000UL * auto_report_temp_interval; next_temp_report_ms = millis() + 1000UL * auto_report_temp_interval;
PORT_REDIRECT(SERIAL_BOTH); PORT_REDIRECT(SERIAL_BOTH);
print_heater_states(active_extruder); print_heater_states(active_extruder);
if(gcode.autoreport_position){ if (gcode.autoreport.position) {
SERIAL_CHAR(' '); SERIAL_CHAR(' ');
report_current_position_projected();} report_current_position_projected();
}
else else
SERIAL_EOL(); SERIAL_EOL();
} }