From 60e564df517f5c144b15745a87feea5d18c20b88 Mon Sep 17 00:00:00 2001 From: Asbelos Date: Wed, 10 Jul 2024 09:57:03 +0100 Subject: [PATCH] SETFREQ and \n"), sp->loco,slot,sp->speedCode,sp->functions); + broadcastReply(COMMAND_TYPE, F("\n"), sp->loco,slot,sp->speedCode,sp->functions); #ifdef SABERTOOTH if (Serial2 && sp->loco == SABERTOOTH) { static uint8_t rampingmode = 0; diff --git a/DCCEXParser.cpp b/DCCEXParser.cpp index 902326e..fd13a41 100644 --- a/DCCEXParser.cpp +++ b/DCCEXParser.cpp @@ -642,6 +642,13 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream) case 'F': // New command to call the new Loco Function API if(params!=3) break; + + if (p[1]=="DCFREQ"_hk) { // + if (p[2]<0 || p[2]>3) break; + DCC::setDCFreq(p[0],p[2]); + return; + } + if (Diag::CMD) DIAG(F("Setting loco %d F%d %S"), p[0], p[1], p[2] ? F("ON") : F("OFF")); if (DCC::setFn(p[0], p[1], p[2] == 1)) return; diff --git a/EXRAIL2MacroReset.h b/EXRAIL2MacroReset.h index 8927fbe..309a27c 100644 --- a/EXRAIL2MacroReset.h +++ b/EXRAIL2MacroReset.h @@ -334,7 +334,7 @@ #define SET_TRACK(track,mode) #define SET_POWER(track,onoff) #define SETLOCO(loco) -#define SETFREQ(loco,freq) +#define SETFREQ(freq) #define SIGNAL(redpin,amberpin,greenpin) #define SIGNALH(redpin,amberpin,greenpin) #define SPEED(speed) diff --git a/EXRAILMacros.h b/EXRAILMacros.h index e4d72a1..ebea75e 100644 --- a/EXRAILMacros.h +++ b/EXRAILMacros.h @@ -620,7 +620,7 @@ int RMFT2::onLCCLookup[RMFT2::countLCCLookup]; #define SET_TRACK(track,mode) OPCODE_SET_TRACK,V(TRACK_MODE_##mode <<8 | TRACK_NUMBER_##track), #define SET_POWER(track,onoff) OPCODE_SET_POWER,V(TRACK_POWER_##onoff),OPCODE_PAD, V(TRACK_NUMBER_##track), #define SETLOCO(loco) OPCODE_SETLOCO,V(loco), -#define SETFREQ(loco,freq) OPCODE_SETLOCO,V(loco), OPCODE_SETFREQ,V(freq), +#define SETFREQ(freq) OPCODE_SETFREQ,V(freq), #define SIGNAL(redpin,amberpin,greenpin) #define SIGNALH(redpin,amberpin,greenpin) #define SPEED(speed) OPCODE_SPEED,V(speed), diff --git a/StringFormatter.cpp b/StringFormatter.cpp index 9c69877..192e1cc 100644 --- a/StringFormatter.cpp +++ b/StringFormatter.cpp @@ -139,6 +139,7 @@ void StringFormatter::send2(Print * stream,const FSH* format, va_list args) { case 'd': printPadded(stream,va_arg(args, int), formatWidth, formatLeft); break; case 'u': printPadded(stream,va_arg(args, unsigned int), formatWidth, formatLeft); break; case 'l': printPadded(stream,va_arg(args, long), formatWidth, formatLeft); break; + case 'L': stream->print(va_arg(args, unsigned long), DEC); break; case 'b': stream->print(va_arg(args, int), BIN); break; case 'o': stream->print(va_arg(args, int), OCT); break; case 'x': stream->print((unsigned int)va_arg(args, unsigned int), HEX); break; diff --git a/version.h b/version.h index de4fdcc..7fb4fb5 100644 --- a/version.h +++ b/version.h @@ -3,7 +3,9 @@ #include "StringFormatter.h" -#define VERSION "5.2.65" +#define VERSION "5.2.66" +// 5.2.66 - +// - EXRAIL SETFREQ drop loco param (breaking since 5.2.28) // 5.2.65 - Speedup Exrail SETFREQ // 5.2.64 - Bugfix: <0 PROG> updated to undo JOIN // 5.2.63 - Implement WIFI_LED for ESP32, ESPduino32 and EX-CSB1, that is turned on when STA mode connects or AP mode is up @@ -12,7 +14,7 @@ // 5.2.62 - Allow acks way longer than standard // 5.2.61 - Merg CBUS ACON/ACOF/ONACON/ONACOF Adapter interface. // - LCC Adapter interface throttled startup, -// (Breaking change woith Adapter base code) +// (Breaking change with Adapter base code) // 5.2.60 - Bugfix: Opcode AFTEROVERLOAD does not have an argument that is a pin and needs to be initialized // - Remove inrush throttle after half good time so that we go to mode overload if problem persists // 5.2.59 - STM32 bugfix correct Serial1 definition for Nucleo-F401RE