{"action":"created","issue":{"url":"https://api.github.com/repos/gioblu/PJON/issues/106","repository_url":"https://api.github.com/repos/gioblu/PJON","labels_url":"https://api.github.com/repos/gioblu/PJON/issues/106/labels{/name}","comments_url":"https://api.github.com/repos/gioblu/PJON/issues/106/comments","events_url":"https://api.github.com/repos/gioblu/PJON/issues/106/events","html_url":"https://github.com/gioblu/PJON/issues/106","id":194391794,"number":106,"title":"Arduino reboots when packet delivery fails ","user":{"login":"elusive-code","id":6000411,"avatar_url":"https://avatars.githubusercontent.com/u/6000411?v=3","gravatar_id":"","url":"https://api.github.com/users/elusive-code","html_url":"https://github.com/elusive-code","followers_url":"https://api.github.com/users/elusive-code/followers","following_url":"https://api.github.com/users/elusive-code/following{/other_user}","gists_url":"https://api.github.com/users/elusive-code/gists{/gist_id}","starred_url":"https://api.github.com/users/elusive-code/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elusive-code/subscriptions","organizations_url":"https://api.github.com/users/elusive-code/orgs","repos_url":"https://api.github.com/users/elusive-code/repos","events_url":"https://api.github.com/users/elusive-code/events{/privacy}","received_events_url":"https://api.github.com/users/elusive-code/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-08T17:08:51Z","updated_at":"2016-12-08T20:28:49Z","closed_at":null,"body":"When MAX_ATTEMPTS reached arduino goes into reboot.\r\n\r\nIt looks like it happens because `_master_error` is never set, so when `error_handler` invokes it - null dereferenced and arduino goes down.\r\n\r\n(not sure if the same is valid for `PJONSlave`, but from the look of the code - it should be)\r\n\r\nApparently `PJONMaster `constructor invokes `set_error` of parent class `PJON`, which set it's own `_error ` field.\r\nWhile `set_error` method of `PJONMaster` sets `_master_error`, and is never invoked.\r\n\r\nI think separate error handler field in `PJONMaster` and `PJONSlave` is a unnecessary, it's probably better to make `_error` field protected, and invoke it.\r\n\r\nAnother thing I noticed that may cause trouble: `PJONMaster `and `PJONSlave `do not invoke `set_default` (as well as parent constructor)."},"comment":{"url":"https://api.github.com/repos/gioblu/PJON/issues/comments/265846402","html_url":"https://github.com/gioblu/PJON/issues/106#issuecomment-265846402","issue_url":"https://api.github.com/repos/gioblu/PJON/issues/106","id":265846402,"user":{"login":"gioblu","id":764497,"avatar_url":"https://avatars.githubusercontent.com/u/764497?v=3","gravatar_id":"","url":"https://api.github.com/users/gioblu","html_url":"https://github.com/gioblu","followers_url":"https://api.github.com/users/gioblu/followers","following_url":"https://api.github.com/users/gioblu/following{/other_user}","gists_url":"https://api.github.com/users/gioblu/gists{/gist_id}","starred_url":"https://api.github.com/users/gioblu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gioblu/subscriptions","organizations_url":"https://api.github.com/users/gioblu/orgs","repos_url":"https://api.github.com/users/gioblu/repos","events_url":"https://api.github.com/users/gioblu/events{/privacy}","received_events_url":"https://api.github.com/users/gioblu/received_events","type":"User","site_admin":false},"created_at":"2016-12-08T20:28:49Z","updated_at":"2016-12-08T20:28:49Z","body":"Ciao @elusive-code I have run a fast test without oscilloscope not having enough time to run an extended analysis. What I see is that:\r\n\r\n- on the slave's side the if 3000 millis forces the slave not to receive after 3 seconds and should be removed to do this test\r\n- that on both sides `receive` should be called passing a timeframe to higher the time dedicated to reception, because as it is proposed in the example, receive tries only once to get a packet.\r\n- defining the error function and passing it to `set_error` I can see prints so it seems to be called correctly\r\n- Looking at the master prints it seems it doesnt reset, because it keeps to print the older ids.\r\n- After error call the lost id seems effectively deleted because disappear from the list printed by master\r\n\r\nWhat it is not nominal, is that after error the slave for some reason is forced to drop its id and get a new one, creating a bad chain reaction :). So, I will get the code, some time and the oscilloscope and will debug this.\r\n\r\nI agree with you that the error is not the best implementation possible (consider that those two classes are experimental and for this reason still not documented), feel free to propose a better solution! "}}
{"actor":{"display_login":"gioblu"}}