Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add M114 polling to M155 command function #18247

Closed
PrintEngineering opened this issue Jun 10, 2020 · 3 comments
Closed

Add M114 polling to M155 command function #18247

PrintEngineering opened this issue Jun 10, 2020 · 3 comments
Labels
C: Hosts & Protocols T: Feature Request Features requested by users.

Comments

@PrintEngineering
Copy link

Description

I have just set up firmware that allows M600 to be used without marlin Mode, and unfortunately a new but separate quirk of the printing process has reared its head. In order for the TFT to keep track of XYZ positions, I need them to be auto-reported while printing from Octoprint otherwise I have to interrupt the active serial port with the TFT commanding M114. A 'P' parameter for position in the M155 command should do, as shown below:

//M155.cpp

void GcodeSuite::M155() {

if (parser.seen('P')){//automatically report_current_position_projected(); /new/
gcode.autoreport_position = true;
}
else gcode.autoreport_position = false;

if (parser.seenval('S'))
thermalManager.set_auto_report_interval(parser.value_byte());

}

//temperature.cpp

void Temperature::auto_report_temperatures() {
  if (auto_report_temp_interval && ELAPSED(millis(), next_temp_report_ms)) {
    next_temp_report_ms = millis() + 1000UL * auto_report_temp_interval;
    PORT_REDIRECT(SERIAL_BOTH);
    print_heater_states(active_extruder);
    if(gcode.autoreport_position){ SERIAL_CHAR(' '); report_current_position_projected(); } /*new*/
    else SERIAL_EOL();
  }
}

//gcode.cpp
#if HAS_AUTO_REPORTING || ENABLED(HOST_KEEPALIVE_FEATURE)
bool GcodeSuite::autoreport_paused; // = false
bool GcodeSuite::autoreport_position; // = false /new/
#endif

//gcode.h
#if HAS_AUTO_REPORTING || ENABLED(HOST_KEEPALIVE_FEATURE)
static bool autoreport_position; /new/
static bool autoreport_paused;
static inline bool set_autoreport_paused(const bool p) {
const bool was = autoreport_paused;
autoreport_paused = p;
return was;
}

Feature Workflow

  1. M155 S1 ;Normal temperature reporting every 1 sec
  2. M155 S1 P ;Temperature AND position reported every 1 sec
  3. [and so on...]

Additional Information

This code has been tested working. I'm new to Marlin and not that familiar with your coding conventions, so you may want to clean it up for your liking should you choose to adopt it.

@boelle boelle added the T: Feature Request Features requested by users. label Jun 21, 2020
@shitcreek
Copy link
Contributor

This is a good idea. I've created a PR for it:
#18427
Thanks.

@thisiskeithb
Copy link
Member

#18427 was merged. Closing.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C: Hosts & Protocols T: Feature Request Features requested by users.
Projects
None yet
Development

No branches or pull requests

4 participants