diff --git a/CVReader.ino b/CVReader.ino index 9ba6724..9b2edd8 100644 --- a/CVReader.ino +++ b/CVReader.ino @@ -22,10 +22,10 @@ void myFilter(Print & stream, byte & opcode, byte & paramCount, int p[]) { DCC::setFn(p[0],p[1],p[2]==1); opcode=0; // tell parser to ignore this command break; - case '#': // Diagnose parser <#....> - DIAG(F("# paramCount=%d\n"),paramCount); + case '$': // Diagnose parser <$....> + DIAG(F("$ paramCount=%d\n"),paramCount); for (int i=0;i + StringFormatter::send(stream,F("<# %d>"), MAX_LOCOS); + return; default: //anything else will drop out to break; diff --git a/Hardware.cpp b/Hardware.cpp index e9eb218..04bf3d5 100644 --- a/Hardware.cpp +++ b/Hardware.cpp @@ -40,14 +40,14 @@ void Hardware::setSignal(bool isMainTrack, bool high) { } int Hardware::getCurrentMilliamps(bool isMainTrack) { - int pin = isMainTrack ? MAIN_SENSE_PIN : PROG_SENSE_PIN; + byte pin = isMainTrack ? MAIN_SENSE_PIN : PROG_SENSE_PIN; float factor = isMainTrack ? MAIN_SENSE_FACTOR : PROG_SENSE_FACTOR; - + // IMPORTANT: This function can be called in Interrupt() time within the 56uS timer // The default analogRead takes ~100uS which is catastrphic // so analogReadFast is used here. (-2uS) int rawCurrent = analogReadFast(pin); - + return (int)(rawCurrent * factor); }