MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.3k stars 19.24k forks source link

Marlin 2.0.6 autostart not working properly #19296

Closed 3dseawa closed 3 years ago

3dseawa commented 4 years ago

Bug Description

Marlin 2.0.6 autostart not working properly. I have three files sliced in Simply3D and renamed to auto0.g, auto1.g, auto2.g. When each file is named auto0.g and is the only file on the SD card each will autostart upon power boot-up. When auto0.g and auto1.g is on the card the auto1.g will autostart and print but not auto0.g. When auto0.g, auto1.g, auto2.g are on the SD card nothing happens. I have tried each of the files in different combinations with the same results.
When the same three files are on one SD card and put into my Ender3 Pro the auto0.g will execute but the other two do not.

The above leads me to believe this is a bug. If it is a configuration or file setting issue, please let me know the proper configuration or file settings.

I am do not have a LCD connected, nor is the USB connected to a computer – just the motherboard so printing directly from the micro-SD card reader on the mother board.

I have a custom-built machine using Marlin 2.0.6, download on 9/6/2020, on a BigTree Tech SKR 1.4 Turbo with TMC2209 drivers and sensorless homing. These are the setting in Configuration_adv.h folder: (lines 1145 and 1147)

define SD_MENU_CONFIRM_START // Confirm the selected SD file before printing

define MENU_ADDAUTOSTART // Add a menu option to run auto#.g files

No changes have been made to any .cpp files. I have read others are having the same issue with auto1.g executing but not auto0.g. Thank you in advance for helping identifying and resolving this issue for myself and other.

My Configurations

Required: Please include a ZIP file containing your Configuration.h and Configuration_adv.h files.

Attached are the configuration.h and configuration_adv.h zipped files: Configuration.zip Configuration_adv.zip

Steps to Reproduce

  1. save three sliced .gcobe files and rename as auto0.g, auto1.g, auto2.g,
  2. load onto sd card reader on motherboard while disconnected from LCD and computer
  3. power on machine and note what happens.

Expected behavior: [What you expect to happen] upon power bootup auto0.g should print, then auto1.g should print automatically, then auto2.g should print - up to auto9.g.

Attached are the configuration.h and configuration_adv.h zipped files: Configuration.zip Configuration_adv.zip

Actual behavior: [What actually happens] See above for what happens and what has been tried.

Additional Information

thomas374b commented 4 years ago

Enable SDCARD_SORT_ALPHA in Configuration_adv.h and tried to play with optional defines around there.

This may solve your problem with starting auto1.g instead of auto0.g since files are usually unsorted written to the card

thomas374b commented 4 years ago

If you have defined SD_MENU_CONFIRM_START

you must press a button on the LCD in order to start printing. If you have no LCD this code will never be reached.

3dseawa commented 4 years ago

Thank you thomas374b for you input. I commented with // for SD_MENU_CONFIRM_START I also uncommented (deleted the //) SDCARD_SORT_ALPHA Sadly after trying several tests , I got the same results as before - auto1.g executes but not auto0.g when those two files are on the SD card. When auto0.g, auto1.g and auto2.g are all on the SD card then nothing executes. auto0.g will execute when it is the only file on the card.

AnHardt commented 4 years ago

The riddle has likely to be solved here or in the initialization of autostart_index. At the moment i can't find a obvious problem - but i currently don't understand every part of the code properly.

boelle commented 4 years ago

@3dseawa please check what @AnHardt said about https://github.com/MarlinFirmware/Marlin/blob/9ade72aee94981b26be0ca125ab487166d0bd7e3/Marlin/src/sd/cardreader.cpp#L676-L699

also Please test the bugfix-2.0.x branch to see where it stands.

3dseawa commented 4 years ago

Thank you AnHardt and Bo, I looked at the code and it is beyond my limited coding knowledge. It matches what I am using which is Marlin 2.0.6 Bugfix downloaded 9/6/2020.

On Thu, Sep 10, 2020 at 1:50 PM Bo Herrmannsen notifications@github.com wrote:

@3dseawa https://github.com/3dseawa please check what @AnHardt https://github.com/AnHardt said about https://github.com/MarlinFirmware/Marlin/blob/9ade72aee94981b26be0ca125ab487166d0bd7e3/Marlin/src/sd/cardreader.cpp#L676-L699

also Please test the bugfix-2.0.x branch https://github.com/MarlinFirmware/Marlin/tree/bugfix-2.0.x to see where it stands.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MarlinFirmware/Marlin/issues/19296#issuecomment-690720014, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ4THCLBNX3LP545GLK2A6TSFE32LANCNFSM4Q6YLQBQ .

3dseawa commented 4 years ago

I tested the autostart feature with the bugfix-2.0.downloaded today 9/11/20 branch based on the link provided by Scott - thank you Scott. I encountered the same issues. As a reminder, I am printing directly from the SD card on the Bigtree Tech SKR V1.4 board with TMC2209 drivers with sensorless homing. I do not have an LCD or computer connected. When auto0.g is the only file on the SD card it will execute. When an auto0.g file is on the SD card with .gco files auto0.g will execute. When auto0.g and auto1.g are on the SD card the auto1.g only executes. When auto0.g, auto1.g, and auto2.g are on the SD card nothing executes. I test each of the three files as auto0.g and as auto1.g with the same results. Attached are the configuration.h and configuration_adv.h along with the three very simple .g files I am testing. I have also tested actual 3D printable files sliced in Simplfy3D with the same results.

This problem is beyond by coding skills so I appreciate all of your help and support resolving this issue for our community.

On Fri, Sep 11, 2020 at 12:35 AM Scott Lahteine notifications@github.com wrote:

Please test the bugfix-2.0.x branch https://github.com/MarlinFirmware/Marlin/archive/bugfix-2.0.x.zip to see where it stands. If the problem has been resolved then we can close this issue. If the issue isn't resolved yet, then we should investigate further.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MarlinFirmware/Marlin/issues/19296#issuecomment-690929638, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ4THCL4MOBYZR2TQKREFUTSFHHKRANCNFSM4Q6YLQBQ .

qwewer0 commented 4 years ago

Here is what is happens for me:

auto0.g content ``` G28 ```
auto1.g content ``` G28 M300 S2000 P5 ```
auto2.g content ``` G28 M300 S2000 P5 G4 P50 M300 S2000 P15 ```

Here are the files: auto.zip

Using the latest Bugfix-2.0.x Configuration.zip

github-actions[bot] commented 4 years ago

This issue has had no activity in the last 30 days. Please add a reply if you want to keep this issue active, otherwise it will be automatically closed within 7 days.

qwewer0 commented 4 years ago

Tested https://github.com/MarlinFirmware/Marlin/issues/19296#issuecomment-691283976 on the latest Bugfix-2.0.x, and the results are still the same.

3dseawa commented 4 years ago

It looks like there is a bug with the Autostart feature and it is beyond my knowledge and skill set to fix. I did find a workaround by only having auto0.g on my SD card (no other auto1.g, auto2.g, et.c. files) then using g-code M32 as the last line of the auto0.g g-code file and naming the next file to start within the M32 command. Then using M32 command in the second file by putting the M32 command as the last g-code line in that file's g-code and naming it the third file to start, and so on up to seven additional file. My setup will only allow for a total of 8 files on the SD card for the auot0.g to execute. More than 8 files and auot0.g does not execute. Not sure why it is limited to 8 files for the auto0.g to execute.

A few key points about the M32 command: 1) the file name can be a maximum of 8 characters and the file type can only be 3 letters long -'filename.gco'. 2) the character ! has to directly precede the file name and # must end the file name e.g. M32 !filename.gco# 3) if you want to create a loop where the auto0.g will start after the last file then use the M32 command in the last line of the last file and name it: M32 !auto0.g# and it will execute the auto0.g file again and restart the series of files. https://marlinfw.org/docs/gcode/M032.html Thanks you to all who contributed to this issue. I appreciate your efforts.

Zumili commented 4 years ago

Hey guys, just found some possible solution. Just change this line: https://github.com/MarlinFirmware/Marlin/blob/2.0.x/Marlin/src/sd/cardreader.cpp#L708 from if (autostart_index < 0 || flag.sdprinting) return; to if (autostart_index < 0 || flag.sdprinting || queue.has_commands_queued()) return; on line 708 in cardreader.cpp

Why the problem occurs: In MarlinCore.cpp card.checkautostart(); gets called very often in the main loop. In checkautostart(); flag.sdprinting is used to check if printing is active. The filename is created and openAndPrintFile(autoname); gets called with that filename. In openAndPrintFile(); gcode commands M23 and M24 will be created and added to the queue. Now the loop repeats but the parser may or may not ( and here is the problem ) has parsed the data from the queue. So the flag.sdprinting is probably still false. With queue.has_commands_queued() it will ensure that the next M23 M24 commands only added to queue when it is empty after the print is finished.

qwewer0 commented 4 years ago

Tested https://github.com/MarlinFirmware/Marlin/issues/19296#issuecomment-691283976 on the latest Bugfix-2.0.x with @Zumili fix https://github.com/MarlinFirmware/Marlin/issues/19296#issuecomment-723446341, and it seems to fixed the issue. Here is what is happens for me:

So it works, and now it shows the right *.g file that is running.

@Zumili You should create a PR with that fix, or you could let me do it.

Zumili commented 4 years ago

qwewer0 I am not very familiar with github and I don't want to break the universe :) , so it will be nice if you can do it.

boelle commented 4 years ago

@3dseawa remember to close this one when the above PR is merged (it goes purple color)

thinkyhead commented 4 years ago

I've put together a comprehensive patch at #20071. Please test to confirm that those changes work for you.

3dseawa commented 4 years ago

Thank you. I will try to tested it the first part of the week.

On Sat, Nov 7, 2020, 8:33 PM Scott Lahteine notifications@github.com wrote:

I've put together a comprehensive patch at #20071 https://github.com/MarlinFirmware/Marlin/pull/20071. Please test to confirm that those changes work for you.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MarlinFirmware/Marlin/issues/19296#issuecomment-723529349, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ4THCPEJMB4MV4XZBRJPQTSOYNPZANCNFSM4Q6YLQBQ .

boelle commented 3 years ago

@3dseawa did you get time to test?

3dseawa commented 3 years ago

No, sadly I had a home issue to repair which captivated my time.

On Sat, Nov 21, 2020, 4:58 PM Bo Herrmannsen notifications@github.com wrote:

@3dseawa https://github.com/3dseawa did you get time to test?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MarlinFirmware/Marlin/issues/19296#issuecomment-731660100, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ4THCOLJUC7NYUT3XVUIRTSRBO4TANCNFSM4Q6YLQBQ .

3dseawa commented 3 years ago

Firsty, thank you to all who have worked on this issue. To test this complete fix/ comprehensive patch, I am assuming I clink on the "20071" link from Scott Latheine dated 11/7 above then click on the ' MarlinFirmware:bugfix-2.0.x https://github.com/MarlinFirmware/Marlin/tree/bugfix-2.0.x ' link just below the title tile of the 20071 link and then download that version in that link and use that for my test as the referenced MarlinFirmware: bugfix-2.0.x https://github.com/MarlinFirmware/Marlin/tree/bugfix-2.0.x has the fixes incorporated into that download?

Please let me know if this is correct or if there is something else I need to do. I should have my house put back together today and hope to work on it this afternoon or evening.

On Sat, Nov 21, 2020 at 5:32 PM Sea Wa 3dseawa@gmail.com wrote:

No, sadly I had a home issue to repair which captivated my time.

On Sat, Nov 21, 2020, 4:58 PM Bo Herrmannsen notifications@github.com wrote:

@3dseawa https://github.com/3dseawa did you get time to test?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MarlinFirmware/Marlin/issues/19296#issuecomment-731660100, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ4THCOLJUC7NYUT3XVUIRTSRBO4TANCNFSM4Q6YLQBQ .

qwewer0 commented 3 years ago

@thinkyhead Thank you for the AutoStart refractory!

On the latest bugfix-2.0.x (with https://github.com/MarlinFirmware/Marlin/pull/20071) Configuration.zip

Here is what is happens:

With or without auto#.g files, a started print job stays in printing mode. With NO_SD_AUTOSTART enabled, there is no print job issue.

3dseawa commented 3 years ago

Thank you.

On Mon, Dec 7, 2020, 4:59 AM qwewer0 notifications@github.com wrote:

@thinkyhead https://github.com/thinkyhead Thank you for the AutoStart refractory!

On the latest bugfix-2.0.x (with #20071 https://github.com/MarlinFirmware/Marlin/pull/20071) Configuration.zip https://github.com/MarlinFirmware/Marlin/files/5652546/Configuration.zip

Here is what is happens:

  • auto0.g: Printer starts -> (LCD shows AUTO0.G) auto0.g runs -> Steppers stays engaged -> Printer is stuck in printing mode -> After print is aborted other print jobs can be started
  • auto0.g and auto1.g: Printer starts -> (LCD shows AUTO0.G) auto0.g runs -> Steppers gets disabled -> (LCD shows AUTO1.G) auto1.g runs -> Steppers stays engaged -> Printer is stuck in printing mode -> After print is aborted other print jobs can be started
  • auto0.g, auto1.g and auto2.g: Printer starts -> (LCD shows AUTO0.G) auto0.g runs -> Steppers gets disabled -> (LCD shows AUTO1.G) auto1.g runs ->Steppers gets disabled -> (LCD shows AUTO2.G) auto2.g runs -> Steppers stays engaged -> Printer is stuck in printing mode -> After print is aborted other print jobs can be started

With or without auto#.g files, a started print job stays in printing mode. With NO_SD_AUTOSTART disabled, there is no print job issue.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MarlinFirmware/Marlin/issues/19296#issuecomment-739902691, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ4THCPFL7N3HPP7IULFWJDSTTGSFANCNFSM4Q6YLQBQ .

qwewer0 commented 3 years ago

@3dseawa Were you able to try it?

3dseawa commented 3 years ago

Not yet. My board died and replacement is on its way.

On Tue, Dec 8, 2020, 12:57 AM qwewer0 notifications@github.com wrote:

@3dseawa https://github.com/3dseawa Were you able to try it?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MarlinFirmware/Marlin/issues/19296#issuecomment-740482024, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ4THCLGCFODF3X63XBZIFLSTXS7BANCNFSM4Q6YLQBQ .

3dseawa commented 3 years ago

For some reason my g-code program stops a few lines from the end of the program so it does not advance to the next program. This has me stumped. I will keep you posted what I find out.

On Tue, Dec 8, 2020, 7:43 AM Sea Wa 3dseawa@gmail.com wrote:

Not yet. My board died and replacement is on its way.

On Tue, Dec 8, 2020, 12:57 AM qwewer0 notifications@github.com wrote:

@3dseawa https://github.com/3dseawa Were you able to try it?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MarlinFirmware/Marlin/issues/19296#issuecomment-740482024, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ4THCLGCFODF3X63XBZIFLSTXS7BANCNFSM4Q6YLQBQ .

HarpoDog commented 3 years ago

I am please to confirm that the autostart feature is now working as designed. Thank you to the entire team that resolved this issue. You are truly appreciated!

3dseawa commented 3 years ago

Yes, Thank you to all that resolved this issue. Mine is now working and your efforts are appreciated.

On Wed, Feb 10, 2021 at 4:58 PM HarpoDog notifications@github.com wrote:

I am please to confirm that the autostart feature is now working as designed. Thank you to the entire team that resolved this issue. You are truly appreciated!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MarlinFirmware/Marlin/issues/19296#issuecomment-777142165, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ4THCJPKUYAITFIWIDUE2LS6MTRXANCNFSM4Q6YLQBQ .

github-actions[bot] commented 3 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.