1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2025-07-28 09:53:45 +02:00

Emergency stop in JMRI and WiThrottle

JMRI -1 means speed=1 in DCC
This commit is contained in:
Asbelos
2020-07-23 15:41:43 +01:00
parent 7eae489b9e
commit a915331103
3 changed files with 14 additions and 6 deletions

View File

@@ -47,7 +47,7 @@ void DCC::begin() {
}
void DCC::setThrottle( uint16_t cab, uint8_t tSpeed, bool tDirection) {
byte speedCode = tSpeed + (tSpeed > 0) + tDirection * 128; // max speed is 126, but speed codes range from 2-127 (0=stop, 1=emergency stop)
byte speedCode = (tSpeed & 0x7F) + tDirection * 128; //speed codes range from 2-127 (0=stop, 1=emergency stop)
setThrottle2(cab, speedCode);
// retain speed for loco reminders
updateLocoReminder(cab, speedCode );