Skip to content

Commit

Permalink
Railcom locoid
Browse files Browse the repository at this point in the history
  • Loading branch information
Asbelos committed Sep 30, 2024
1 parent 29e9b8c commit ee3de15
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Railcom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ Railcom::Railcom() {
haveLow=false;
}

/* returns -1: Call again next packet
0: No loco on track
>0: loco id
*/
int16_t Railcom::getChannel1Loco(uint8_t * inbound) {
auto v1=GETHIGHFLASH(decode,inbound[0]);
if (v1>MAX_VALID) return -1;
Expand All @@ -153,12 +157,13 @@ int16_t Railcom::getChannel1Loco(uint8_t * inbound) {
haveLow=true;
}
else if (type==RMOB_EXT) {
/* ignore*/
return -1; /* ignore*/
}
else {
haveHigh=false;
haveLow=false;
return 0; // treat as no loco
}
if (haveHigh && haveLow) return ((holdoverHigh<<8)| holdoverLow);
return -1; // no loco info available
return -1; // call again, need next packet
}

0 comments on commit ee3de15

Please sign in to comment.