Marlin queue and sending GCODE to it...help please November 03, 2022 05:13PM |
Registered: 3 years ago Posts: 7 |
Re: Marlin queue and sending GCODE to it...help please November 03, 2022 11:59PM |
Registered: 3 years ago Posts: 7 |
static void Rewind_Spool() { ui.defer_status_screen(); char gcode_buffer [50]; //uint16_t Filament_Length = ((Hit_Pos/2) * 10); //uint16_t loop_cnt = 0; extern const char G1_WIND[]; // PGMSTR(G1_WIND, "G1 X%d F800"); delay(1000); sprintf_P(gcode_buffer, G1_WIND, Hit_Pos); queue.enqueue_one_now(gcode_buffer); SERIAL_ECHOLN(gcode_buffer); sprintf_P(gcode_buffer, G1_WIND,1); queue.enqueue_one_now(gcode_buffer); SERIAL_ECHOLN(gcode_buffer); sprintf_P(gcode_buffer, G1_WIND, Hit_Pos); queue.enqueue_one_now(gcode_buffer); SERIAL_ECHOLN(gcode_buffer); sprintf_P(gcode_buffer, G1_WIND,1); queue.enqueue_one_now(gcode_buffer); SERIAL_ECHOLN(gcode_buffer); // sprintf_P(gcode_buffer, G1_WIND, Hit_Pos); // queue.enqueue_one_now(gcode_buffer); // SERIAL_ECHOLN(gcode_buffer); }
Re: Marlin queue and sending GCODE to it...help please November 04, 2022 01:07AM |
Admin Registered: 14 years ago Posts: 7,168 |
Re: Marlin queue and sending GCODE to it...help please November 04, 2022 01:44AM |
Registered: 11 years ago Posts: 126 |
Quote
warpster
This snippet works but if I uncomment the last 3 lines it does nothing and Pronterface looses control of the printer after this is ran (with the lines uncommented). I assume I'm over running the buffer but I don't know what/how to check if it is OK to send another command. Hopefully someone can set me straight. Thanks
queue.inject(cmd)
with all the G1
commands together in the single cmd
string, separated by "\n"
. These commands will be queued up once Marlin returns back to the main loop()
, where it will also process the next command at the head of the command queue. Marlin allows G-code commands to block the queue by design, so that a long command like `G29` can take as long as needed. And Marlin does handshaking with the host to keep it waiting when the queue gets filled up.do_blocking_move_to
functions from motion.cpp
. These are best used from within a G-code handler, so if you need to do a complex series of moves it can work best to just implement a custom G-code and do the custom motions from within that handler, either with direct moves or by calling gcode.process_subcommands_now
.
Re: Marlin queue and sending GCODE to it...help please November 04, 2022 03:01AM |
Registered: 3 years ago Posts: 7 |
Re: Marlin queue and sending GCODE to it...help please November 06, 2022 08:41PM |
Registered: 3 years ago Posts: 7 |