mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2025-01-11 21:31:02 +01:00
Ptevent accidental broadcast throttles
This commit is contained in:
parent
1e61c2cd61
commit
3a6e41ac49
11
RMFT2.cpp
11
RMFT2.cpp
@ -286,11 +286,10 @@ int RMFT2::locateRouteStart(int16_t _route) {
|
|||||||
|
|
||||||
|
|
||||||
void RMFT2::driveLoco(byte speed) {
|
void RMFT2::driveLoco(byte speed) {
|
||||||
if (loco<0) return; // Caution, allows broadcast!
|
if (loco<=0) return; // Prevent broadcast!
|
||||||
if (diag) DIAG(F("EXRAIL drive %d %d %d"),loco,speed,forward^invert);
|
if (diag) DIAG(F("EXRAIL drive %d %d %d"),loco,speed,forward^invert);
|
||||||
DCC::setThrottle(loco,speed, forward^invert);
|
DCC::setThrottle(loco,speed, forward^invert);
|
||||||
speedo=speed;
|
speedo=speed;
|
||||||
// TODO... if broadcast speed 0 then pause all other tasks.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RMFT2::readSensor(int16_t sensorId) {
|
bool RMFT2::readSensor(int16_t sensorId) {
|
||||||
@ -431,9 +430,7 @@ void RMFT2::loop2() {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case OPCODE_POM:
|
case OPCODE_POM:
|
||||||
if (loco!=0) {
|
if (loco) DCC::writeCVByteMain(loco, operand, GET_OPERAND(1));
|
||||||
DCC::writeCVByteMain(loco, operand, GET_OPERAND(1));
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPCODE_RESUME:
|
case OPCODE_RESUME:
|
||||||
@ -487,11 +484,11 @@ void RMFT2::loop2() {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case OPCODE_FON:
|
case OPCODE_FON:
|
||||||
DCC::setFn(loco,operand,true);
|
if (loco) DCC::setFn(loco,operand,true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPCODE_FOFF:
|
case OPCODE_FOFF:
|
||||||
DCC::setFn(loco,operand,false);
|
if (loco) DCC::setFn(loco,operand,false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPCODE_FOLLOW:
|
case OPCODE_FOLLOW:
|
||||||
|
Loading…
Reference in New Issue
Block a user