I hope Rob reads this message.
Unless I am misunderstanding something – apologies on that case - I have found a bug on the rocnet library, at rocnet.c. It seems the protocol code is not correctly parsed:
The following piece of code will never return RN_MOBILE_PROT_DCC14 but RN_MOBILE_PROT_DCC28 – after the first “if”, the second “if” will overwrite the “prot” definition for spcnt<28.
Code: Select all
static byte __getProtocol(iONode loc) {
byte prot = 0;
if( StrOp.equals( wLoc.getprot(loc), wLoc.prot_N ) || StrOp.equals( wLoc.getprot(loc), wLoc.prot_L ) || StrOp.equals( wLoc.getprot(loc), wLoc.prot_P ) ) {
if( wLoc.getspcnt(loc) < 28 )
prot = RN_MOBILE_PROT_DCC14;
if( wLoc.getspcnt(loc) > 28 )
prot = RN_MOBILE_PROT_DCC128;
else
prot = RN_MOBILE_PROT_DCC28;
}
else if( StrOp.equals( wLoc.getprot(loc), wLoc.prot_M ) ) {
prot = RN_MOBILE_PROT_MM;
}
return prot;
}
I realise about this issue because, following Rob suggestion, I am trying to make my rpic solution compliant with a protocol already supported by rocrail, like rocnet.
In this context I would also appreciate if the MM protocol code is provided as explained in the wiki – potentially correcting also the repeated code of 3 for MM1 and DCC14. I really need to differentiate at least between MM1 and MM2.
A potential solution would be to actually start MM definition in code number 4 for MM1 and use as simple rule as this:
Code: Select all
else if( StrOp.equals( wLoc.getprot(loc), wLoc.prot_M ) ) {
prot = RN_MOBILE_PROT_MM+wLoc.getprotver(loc)-1;
}
Thanks in advance – as usual – for the support,
Manolo