3rd Repo, trying to figure this out.
Fork of SOFT253_Template_Weather_OS_54 by
Diff: main.cpp
- Revision:
- 44:b523c9a9dd97
- Parent:
- 43:3983059e0d91
- Child:
- 45:9a33f2bc2b4e
--- a/main.cpp Thu Apr 06 10:48:12 2017 +0000 +++ b/main.cpp Thu Apr 06 11:07:40 2017 +0000 @@ -124,17 +124,17 @@ charCmd = getchar(); if(charCmd != NULL) { - if (charCmd == 127 && crtChar > 0 ) + if (charCmd == 127 && crtChar > 0 ) // If Backspace is pressed { printf("%c",charCmd); command[--crtChar] = '\0'; } - else if(charCmd != 13 && charCmd != 127) + else if(charCmd != 13 && charCmd != 127) // If NOT enter AND NOT Backspace is pressed { command[crtChar++] = charCmd; printf("%c",charCmd); } - else if(charCmd == 13) + else if(charCmd == 13) // If Enter is pressed { printf("\r\n\r\nCommand entered: %s\r\n", command); @@ -147,13 +147,32 @@ charPos = strtok(NULL," -,"); if(CompareCommands(charPos, "all",3) == 1) { + printf("\r\n Printing all measures performed so far: \r\n"); listBuffer->ListAll(); + printf("\r\n D O N E ! \r\n"); } else if(strtol(charPos,NULL,10) != 0) { listBuffer->ListX(atoi(charPos)); + printf("\r\n D O N E ! \r\n"); } } + else if (CompareCommands(charPos,"delete",6) == 1) + { + charPos = strtok(NULL," -,"); + if(CompareCommands(charPos,"all",3) == 1) + { + printf("\r\n Deleting all measures performed so far: \r\n"); + listBuffer->DeleteAll(); + printf("\r\n D O N E ! \r\n"); + } + else if (strtol(charPos,NULL,10) != 0) + { + listBuffer->DeleteX(atoi(charPos)); + printf("\r\n D O N E ! \r\n"); + } + + } // printf("%s \r\n", charPos); // charPos = strtok(NULL," -,"); @@ -188,7 +207,7 @@ //Hook up timer interrupt Ticker timer; - timer.attach(&SendSignalDoMeasure, 5.0); + timer.attach(&SendSignalDoMeasure, 2.0); //Threads produceThread = new Thread();