uses pushing box to publish to google spreadsheets with a state machine instead of a while loop

Dependents:   DCS_FINAL_CODE

Fork of GSM_PUSHING_BOX_STATE_MACHINE by DCS_TEAM

Revision:
27:fe1c7eaf5b88
Parent:
26:838a9d26e8e9
Child:
28:81f1c8bd3299
diff -r 838a9d26e8e9 -r fe1c7eaf5b88 GSMLibrary.cpp
--- a/GSMLibrary.cpp	Sun Apr 12 03:09:15 2015 +0000
+++ b/GSMLibrary.cpp	Tue Apr 14 04:11:57 2015 +0000
@@ -58,8 +58,8 @@
 
     if (queueHasResponse() || gsm_timeOut() || gsm_current_state == GSM_INITIALIZE)
     {
-        gsm_printState();   //&debug
-        printQueue();   //&debug
+        //gsm_printState();   //&debug
+        //printQueue();   //&debug
         gsm_nextStateLogic();   //Next state
         gsm_mealyOutputs(); //Mealy outputs
     }
@@ -136,8 +136,6 @@
 //Next state logic -----------------------------------------------------
 void gsm_nextStateLogic()
 {
-    //printQueue(); //$debug
- 
     switch(gsm_current_state)
     {
         case GSM_INITIALIZE:
@@ -198,7 +196,7 @@
         case GSM_AT_SENDSMS:
             if(findInQueue(AT_SENDSMS_RESPONSE, true))
             {
-                pc.printf("(Wid%i)",parseInt());//&debug
+                //pc.printf("(Wid%i)",parseInt());//&debug
                 timeout_count = 0;  //Reset timeout count
                 send = 0;   //Indicate we are done sending the text message
                 if (undeleted_msgs) //Check if we need to delete read messages
@@ -206,12 +204,12 @@
                 else
                 {
                     gsm_current_state = GSM_READ_MSG;   //Otherwise read text messages again
-                    pc.printf("(Dnone)");//&debug 
+                    //pc.printf("(Dnone)");//&debug 
                 }
             }
             else
             {
-                pc.printf("(Werr)"); //&debug
+                //pc.printf("(Werr)"); //&debug
                 gsm_current_state = GSM_AT_CMGS;    //If failed, try resending the message (i.e. continue until timeout)
             }
             break;
@@ -219,14 +217,14 @@
             if (findInQueue(AT_DEL_R_MSGS_RESPONSE, true))
             {
                 undeleted_msgs = false;
-                pc.printf("(Dsucc)");   //&debug
+                //pc.printf("(Dsucc)");   //&debug
             }
-            else
-                pc.printf("(Derr)");    //&debug
+            //else
+                //pc.printf("(Derr)");    //&debug
             gsm_current_state = GSM_READ_MSG;
             break;
         default:
-            pc.printf("This is a state error\r\n");
+            //pc.printf("This is a state error\r\n");
     }
 }
  
@@ -265,14 +263,14 @@
             sendCommand(AT_DEL_R_MSGS);
             break;
         default:
-            pc.printf("This is a state error\r\n");
+            //pc.printf("This is a state error\r\n");
     }
 }
 //Initialize the GSM
 void gsm_initialize(){  
       SIM_SCGC6 |= SIM_SCGC6_DMAMUX_MASK; //enabling dmamux clock
       SIM_SCGC7 |= SIM_SCGC7_DMA_MASK;  // enebaling dma clock
-      pc.printf("initializing DMA...\r\n");
+      //pc.printf("initializing DMA...\r\n");
      // control register mux, enabling uart3 receive        
      DMAMUX_CHCFG0 |= DMAMUX_CHCFG_ENBL_MASK|DMAMUX_CHCFG_SOURCE(8); 
      
@@ -315,7 +313,7 @@
     //activate p fifo   
     UART_PFIFO_REG(UART3) |= UART_PFIFO_RXFE_MASK; //RXFE and buffer size of 1 word
     queueInit();
-    pc.printf("done...\n\r");
+    //pc.printf("done...\n\r");
 }