You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/Advanced/FunctionSwap/FunctionSwap.ino
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
*/
4
4
#include<Commander.h>
5
5
Commander cmd;
6
-
boolswopstate = 0;
6
+
boolswapstate = 0;
7
7
//User string - this can be anything you want, and is printed when the help and ? commands are used
8
8
//Its a good idea to put the # symbol in front of each line so that if the response to these commands is fet to another commander, they will be interpreted as comments.
9
9
String deviceInfo = "#\t(Start of user string)\n#\tCommander swop function example\n#\tDevice firmware version x.x.x revision x\n#\thttps://github.com/CreativeRobotics/Commander\n#\t(End of user string)";
{"swop", swopHandler, "swop the command strings and function handler"},
17
+
{normalCommand, helloHandler, normalHelp},
18
+
{"swap", swapHandler, "swap the command strings and function handler"},
19
19
};
20
20
21
21
//Extended help text. This is an array of pointers to strings so we can assign one of the char arrays from above, and use the swop function to change the text.
22
22
//(There needs to me the same number of elements in this array as in the command list.)
23
-
char * extraHelp[] = {
24
-
(char*)extendedHelp,
25
-
"'swop'\tSwap between two different function handlers for the first command.\nWhen this is called the function handler, command text and help text for the first command in the list will be swapped.",
23
+
constchar * extraHelp[] = {
24
+
extendedHelp,
25
+
"'swap'\tSwap between two different function handlers for the first command.\nWhen this is called the function handler, command text and help text for the first command in the list will be swapped.",
@@ -490,7 +490,7 @@ class Commander : public Stream {
490
490
int16_t commandIndex = -1;
491
491
uint8_t* commandLengths;
492
492
uint8_t endIndexOfLastCommand = 0;
493
-
char** extraHelp;
493
+
constchar** extraHelp;
494
494
uint8_t longestCommand = 0;
495
495
char commentCharacter = '#'; //marks a line as a comment - ignored by the command parser
496
496
char reloadCommandCharacter = '/'; //send this character to automatically reprocess the old buffer - same as resending the last command from the users POV.
0 commit comments