{"action":"created","issue":{"url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/3962","repository_url":"https://api.github.com/repos/MarlinFirmware/Marlin","labels_url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/3962/labels{/name}","comments_url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/3962/comments","events_url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/3962/events","html_url":"https://github.com/MarlinFirmware/Marlin/pull/3962","id":158522337,"number":3962,"title":"New feature: Non blocking tone queue","user":{"login":"jbrazio","id":264365,"avatar_url":"https://avatars.githubusercontent.com/u/264365?v=3","gravatar_id":"","url":"https://api.github.com/users/jbrazio","html_url":"https://github.com/jbrazio","followers_url":"https://api.github.com/users/jbrazio/followers","following_url":"https://api.github.com/users/jbrazio/following{/other_user}","gists_url":"https://api.github.com/users/jbrazio/gists{/gist_id}","starred_url":"https://api.github.com/users/jbrazio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbrazio/subscriptions","organizations_url":"https://api.github.com/users/jbrazio/orgs","repos_url":"https://api.github.com/users/jbrazio/repos","events_url":"https://api.github.com/users/jbrazio/events{/privacy}","received_events_url":"https://api.github.com/users/jbrazio/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/MarlinFirmware/Marlin/labels/Bug:%20Verified%20!","name":"Bug: Verified !","color":"e11d21"},{"url":"https://api.github.com/repos/MarlinFirmware/Marlin/labels/PR:%20Bugfix","name":"PR: Bugfix","color":"bfe5bf"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/MarlinFirmware/Marlin/milestones/53","html_url":"https://github.com/MarlinFirmware/Marlin/milestones/1.1.0","labels_url":"https://api.github.com/repos/MarlinFirmware/Marlin/milestones/53/labels","id":1726554,"number":53,"title":"1.1.0","description":"","creator":{"login":"jbrazio","id":264365,"avatar_url":"https://avatars.githubusercontent.com/u/264365?v=3","gravatar_id":"","url":"https://api.github.com/users/jbrazio","html_url":"https://github.com/jbrazio","followers_url":"https://api.github.com/users/jbrazio/followers","following_url":"https://api.github.com/users/jbrazio/following{/other_user}","gists_url":"https://api.github.com/users/jbrazio/gists{/gist_id}","starred_url":"https://api.github.com/users/jbrazio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbrazio/subscriptions","organizations_url":"https://api.github.com/users/jbrazio/orgs","repos_url":"https://api.github.com/users/jbrazio/repos","events_url":"https://api.github.com/users/jbrazio/events{/privacy}","received_events_url":"https://api.github.com/users/jbrazio/received_events","type":"User","site_admin":false},"open_issues":21,"closed_issues":99,"state":"open","created_at":"2016-04-23T11:44:07Z","updated_at":"2016-06-04T22:23:17Z","due_on":"2016-06-15T07:00:00Z","closed_at":null},"comments":9,"created_at":"2016-06-04T20:23:39Z","updated_at":"2016-06-05T02:10:33Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/MarlinFirmware/Marlin/pulls/3962","html_url":"https://github.com/MarlinFirmware/Marlin/pull/3962","diff_url":"https://github.com/MarlinFirmware/Marlin/pull/3962.diff","patch_url":"https://github.com/MarlinFirmware/Marlin/pull/3962.patch"},"body":"This PR fixes #3913 by rewriting from scratch the existing `buzzer.cpp` to be non-blocking, introducing a tone queue. The length of the tone queue is set at `buzzer.h` with a default of `#define TONE_QUEUE_LENGTH 8`, I haven't added it to any of the `Configuration.h` files because I don't believe it will require to be changed for standard Marlin operation, in fact we could even lower the default to `4`.\r\n\r\nOf course if you want to play the **Imperial March** I advise you to `#define TONE_QUEUE_LENGTH 35` and use the following G-Code as a macro on Pronterface. You will require a `SPEAKER` and not a `BUZZER`.\r\n\r\n```gcode\r\nM300 P300 S220\r\nM300 P301 S0\r\nM300 P300 S220\r\nM300 P301 S0\r\nM300 P300 S220\r\nM300 P301 S0\r\nM300 P225 S174\r\nM300 P226 S0\r\nM300 P75 S261\r\nM300 P76 S0\r\n\r\nM300 P300 S220\r\nM300 P301 S0\r\nM300 P225 S174\r\nM300 P226 S0\r\nM300 P75 S261\r\nM300 P76 S0\r\nM300 P600 S220\r\nM300 P601 S0\r\n\r\nM300 P300 S329\r\nM300 P301 S0\r\nM300 P300 S329\r\nM300 P301 S0\r\nM300 P300 S329\r\nM300 P301 S0\r\nM300 P225 S349\r\nM300 P226 S0\r\nM300 P75 S261\r\nM300 P76 S0\r\n\r\nM300 P300 S207\r\nM300 P301 S0\r\nM300 P225 S174\r\nM300 P226 S0\r\nM300 P75 S261\r\nM300 P76 S0\r\nM300 P600 S220\r\nM300 P601 S0\r\n```\r\n\r\nThe timing is a bit \"wavy\" due to the low priority and non periodic call to `tick()`, this is specially noticeable on the higher pitch notes which have a smaller period thus require more precise timing.\r\n\r\nThere is a \"untouched\" feature of the old `buzzer.cpp` which is `LCD_USE_I2C_BUZZER`, I don't have hardware to test it and from my research the `buzzer()` is delegated into the `LCD` object defined by `LiquidCrystal_I2C.h` -- Please comment bellow if you have more information about this topic."},"comment":{"url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/comments/223788883","html_url":"https://github.com/MarlinFirmware/Marlin/pull/3962#issuecomment-223788883","issue_url":"https://api.github.com/repos/MarlinFirmware/Marlin/issues/3962","id":223788883,"user":{"login":"jbrazio","id":264365,"avatar_url":"https://avatars.githubusercontent.com/u/264365?v=3","gravatar_id":"","url":"https://api.github.com/users/jbrazio","html_url":"https://github.com/jbrazio","followers_url":"https://api.github.com/users/jbrazio/followers","following_url":"https://api.github.com/users/jbrazio/following{/other_user}","gists_url":"https://api.github.com/users/jbrazio/gists{/gist_id}","starred_url":"https://api.github.com/users/jbrazio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbrazio/subscriptions","organizations_url":"https://api.github.com/users/jbrazio/orgs","repos_url":"https://api.github.com/users/jbrazio/repos","events_url":"https://api.github.com/users/jbrazio/events{/privacy}","received_events_url":"https://api.github.com/users/jbrazio/received_events","type":"User","site_admin":false},"created_at":"2016-06-05T02:10:33Z","updated_at":"2016-06-05T02:10:33Z","body":"Or I could call `this->tick()`."}}
{"actor":{"display_login":"jbrazio"}}