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:
13:9ac5ff131214
Parent:
12:f3ccc43c4d3c
Child:
14:56a2c371ce18
diff -r f3ccc43c4d3c -r 9ac5ff131214 GSMLibrary.cpp
--- a/GSMLibrary.cpp	Fri Mar 06 00:30:41 2015 +0000
+++ b/GSMLibrary.cpp	Fri Mar 06 01:11:58 2015 +0000
@@ -19,9 +19,9 @@
 //Please notice that after ":" the gsm will usually send aditional information
 #define AT_OK_RESPONSE "OK" //Response after sending "AT" message
 #define AT_CSQ_RESPONSE "+CSQ:" //+CSQ: <arg1>,<arg2> where <arg1> is signal strength arg1 = 0-30 where a number below 10 means low signal strength and 99 is not knwn or detectable signal and arg2 is bit error rate form 0-7, 99 will represent error 
-#define AT_CREG_RESPONSE "+CREG: 0"//+CREG: <arg1>,<arg2> where <arg1> = 0-2(see AT command descriptions), <arg2> =  0-5, 0 not registered to nework and not looking for one. 1 is conected to network, 2 is not conected but searching
+#define AT_CREG_RESPONSE "+CREG:"//+CREG: <arg1>,<arg2> where <arg1> = 0-2(see AT command descriptions), <arg2> =  0-5, 0 not registered to nework and not looking for one. 1 is conected to network, 2 is not conected but searching
 #define AT_CMGF_RESPONSE "OK"
-#define AT_CMGS_RESPONSE ">" //Message is written aftersymbol
+#define AT_CMGS_RESPONSE "> "  //Message is written aftersymbol
 #define AT_SENDSMS_RESPONSE "+CMGS:" // +CMGS: <id> this will include the message id. CMGS ERROR for error and 
 #define AT_SUCCESS_REPSONSE "OK"
 
@@ -106,7 +106,10 @@
             if(getGSMIdleBit()){
                 printQueue(); //$debug 
                 if(findInQueue(AT_CREG_RESPONSE)){
-                    if(parseInt() == 1){
+                     pc.printf("creg parse Int1: %d\r\n",parseInt());//&debug
+                     int q = parseInt();
+                     pc.printf("creg parse Int2: %d\r\n",q);//&debug
+                    if(q == 1){
                         resetGSMIdleBit();
                         pc.printf("sending AT_CMGF\r\n");//&debug
                         gsm.puts(AT_CMGF);