1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-23 08:06:13 +01:00

correct logic in setLocoId

This commit is contained in:
Harald Barth 2021-01-30 22:53:05 +01:00
parent f646f12c65
commit 0b3e904ffb

12
DCC.cpp
View File

@ -480,10 +480,14 @@ void DCC::getLocoId(ACK_CALLBACK callback, bool blocking) {
} }
void DCC::setLocoId(int id,ACK_CALLBACK callback, bool blocking) { void DCC::setLocoId(int id,ACK_CALLBACK callback, bool blocking) {
if (id<=0 || id>9999) callback(-1); if (id<1 || id>10239) { //0x27FF according to standard
int wordval; callback(-1);
if (id<=127) ackManagerSetup(id,SHORT_LOCO_ID_PROG, callback, blocking); return;
else ackManagerSetup(id | 0xc000,LONG_LOCO_ID_PROG, callback, blocking); }
if (id<=127)
ackManagerSetup(id, SHORT_LOCO_ID_PROG, callback, blocking);
else
ackManagerSetup(id | 0xc000,LONG_LOCO_ID_PROG, callback, blocking);
} }
void DCC::forgetLoco(int cab) { // removes any speed reminders for this loco void DCC::forgetLoco(int cab) { // removes any speed reminders for this loco