Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function "get_sdcard_commands" will cause wdt reset when print sdcard file #7449

Closed
MS1987 opened this issue Aug 7, 2017 · 6 comments
Closed

Comments

@MS1987
Copy link
Contributor

MS1987 commented Aug 7, 2017


Bug Report

  • Description: ---
    When I print a gcode file (from sdcard) which has plenty of comment lines continuously, it causes the board reset.

  • Analasy: ---
    As the watchdog was enabled, in the function "get_sdcard_commands()" there is code as following:
    if (!sd_count) continue; // skip empty lines (and comment lines)
    This "continue" will cause long time in the get command loop when the gcode file has enougth comment lines to consume.

  • Solve: ---
    Replace the "continue" above with "return"

  • reproduce:
    Use the gcode file to test.

test.zip


@iosonopersia
Copy link

Hi @MS1987

Replace the "continue" above with "return"

I suggest to edit code as follows:

  // skip empty lines (and comment lines)
  if (!sd_count) {
      #if ENABLED(USE_WATCHDOG)
          watchdog_reset();
      #endif
      continue;
  }

Do you think this would work?

@MS1987
Copy link
Contributor Author

MS1987 commented Aug 8, 2017 via email

@iosonopersia
Copy link

iosonopersia commented Aug 12, 2017

Hi @MS1987,
I thought about it and I think your approach would be better than mine. We should prepare a PR for that.

That behaviour should be used both in get_sdcard_commands() and in get_serial_commands().

I add that in those functions, the cycle continues also if MAX_CMD_SIZE is reached. If that happens, those functions continue to read chars until they find a \n or a \r char. So if someone sends a very long string without \n and \r, the printer will also get stuck for a while, until those EOL characters are found. I'm wondering if we could exit the cycle in that case too.

@thinkyhead
Copy link
Member

Patch will be merged shortly.

@thinkyhead
Copy link
Member

if someone sends a very long string without \n and \r, the printer will also get stuck for a while

Less worried about this.

thinkyhead added a commit to thinkyhead/Marlin that referenced this issue Feb 9, 2018
thinkyhead added a commit that referenced this issue Sep 22, 2018
@github-actions
Copy link

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.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants