ESTLCAM, Marlin, and file extensions

I run my MPCNC from an LCD, and it only recognizes files on the SD card that have a .g or .gcode extension. I have ESTLCAM set up to give its output files a .g extension so the machine can use them, but if I need to reopen the file in ESTLCAM again, I have to change the extension to .nc, which is what ESTLCAM recognizes.

Does anyone know how I can either 1) Make marlin recognize a .nc file, or 2) Make ESTLCAM recognize a .g or .gcode file?

Thanks!

Karl

If you look at the Marlin source code you’ll find a file called cardreader.cpp. I’m pretty sure the filename filter is hardcoded there but I know NOTHING about the inner workings of Marlin. If what I’m seeing is right, then this code will allow any filename extension so long as the first character is a ‘G’. It would probably work if you renamed your file testfile.grandma .If it does, then you can be pretty sure this is the filter code. It would’ve been nice if they made this parameter configurable. You could try changing it and see what happens but there may be code elsewhere that verifies the filename again. If you feel brave, make a backup of your firmware first. Then…

  1. open cardreader.cpp file in notepad
  2. search for the code snippet below

if (!filenameIsDir && (p.name[8] != ‘G’ || p.name[9] == ‘~’)) continue;

Replace with the code snippet below

if (!filenameIsDir && (p.name[8] != ‘G’ || p.name[8] != ‘N’ || p.name[9] == ‘~’)) continue;

3)Save the changes

  1. Re-compile and flash in your Arduino IDE

If it doesn’t work then just re-flash your backup from earlier

This code change SHOULD allow any file with extension beginning with a ‘G’ or an ‘N’. I emphasize that I’m guessing and have tested nothing but you’ve proven yourself to be a willing guinea pig Karl so I’d like to hear how it works out:)

1 Like

Hi Leo,

I look forward to giving this a try. Won’t be right away, like the laser stuff was, but I will get to it eventually and report back. Anyone else is welcome to try, too, of course.

Thanks again for applying your talents to make the MPCNC experience even better for everyone!

Karl

Hi Karl,
I just built a MPCNC and am struggling to learn the software and get the machine to run for testing and later
printing parts. I can’t find an instruction manual or someone that has step by step instructions. Do you have any suggestions on sources for operation and use of the MPCNC? I have the reprap screen set and can operate x y z axis but have not been able to send commands to the Arduino from my PC. Are you doing anything similar? Anyhelp would be appreciated.
Rand

Hi Rand,

Can you run gcode from an SD card? That’s the only way I do it. Plenty of folks on here who use a computer, though, so they might be able to help with that. I would suggest putting a gcode file on an SD card and see if you can run it from the LCD screen.

Ryan has a test file somewhere here on the website with his logo that you can try if you’re not sure if your gcode is well-formed.

I suggest you start your own thread in the getting started section - more people will see it and be able to help out. I’ll help however I can, but Ryan is really the expert - it’s his machine, after all!

Karl

I tried adding in the code in card reader.cpp, and it did work!

1 Like