add P parameter to M155

auto report position with M155 P
This commit is contained in:
shitcreek 2020-06-25 22:01:38 -05:00
parent 520c0ab96b
commit a658880332
4 changed files with 14 additions and 2 deletions

View file

@ -71,7 +71,8 @@ uint8_t GcodeSuite::axis_relative = (
);
#if EITHER(HAS_AUTO_REPORTING, HOST_KEEPALIVE_FEATURE)
bool GcodeSuite::autoreport_paused; // = false
bool GcodeSuite::autoreport_paused; // = false
bool GcodeSuite::autoreport_position; // = false /new/
#endif
#if ENABLED(HOST_KEEPALIVE_FEATURE)

View file

@ -354,6 +354,7 @@ public:
}
#if EITHER(HAS_AUTO_REPORTING, HOST_KEEPALIVE_FEATURE)
static bool autoreport_position;
static bool autoreport_paused;
static inline bool set_autoreport_paused(const bool p) {
const bool was = autoreport_paused;

View file

@ -31,6 +31,12 @@
* M155: Set temperature auto-report interval. M155 S<seconds>
*/
void GcodeSuite::M155() {
if (parser.seen('P')) //automatically report_current_position_projected();
{
gcode.autoreport_position = true;
}
else
gcode.autoreport_position = false;
if (parser.seenval('S'))
thermalManager.set_auto_report_interval(parser.value_byte());

View file

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