Quantcast
Channel: Reprap Forum - Firmware - Marlin
Viewing all articles
Browse latest Browse all 12089

Re: How do I know which line of Gcode my printer is currently executing?

$
0
0
Marlin doesnt count line numbers as such when accepting data over usb/serial (as far as I know)

It does watch line number if you send them ie N field and checksum, wont match actual line number in text file as comments are not counted

"Spit balling here"

SERIAL_PROTOCOLLN(gcode_LastN); will print the current N field

but as you say things are buffered. so that would just show last sent line, not last actioned

looking in the power recovery code I see the following

job_recovery_info.cmd_queue_index_r = cmd_queue_index_r;
job_recovery_info.commands_in_queue = commands_in_queue;

so you might try adding all this to M114

find in Marlin_main.cpp
void report_current_position() {
  SERIAL_PROTOCOLPAIR("X:", LOGICAL_X_POSITION(current_position[X_AXIS]));
  SERIAL_PROTOCOLPAIR(" Y:", LOGICAL_Y_POSITION(current_position[Y_AXIS]));
  SERIAL_PROTOCOLPAIR(" Z:", LOGICAL_Z_POSITION(current_position[Z_AXIS]));
  SERIAL_PROTOCOLPAIR(" E:", current_position[E_CART]);
and add the line
  SERIAL_PROTOCOLPAIR(" Line:", gcode_LastN-commands_in_queue+ cmd_queue_index_r);

NB It compiles, but I haven't tried it... It may be out by 1, depends if the ring buffer starts 0 or 1. Or it may not work at all.

I do notice your still at this... and your still slowly getting us to do all your work for you...

Viewing all articles
Browse latest Browse all 12089

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>