This program simply connects to a HTS221 I2C device to read Temperature

Dependencies:   FXOS8700CQ mbed

Files at this revision

API Documentation at this revision

Comitter:
fkellermavnet
Date:
Wed Jul 13 17:35:14 2016 +0000
Parent:
18:b08471eb1d1c
Child:
20:27a4f27254d0
Commit message:
Right before the SOCKCONN during the WNC software initialization once in a while the WNC seems to be dropping a char that is sent to it, 'A' specifically. So I put in 2 "AT" commands right before the SOCKCONN and that seems to clean it up.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
wnc_control.cpp Show annotated file Show diff for this revision Revisions of this file
wnc_control.h Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Jul 13 15:57:38 2016 +0000
+++ b/main.cpp	Wed Jul 13 17:35:14 2016 +0000
@@ -462,12 +462,9 @@
         }
     } while (!i);
     
-    // wait for a little yet for the socket service to allow for connect!!!
-    wait_ms(3000);
-    
     //Software init
     software_init_mdm();
-    
+ 
     // Resolve URL to IP address to connect to
     resolve_mdm();
 
--- a/wnc_control.cpp	Wed Jul 13 15:57:38 2016 +0000
+++ b/wnc_control.cpp	Wed Jul 13 17:35:14 2016 +0000
@@ -62,6 +62,8 @@
 {
     do
     {
+      at_at_wnc();
+      at_at_wnc();
       WNC_MDM_ERR = WNC_OK;
       at_sockopen_wnc(MyServerIpAddress, MY_PORT_STR);
       if (WNC_MDM_ERR == WNC_NO_RESPONSE)
@@ -214,6 +216,12 @@
   }
 }
 
+void at_at_wnc(void)
+{
+    string * pRespStr;
+    send_wnc_cmd("AT", &pRespStr, WNC_TIMEOUT_MS); // Heartbeat?
+}
+
 void at_init_wnc(void)
 {
   string * pRespStr;
--- a/wnc_control.h	Wed Jul 13 15:57:38 2016 +0000
+++ b/wnc_control.h	Wed Jul 13 17:35:14 2016 +0000
@@ -14,6 +14,7 @@
 extern int at_dnsresolve_wnc(const char * s, string * ipStr);
 extern void at_sockwrite_wnc(const char * s);
 extern unsigned at_sockread_wnc(string * pS, unsigned n, unsigned retries);
+extern void at_at_wnc(void);
 
 // High level functions that attempt to correct for things going bad with the WNC
 extern void software_init_mdm(void);