1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-23 21:01:25 +01:00

Report current as 1/1024 as expected by JMRI

This commit is contained in:
Harald Barth 2020-12-06 21:43:37 +01:00
parent f2db288102
commit a1f7d06508
2 changed files with 6 additions and 1 deletions

View File

@ -434,7 +434,7 @@ void DCCEXParser::parse(Print *stream, byte *com, bool blocking)
return;
case 'c': // READ CURRENT <c>
StringFormatter::send(stream, F("<a %d>"), DCCWaveform::mainTrack.getLastCurrent());
StringFormatter::send(stream, F("<a %d>"), DCCWaveform::mainTrack.get1024Current());
return;
case 'Q': // SENSORS <Q>

View File

@ -57,6 +57,11 @@ class DCCWaveform {
POWERMODE getPowerMode();
void checkPowerOverload();
int getLastCurrent();
inline int get1024Current() {
if (powerMode == POWERMODE::ON)
return (int)(lastCurrent*(long int)1024/motorDriver->getRawCurrentTripValue());
return 0;
}
void schedulePacket(const byte buffer[], byte byteCount, byte repeats);
volatile bool packetPending;
volatile byte sentResetsSincePacket;