mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-22 23:56:13 +01:00
Railcom locoid
This commit is contained in:
parent
29e9b8cef5
commit
ee3de150ca
|
@ -135,6 +135,10 @@ Railcom::Railcom() {
|
||||||
haveLow=false;
|
haveLow=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* returns -1: Call again next packet
|
||||||
|
0: No loco on track
|
||||||
|
>0: loco id
|
||||||
|
*/
|
||||||
int16_t Railcom::getChannel1Loco(uint8_t * inbound) {
|
int16_t Railcom::getChannel1Loco(uint8_t * inbound) {
|
||||||
auto v1=GETHIGHFLASH(decode,inbound[0]);
|
auto v1=GETHIGHFLASH(decode,inbound[0]);
|
||||||
if (v1>MAX_VALID) return -1;
|
if (v1>MAX_VALID) return -1;
|
||||||
|
@ -153,12 +157,13 @@ int16_t Railcom::getChannel1Loco(uint8_t * inbound) {
|
||||||
haveLow=true;
|
haveLow=true;
|
||||||
}
|
}
|
||||||
else if (type==RMOB_EXT) {
|
else if (type==RMOB_EXT) {
|
||||||
/* ignore*/
|
return -1; /* ignore*/
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
haveHigh=false;
|
haveHigh=false;
|
||||||
haveLow=false;
|
haveLow=false;
|
||||||
|
return 0; // treat as no loco
|
||||||
}
|
}
|
||||||
if (haveHigh && haveLow) return ((holdoverHigh<<8)| holdoverLow);
|
if (haveHigh && haveLow) return ((holdoverHigh<<8)| holdoverLow);
|
||||||
return -1; // no loco info available
|
return -1; // call again, need next packet
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user