Ending GCode FluidNC

Finally got my table together! It’s not quite finished and still needs to be stained and some electrical bits tidied up, but everything seems to be working well for the most part now after fixing some issues (be sure to tighten your stepper pulley set screws!).

One thing I keep having trouble with is when patterns finish, FluidNC seems to throw an alarm for motor positioning, lose motor positioning, and stops detecting the SD card. After a quick reboot everything is fine again.

I’m curious if this might be caused by my lack of any end gcode in the files? With my 3D printer, I have code to turn off heaters, move the bed for part removal, turn off the motors, etc, but obviously most of this isn’t needed with a 2D sand table so I’m not sure what could be causing the issue. Anybody have any advice?

Also, completely unrelated to the above issue, I am working on trying to automate playlist/table control using Home Assistant/NodeRed with the FluidNC/ESP3D interface. Thus far I’ve been able to get them communicating, have a few working buttons on my dashboard for homing, pause, & resume, and have managed to automate pulling a parsed array of pattern files from the SD card and placing them into a Home Assistant input_select dropdown list. Still need to work on the actual outbound commands to start the patterns, but I’m nearly there. Full disclosure, I’m far from a programmer and it could probably be done more efficiently, but I can give some updates/brief walkthrough in a future thread when I get it working if anyone is interested.

4 Likes

That sounds awesome and like a lot of fun.

I don’t know why it wouldn’t see the sd card. But the default setting for grbl is to disable the motors as soon as the gcode ends. Once the motors are disabled, you can’t jog the machine without homing it. It calls that state “alarm”.

2 Likes

Now that you mention it, Some of mine do that as well. I need to look into it. I thought my card was failing or something.

This could be totally out in left field but by chance are the patterns failing on a certain file name. On my elegoo printer I noticed that if I have a very long file name it messes with the address card. I shortened the name and it works fine.
Probably not the issue but just wanted to add my .02$.

So my patterns work but some (maybe all) fail on the last few lines. On something like a wipe it is easy to see when 5 line segments are missing but on fancy stuff 5 segments could be a very small part of an arc. I don’t always notice it because I typically run the pattern and turn it off after.

Looks like maybe we are supposed to end with M30??

1 Like

Maybe GRBL exits too early, like after the buffer is emptied, not giving enough time for the planner to finish up final moves. If so, just adding G4 P0.1 to the end will allow the planner to complete before exit. I swear I read a similar thing on the github a while back.

I also experienced the exact same issue on a wipe pattern with the last few lines so I’ll try your M30 suggestion as well as @truglodite suggestion of G4 P0.1 and see if there is any improvement by including one or the other (or both).

I looked at my plasma’s gcode it ends with M2. I made a different file and I got an error when I did not include the M2.

I think I should make a small test file. Home then do a square. Using each ending Gcode. One has to work.

2 Likes

I think marlinfw doesn’t support M2, just grbl and a few others. Everything supports g4 though.

1 Like

My plasma and zen are GRBL.

1 Like

I ran a basic wipe pattern with M30 and G4 P0.1 and it appears that both finished the complete drawing but only M30 left the tool in an idle state. G4 P0.1 still left me with an alarm state and no SD card, though it did finish the pattern which was an improvement over no ending gcode.

I took a cue from Ryan and tried running some small square patterns and frustratingly all of them completed without issue: No ending code, M2, M30, and G4 P0.1 all finished and left the tool in an idle state. I wonder if this is a bug and/or only triggers with more ‘complicated’ code.

I think I’ll include M2 in future patterns just because it couldn’t hurt, but I’ll keep an eye out for this to reoccur in the future. Perhaps I also have a faulty SD card (off-brand 4GB that came with my 3D printer).

Interesting. I think the team over at fluidNC would know exactly what is going on. Would you want to make a post over there or would you like me to do it?

1 Like

Maybe it’d be better coming from you since I’m still very much a novice at all this.

Okay adding it to my notes.

Okay I just ran some test last night and today.

I have ended a pattern that always had issues with M30 and it completed and no errors or alarms. M2 did not work.

To be more specific I did end with a M30 and an extra line, just because I saw that mentioned somewhere. I will try without the extra line at the end just to be sure but I do not think it is needed.

1 Like

I was going to update that I had one fail today with the M2 command at the end. I’ll try swapping them to M30 and seeing if that helps at all.

I’ve also started experiencing the pausing that you mentioned you were experiencing in the other post. This began right after I swapped the power supply you guys provided in the hardware kit for a 12V 10A supply I bought off Amazon to supply some extra juice for the LEDs.

It’s pretty odd, as I can hear the stepper drivers ‘humming’ like normal when this happens but there is no movement on the carriage and the webUI/serial terminal locks up. After 2-20 seconds the carriage starts moving again like nothing happened and the serial terminal begins updating again.

I’m going to buy a new SD card since this one wasn’t very good quality to begin with. I’m also considering putting a capacitor across the power supply with the thought that it could help reduce any noise in the supply, but I’m not sure what size is appropriate. I have a bunch of 1000µF caps so I might toss one of those in to see if it makes a difference. It could be a bad PSU but I’ll try the easier options before buying another one since I’ve cut the connector off the cord already.

1 Like

Found the fix to that as well. Update your webui setting to either stop “auto-check every” or change it to 30 seconds or more. No more pauses.

1 Like

Bart did just tell me this board needs an added resistor on fluidnc that was not needed on grblesp32. the driver resistor should be 10k not 1k like it is but I thought that was just a current thing. Mine seems to work fine, I will pass along any info I get. He also linked the config for the new pen board that eliminates the Z axis that I need to try (with pin changes). I did try that myself but it would not compile. So many things, so little time.

1 Like

I signed up for that tindie not email thing so I can get one of those fluidnc boards. These boards are odd to me like is it literally some random genius dude making boards at home or small scale ?
I had a bit of a chuckle when I went to get that laser pen one and it said it’s retired lol
Sorry to get off topic just wanted to see if that’s a guys best chance at getting these boards.

Almost, except he does have them made at a board house in China last I checked. The PCB’s are cool, but to me what’s even more impressive is Bart and Mitchel’s dev skills. I’m thankful that we have industrious souls living among us that can execute such projects to the point where they are very accessible to regular folks. The modern fast response cloning teams put a big damper on the party. So spending extra like buying the board at tindie is IMHO a very noble thing to do.

2 Likes