Skip to content

Commit ce80c96

Browse files
Missing items from last update
1 parent 84846d5 commit ce80c96

File tree

2 files changed

+5
-16
lines changed

2 files changed

+5
-16
lines changed

src/Commander.cpp

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,15 @@
11
#include "Commander.h"
22

33
//Initialise the array of internal commands with the constructor
4-
Commander::Commander(): internalCommandArray ({ "U",
5-
"X",
6-
"?",
7-
"help",
8-
"echo",
9-
"echox",
10-
"errors"}){
4+
Commander::Commander(){
115
bufferString.reserve(bufferSize);
126
ports.settings.reg = COMMANDER_DEFAULT_REGISTER_SETTINGS;
137
commandState.reg = COMMANDER_DEFAULT_STATE_SETTINGS;
148

159

1610
}
1711
//==============================================================================================================
18-
Commander::Commander(uint16_t reservedBuffer): internalCommandArray ({ "U",
19-
"X",
20-
"?",
21-
"help",
22-
"echo",
23-
"echox",
24-
"errors"}){
12+
Commander::Commander(uint16_t reservedBuffer){
2513
//bufferString.reserve(bufferSize);
2614
bufferSize = reservedBuffer;
2715
bufferString.reserve(bufferSize);
@@ -939,7 +927,7 @@ bool Commander::checkCommand(uint16_t cmdIdx){
939927
benchmarkCounter++;
940928
#endif
941929

942-
if(bufferString.length() < (int16_t)commandLengths[cmdIdx]+1) return false; //no match if the buffer is shorter than the command+1 (buffer will have the end of line char)
930+
if(bufferString.length() < (int16_t)commandLengths[cmdIdx]+1U) return false; //no match if the buffer is shorter than the command+1 (buffer will have the end of line char)
943931
if(commandLengths[cmdIdx] == 1){
944932
//This command was a single char, if it is a match then return true if the next char in the buffer is an end of command char (newline, space or delim)
945933
if(bufferString.charAt(0) != commandList[cmdIdx].commandString[0]) return false;

src/Commander.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,8 @@ class Commander : public Stream {
504504
uint16_t bytesWritten = 0; //overflow check for bytes written into the buffer
505505
uint16_t bufferSize = SBUFFER_DEFAULT;
506506
uint16_t dataReadIndex = 0; //for parsing many numbers
507-
const char* internalCommandArray[INTERNAL_COMMAND_ITEMS];
507+
//const char* internalCommandArray[INTERNAL_COMMAND_ITEMS];
508+
const char* internalCommandArray[INTERNAL_COMMAND_ITEMS] = { "U", "X", "?", "help", "echo", "echox", "errors"};
508509
String *passPhrase = NULL;
509510
String *userString = NULL;
510511
uint8_t primntDelayTime = 0; //

0 commit comments

Comments
 (0)