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

Marlin queue and sending GCODE to it...help please (no replies)

$
0
0
OK, fist let me say I am a C++ idiot, I've done a lot of Basic and some Arduino C stuff but I'm not good at C....so please forgive how stupid I sound. I have been trying to get a project going that involves using a 2560 and RAMPS 1.4 and an old Full Graphics Display. I am modifying the Marlin code to essentially remove most menus and add one of my own to control a filament rewinder. The rewinder has micro switches for endstops X_Min(left side of spool), and X_Max(right side of spool). I have endstops enabled at all times and I modified endstops.cpp to capture when X_Max triggers. The X_Min and X_Max detect the size of the spool to wind onto (needed to guide the filament back and forth as it winds the filament). So I have figured out enough to get a menu up and from that menu I can home the X_Min and then I move X to the right till it hits the X_Max endstop and that sets my upper limit.

That part is all working but where I am running into my issues is when I try to send the actual GCODE. The GCODES are similar to this, I set absolute mode for the X stepper(driving the filament guide) and relative mode for the extruder stepper(driving the spool winding)

G90
M83
G1 X58 E330 F1000; spool the next layer to the Left and wind 33 times (example on a 60mm wide spool)
G1 X1 E330
G1 X58 E330
G1 X1 E330
G1 X58 E330
G1 X1 E330
G1 X58 E330
G1 X1 E330
G1 X58 E330
G1 X1 E330
G1 X58 E330
G1 X1 E330
G1 X58 E330
G1 X1 E330
G1 X58 E330
G1 X1 E330
G1 X58 E330
G1 X1 E330
G1 X58 E330
G1 X1 E330
G1 X58 E330
G1 X1 E330
etc....
So X goes back and forth to guide the wrapping of the filament and E drives the spool itself. A movement of 10 on the extruder is one wrap.

Originally I tried using the custom user menus but I need to modify the G1 X and E values for each line before sending it so the static nature of the GCODE in custom_User_Menus and the need for a little more control made that not workable. So then I found mention of the queue and inject, inject_P, enqueue_one_now etc. so I started down that path. My big problem is I have no idea how this all works and I can't find good docs or much help on the internet. So I went about trying to get it to work, days later and I keep running into issues. I tried sending one line at a time using the queue methods but depending I might get two commands to work but no more or none of the commands would get to the printer or Marlin would reset itself etc. I've tried concatenating all of the commands together and sending them as one string with \n separators and I got it to run but after the first two lines of G1 it would always quit like there were only two lines there.

I guess I'm asking if there is anyone that could guide me on what path I need to follow to accomplish this? The string of commands could be up to 50 lines or so. If I sent the GCODE from Pronterface etc it never has issues so I assume it is a problem in how I am using the queue, since I really have no clue.

I want to thank you in advance for any guidance anyone may be able to give me. Help! Thanks!

Viewing all articles
Browse latest Browse all 2831

Trending Articles



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