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

First WiThrottle prototype

This commit is contained in:
Asbelos
2020-06-27 15:36:32 +01:00
parent 1a1429bf72
commit 669356df7d
5 changed files with 302 additions and 5 deletions

12
DCC.cpp
View File

@@ -62,6 +62,18 @@ void DCC::setFunctionInternal(int cab, byte byte1, byte byte2) {
DCCWaveform::mainTrack.schedulePacket(b, nB, 3); // send packet 3 times
}
uint8_t DCC::getThrottleSpeed(int cab) {
int reg=lookupSpeedTable(cab);
if (reg<0) return -1;
return speedTable[reg].speedCode & 0x7F;
}
bool DCC::getThrottleDirection(int cab) {
int reg=lookupSpeedTable(cab);
if (reg<0) return false ;
return (speedTable[reg].speedCode & 0x80) !=0;
}
static void DCC::setFn( int cab, byte functionNumber, bool on) {
if (cab<=0 || functionNumber<0 || functionNumber>28) return;
int reg = lookupSpeedTable(cab);