PJONMaster - Arduino reboots when packet delivery fails #106
Comments
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:
What 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 :). Maybe was this behaviour forcing to think about a reset? So, I will get the code, some time and the oscilloscope and will debug this. I 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! |
Hi, @gioblu, sorry, I wasn't clear in the report.
It looks that same should be valid for PJONSlave: Here is a code I used to configure master:
|
@elusive-code thank you for your analysis I will dedicate some time today to fix this, and to hopefully provide with a fix for tomorrow! |
CIao @elusive-code thank you for your report. |
@elusive-code will close here considering fixed. |
When MAX_ATTEMPTS reached arduino goes into reboot.
It looks like it happens because
_master_error
is never set, so whenerror_handler
invokes it - null dereferenced and arduino goes down.(not sure if the same is valid for
PJONSlave
, but from the look of the code - it should be)Apparently
PJONMaster
constructor invokesset_error
of parent classPJON
, which set it's own_error
field.While
set_error
method ofPJONMaster
sets_master_error
, and is never invoked.I think separate error handler field in
PJONMaster
andPJONSlave
is a unnecessary, it's probably better to make_error
field protected, and invoke it.Another thing I noticed that may cause trouble:
PJONMaster
andPJONSlave
do not invokeset_default
(as well as parent constructor).The text was updated successfully, but these errors were encountered: