mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-26 17:46:14 +01:00
Correct high bit long addr
This commit is contained in:
parent
a849dddc9c
commit
d25173e0b4
|
@ -187,15 +187,13 @@ void Railcom::process(uint8_t * inbound, uint8_t length) {
|
||||||
haveLow=true;
|
haveLow=true;
|
||||||
packetsWithNoData=0;
|
packetsWithNoData=0;
|
||||||
}
|
}
|
||||||
else if (type==RMOB_EXT) {
|
|
||||||
return; /* ignore*/
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
// channel1 is unreadable so maybe multiple locos in block
|
// channel1 is unreadable or not loco address so maybe multiple locos in block
|
||||||
if (length>2 && GETHIGHFLASH(decode,inbound[0])!=INV) {
|
if (length>2 && GETHIGHFLASH(decode,inbound[0])!=INV) {
|
||||||
// it looks like we have channel2 data
|
// it looks like we have channel2 data
|
||||||
auto thisLoco=DCCWaveform::getRailcomLastLocoAddress();
|
auto thisLoco=DCCWaveform::getRailcomLastLocoAddress();
|
||||||
if (Diag::RAILCOM) DIAG(F("c2=%d"),thisLoco);
|
if (Diag::RAILCOM) DIAG(F("c2=%d"),thisLoco);
|
||||||
|
if (thisLoco==lastChannel1Loco) return;
|
||||||
if (thisLoco) DCC::setLocoInBlock(thisLoco,vpin,false); // this loco is in block, but not exclusive
|
if (thisLoco) DCC::setLocoInBlock(thisLoco,vpin,false); // this loco is in block, but not exclusive
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -204,9 +202,10 @@ void Railcom::process(uint8_t * inbound, uint8_t length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (haveHigh && haveLow) {
|
if (haveHigh && haveLow) {
|
||||||
uint16_t thisLoco=((holdoverHigh<<8)| holdoverLow);
|
uint16_t thisLoco=((holdoverHigh<<8)| holdoverLow) & 0x7FFF; // drop top bit
|
||||||
if (thisLoco!=lastChannel1Loco) {
|
if (thisLoco!=lastChannel1Loco) {
|
||||||
// the exclusive DCC call is quite expensive, we dont want to call it every packet
|
// the exclusive DCC call is quite expensive, we dont want to call it every packet
|
||||||
|
if (Diag::RAILCOM) DIAG(F("h=%x l=%xc1=%d"),holdoverHigh, holdoverLow,thisLoco);
|
||||||
DCC::setLocoInBlock(thisLoco,vpin,true); // only this loco is in block
|
DCC::setLocoInBlock(thisLoco,vpin,true); // only this loco is in block
|
||||||
lastChannel1Loco=thisLoco;
|
lastChannel1Loco=thisLoco;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user