File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
My-RTOS-Projects/04-CLI-LEDs/src Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ void userCLITask(void *param) // Function
7171 buffer[index] = input; // write received character to buffer
7272 index++;
7373 }
74-
74+
7575 if (input == ' \n ' ) // Check when user presses ENTER key
7676 {
7777 Serial.print (" \n " );
@@ -118,7 +118,12 @@ void msgRXTask(void *param)
118118 char * tailPtr = someMsg.cmd + fadeLen; // pointer arithmetic: move pointer to integer value
119119 fadeAmt = atoi (tailPtr); // retreive integer value at end of string
120120 fadeAmt = abs (fadeAmt); // fadeAmt can't be negative
121-
121+ if (fadeAmt <= 0 || fadeAmt > 128 )
122+ {
123+ Serial.println (" Value Must Be Between 1 & 128" );
124+ Serial.println (" Returning...." );
125+ continue ;
126+ }
122127 xSemaphoreTake (mutex1, portMAX_DELAY); // enter critical section
123128 fadeInterval = fadeAmt; // Change global fade variable
124129 xSemaphoreGive (mutex1);
@@ -231,7 +236,7 @@ void msgRXTask(void *param)
231236 }
232237 else // Not a command: Print the message to the terminal
233238 {
234- sprintf (buffer, " Not A Command: %s\n " , someMsg.cmd );// print user message
239+ sprintf (buffer, " Invalid Command: %s\n " , someMsg.cmd );// print user message
235240 Serial.print (buffer);
236241 memset (buffer, 0 , BUF_LEN); // Clear input buffer
237242 }
You can’t perform that action at this time.
0 commit comments