![](/media/cache/profiles/ba5be68d3d541f2ca043d77fc54fe702.jpg.50x50_q85.jpg)
3rd Repo, trying to figure this out.
Fork of SOFT253_Template_Weather_OS_54 by
Diff: main.cpp
- Revision:
- 68:d3765f93c16a
- Parent:
- 67:8d0e88172e2a
- Child:
- 69:72f237750d85
--- a/main.cpp Mon Apr 10 01:37:12 2017 +0000 +++ b/main.cpp Thu Apr 13 11:07:14 2017 +0000 @@ -342,10 +342,12 @@ printf("Expected parameters: \"on\" | \"off\""); } } + // Check if it's a "SETT" command else if(CompareCommands(charPos,"sett",4) == 1) { charPos = strtok(NULL," ,"); float auxRate = atof(charPos); + // Validate rate if(auxRate != 0 && auxRate > 0.01 && auxRate <= 60 ) { sampleRate = auxRate; @@ -353,11 +355,13 @@ timer.attach(&SendSignalDoMeasure, sampleRate); printf("\r\nSuccessfully updated sample rate to: %2.2f .\r\n",sampleRate); } + // if rate is not valid, prompt: else { printf("\r\n Sample rate must be between greater than 0.1 or less equal than 60. \r\n"); } } + // Check if it's a "HELP" command else if (CompareCommands(charPos,"help",4) == 1 || CompareCommands(charPos,"?",1) == 1) { printf("\r\nAvailable Commands:\r\n"); @@ -370,6 +374,7 @@ printf(" state - <ON|OFF> - Turn sampling on or OFF.\r\n"); printf(" logging <ON|OFF> - Turn logging on or OFF.\r\n"); } + // If command not recognized else { printf("\r\n Command not recognized. Type \"help\" for more info.\r\n"); @@ -396,10 +401,9 @@ localDate = new LocalDate(); //Start message - printf("Welcome\r\n"); + printf("\r\n--- W E L C O M E --\r\n"); //Hook up timer interrupt - timer.attach(&SendSignalDoMeasure, sampleRate); realTimeDate.attach(&RealTimeDate,1.0); @@ -415,12 +419,7 @@ while(1) { Thread::wait(3000); - // float temp,humi; - // measurer.ReadTempHumi(&temp, &humi); - // barometer.get(); - // t2->signal_set(SIGNAL_doMeasure); - // printf("Main Thread Measures: %fC %f %f \r\n", temp, humi,barometer.pressure()); - } + } } \ No newline at end of file