diff --git a/README.md b/README.md index fec1923..1a544f8 100644 --- a/README.md +++ b/README.md @@ -162,7 +162,7 @@ void setFunction(char multiThrottle, String address, int num, bool pressed) void setFunction(char multiThrottle, int num, bool pressed) void setFunction(int num, bool pressed) ``` -Update the state for the specified function (0-28 is the acceptable range). If the function button has been pressed down (or otherwise activated), set ```pressed``` to ```true```. When the button is released, set ```pressed``` to ```false```. +Update the state for the specified function (0-31 is the acceptable range). If the function button has been pressed down (or otherwise activated), set ```pressed``` to ```true```. When the button is released, set ```pressed``` to ```false```. multiThrottle defaults to 'T' if not specified. Otherwise use '0', '1', '2', '3', '4', '5' only. If the Address is blank ("") on not provided, the lead loco only ill be sent the function. "*" will send to all locos in the consist. @@ -260,7 +260,7 @@ void receivedRosterEntry(int index, String name, int address, char length) Indicates that the WiThrottle Server has sent the details of an individual roster entry. ``` -virtual void receivedRosterFunctionList(String functions[28]) { } +virtual void receivedRosterFunctionList(String functions[31]) { } ``` Indicates the labels of the functions for the roster entry. diff --git a/library.properties b/library.properties index 1ddab60..8acd4d4 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=WiThrottleProtocol -version=1.1.5 +version=1.1.6 author=David Zuhn , Luca Dentella , Peter Akers maintainer=Peter Akers sentence=JMRI WiThrottle Protocol implementation diff --git a/src/WiThrottleProtocol.cpp b/src/WiThrottleProtocol.cpp index a42b8ca..ad3e243 100644 --- a/src/WiThrottleProtocol.cpp +++ b/src/WiThrottleProtocol.cpp @@ -710,7 +710,7 @@ void WiThrottleProtocol::processFunctionState(char multiThrottle, const String& functionData) { console->print("processFunctionState(): "); console->println(multiThrottle); - // F[0|1]nn - where nn is 0-28 + // F[0|1]nn - where nn is 0-31 if (delegate && functionData.length() >= 3) { bool state = functionData[1]=='1' ? true : false; @@ -737,7 +737,7 @@ void WiThrottleProtocol::processRosterFunctionListEntries(char multiThrottle, const String& s) { console->print("processRosterFunctionListEntries(): "); console->println(multiThrottle); - String functions[28]; + String functions[MAX_FUNCTIONS]; // loop int entries = -1; @@ -745,7 +745,7 @@ WiThrottleProtocol::processRosterFunctionListEntries(char multiThrottle, const S int entryStartPosition = 3; //ignore the first entry separator if (s.length() <= 3) entryFound =false; - while ((entryFound) && (entries < 28)) { + while ((entryFound) && (entries < MAX_FUNCTIONS)) { entries++; // get element @@ -760,7 +760,7 @@ WiThrottleProtocol::processRosterFunctionListEntries(char multiThrottle, const S console->print("Functions for roster entry: "); console->println(entries); - for(int i = entries+1; i < 28; i++) { + for(int i = entries+1; i < MAX_FUNCTIONS; i++) { functions[i] = ""; } @@ -1369,7 +1369,7 @@ WiThrottleProtocol::setFunction(char multiThrottle, String address, int funcNum, return; } - if (funcNum < 0 || funcNum > 28) { + if (funcNum < 0 || funcNum > MAX_FUNCTIONS) { return; } diff --git a/src/WiThrottleProtocol.h b/src/WiThrottleProtocol.h index 8e4759b..40461f0 100644 --- a/src/WiThrottleProtocol.h +++ b/src/WiThrottleProtocol.h @@ -42,6 +42,8 @@ #define DEFAULT_MULTITHROTTLE 'T' #define ALL_LOCOS_ON_THROTTLE "*" +#define MAX_FUNCTIONS 32 + typedef enum Direction { Reverse = 0, Forward = 1 @@ -106,10 +108,10 @@ class WiThrottleProtocolDelegate virtual void heartbeatConfig(int seconds) { } virtual void receivedFunctionState(uint8_t func, bool state) { } - virtual void receivedRosterFunctionList(String functions[28]) { } + virtual void receivedRosterFunctionList(String functions[MAX_FUNCTIONS]) { } virtual void receivedFunctionStateMultiThrottle(char multiThrottle, uint8_t func, bool state) { } - virtual void receivedRosterFunctionListMultiThrottle(char multiThrottle, String functions[28]) { } + virtual void receivedRosterFunctionListMultiThrottle(char multiThrottle, String functions[MAX_FUNCTIONS]) { } virtual void receivedSpeed(int speed) { } // Vnnn virtual void receivedDirection(Direction dir) { } // R{0,1}