{"action":"created","issue":{"url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/5259","repository_url":"https://api.github.com/repos/MarlinFirmware/Marlin","labels_url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/5259/labels{/name}","comments_url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/5259/comments","events_url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/5259/events","html_url":"https://github.com/MarlinFirmware/Marlin/pull/5259","id":190554926,"number":5259,"title":"Allow UART ISRs inside the stepper ISR","user":{"login":"Sebastianv650","id":10776877,"avatar_url":"https://avatars.githubusercontent.com/u/10776877?v=3","gravatar_id":"","url":"https://api.github.com/users/Sebastianv650","html_url":"https://github.com/Sebastianv650","followers_url":"https://api.github.com/users/Sebastianv650/followers","following_url":"https://api.github.com/users/Sebastianv650/following{/other_user}","gists_url":"https://api.github.com/users/Sebastianv650/gists{/gist_id}","starred_url":"https://api.github.com/users/Sebastianv650/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sebastianv650/subscriptions","organizations_url":"https://api.github.com/users/Sebastianv650/orgs","repos_url":"https://api.github.com/users/Sebastianv650/repos","events_url":"https://api.github.com/users/Sebastianv650/events{/privacy}","received_events_url":"https://api.github.com/users/Sebastianv650/received_events","type":"User","site_admin":false},"labels":[{"id":92052497,"url":"https://api.github.com/repos/MarlinFirmware/Marlin/labels/Improvement","name":"Improvement","color":"009800","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":25,"created_at":"2016-11-20T12:15:34Z","updated_at":"2016-12-02T05:16:29Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/MarlinFirmware/Marlin/pulls/5259","html_url":"https://github.com/MarlinFirmware/Marlin/pull/5259","diff_url":"https://github.com/MarlinFirmware/Marlin/pull/5259.diff","patch_url":"https://github.com/MarlinFirmware/Marlin/pull/5259.patch"},"body":"If the stepper ISR takes too long, chars are lost which leads to serial communication errors like \"Line number not +1\" or \"Wrong checksum\". In worst case, the printer can even do crazy moves.\r\n\r\nWith this change, UART interrupts are handled inside the stepper ISR. This way, no chars should be lost.\r\n\r\nIn reality, with this PR I can print at 250000baud with only few single errors during communication. Without it, printing at 250000baud is completely impossible for me. But in fact there are error messages, so the next step would be to find out what (maybe other ISRs) takes too long. The PR is also likely not disabling all ISRs of all possible features, for example servo probe things. Therefore see it as a draft so volunteers can test it and throw in their statements."},"comment":{"url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/comments/264375470","html_url":"https://github.com/MarlinFirmware/Marlin/pull/5259#issuecomment-264375470","issue_url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/5259","id":264375470,"user":{"login":"thinkyhead","id":698003,"avatar_url":"https://avatars.githubusercontent.com/u/698003?v=3","gravatar_id":"","url":"https://api.github.com/users/thinkyhead","html_url":"https://github.com/thinkyhead","followers_url":"https://api.github.com/users/thinkyhead/followers","following_url":"https://api.github.com/users/thinkyhead/following{/other_user}","gists_url":"https://api.github.com/users/thinkyhead/gists{/gist_id}","starred_url":"https://api.github.com/users/thinkyhead/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thinkyhead/subscriptions","organizations_url":"https://api.github.com/users/thinkyhead/orgs","repos_url":"https://api.github.com/users/thinkyhead/repos","events_url":"https://api.github.com/users/thinkyhead/events{/privacy}","received_events_url":"https://api.github.com/users/thinkyhead/received_events","type":"User","site_admin":false},"created_at":"2016-12-02T05:16:29Z","updated_at":"2016-12-02T05:16:29Z","body":"Maybe with something like this class…\r\n```cpp\r\n/**\r\n * Bresenham for a single value\r\n */\r\nclass Bresenham {\r\n  private:\r\n    long divisor, dividend, count[4], ticker, invocations;\r\n\r\n  public:\r\n\r\n    Bresenham() { Bresenham(1, 1, 0); }\r\n\r\n    Bresenham(const long &inDividend, const long &inDivisor, const long &inTicker=0) {\r\n      invocations = 0;\r\n      divisor = inDivisor;\r\n      dividend = inDividend;\r\n      count[0] = -((inDividend + 1) >> 1);\r\n      ticker = inTicker;\r\n    }\r\n\r\n    bool tick() {\r\n      invocations++;\r\n      count[0] += dividend;\r\n      bool over = (count[0] >= 0);\r\n      if (over) {\r\n        ticker++;\r\n        count[0] -= divisor;\r\n      }\r\n      report();\r\n      return over;\r\n    }\r\n\r\n    long operator++() {\r\n      tick();\r\n      return ticker;\r\n    }\r\n\r\n    void report() { cout << \"count[0]: \" << count[0] << \", ticker: \" << ticker << \" / \" << invocations << ENDL; }\r\n\r\n    // bool tick_adding<T>(T& var, T val=1) { if (tick()) var += val; }\r\n};\r\n```\r\nOnly does one element of the `count[]` array, but you get the idea."}}
{"actor":{"display_login":"thinkyhead"}}