diff --git a/DCCEXParser.cpp b/DCCEXParser.cpp index 176e09c..e4949ce 100644 --- a/DCCEXParser.cpp +++ b/DCCEXParser.cpp @@ -435,7 +435,7 @@ void DCCEXParser::parse(Print *stream, byte *com, bool blocking) return; case 'c': // READ CURRENT - StringFormatter::send(stream, F(""), DCCWaveform::mainTrack.getLastCurrent()); + StringFormatter::send(stream, F(""), DCCWaveform::mainTrack.get1024Current()); return; case 'Q': // SENSORS diff --git a/DCCWaveform.h b/DCCWaveform.h index c658577..b51e79f 100644 --- a/DCCWaveform.h +++ b/DCCWaveform.h @@ -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;