3rd Repo, trying to figure this out.

Dependencies:   LPS25H hts221

Fork of SOFT253_Template_Weather_OS_54 by Stage-1 Students SoCEM

Revision:
49:83bea7fb2728
Parent:
48:a8219954b3f2
Child:
50:c07e968b9582
--- a/main.cpp	Thu Apr 06 16:12:12 2017 +0000
+++ b/main.cpp	Thu Apr 06 16:44:57 2017 +0000
@@ -31,6 +31,8 @@
  
 LinkedList *listBuffer;
 LocalDate *localDate;
+bool logging = true;
+
 void RealTimeDate()
 {
     localDate->TickSecond();
@@ -139,9 +141,7 @@
                 printf("%c",charCmd);
             }
             else if(charCmd == 13) // If Enter is pressed
-            {
-                printf("\r\n\r\nCommand entered: %s\r\n", command);
-                
+            {   
                 // this thing that follows splits a string into multiple strings, just like String.Split(char[] delimiters)
                 // here we will check for commands and parameters :)
                 char *charPos;
@@ -180,7 +180,10 @@
                 else if (CompareCommands(charPos,"status",6) == 1)
                 {
                     char *ptr = localDate->ToString();
-                    printf("\r\n STATUS: \r\n # of measures: %i \r\n SAMPLING: ON \r\n Current Date: %s \r\n", listBuffer->GetSize(),ptr);   
+                    if(logging == true)
+                        printf("\r\n STATUS: \r\n # of measures: %i \r\n SAMPLING: ON \r\n Current Date: %s \r\n", listBuffer->GetSize(),ptr);   
+                    else
+                        printf("\r\n STATUS: \r\n # of measures: %i \r\n SAMPLING: OFF \r\n Current Date: %s \r\n", listBuffer->GetSize(),ptr);   
                 }
                 else if (CompareCommands(charPos,"settime",7) == 1)
                 {
@@ -242,6 +245,20 @@
                         printf("\r\nWrong format! \r\n");   
                     }
                 }
+                else if(CompareCommands(charPos,"logging",7) == 1)
+                {
+                    charPos = strtok(NULL," ,");
+                    if(CompareCommands(charPos,"on",2) == 1)
+                    {
+                        logging = true;   
+                        printf("\r\n Logging turned ON!\r\n");
+                    }
+                    else if (CompareCommands(charPos,"off",3) == 1)
+                    {
+                        logging = false;   
+                        printf("\r\n Logging turned OFF!\r\n");
+                    }
+                }
                 
               //  printf("%s \r\n", charPos);
               //  charPos = strtok(NULL," -,");
@@ -261,7 +278,8 @@
 
  void SendSignalDoMeasure()
  {
-    measureThread->signal_set(SIGNAL_doMeasure);    
+    if(logging == true)
+        measureThread->signal_set(SIGNAL_doMeasure);    
 }
  
 // Main thread