From ee3de150ca036d16762c30532d43fb3aba9ce151 Mon Sep 17 00:00:00 2001 From: Asbelos Date: Mon, 30 Sep 2024 12:01:25 +0100 Subject: [PATCH] Railcom locoid --- Railcom.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Railcom.cpp b/Railcom.cpp index 31acee0..9b49a1f 100644 --- a/Railcom.cpp +++ b/Railcom.cpp @@ -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; @@ -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 }