A library for talking to Multi-Tech's Cellular SocketModem Devices.

Dependents:   M2X_dev axeda_wrapper_dev MTS_M2x_Example1 MTS_Cellular_Connect_Example ... more

Files at this revision

API Documentation at this revision

Comitter:
sam_grove
Date:
Fri Jan 03 06:28:20 2014 +0000
Parent:
131:da8f0e1c264a
Child:
135:960c0b523f88
Commit message:
seems that not waiting for an entire command to respond will choke up the module. enhanced with double checks and waits but should think about parsing the <ver> from a "" command and check that rather than just AOK before sending something else

Changed in this revision

wifi/Wifi.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/wifi/Wifi.cpp	Fri Jan 03 05:00:54 2014 +0000
+++ b/wifi/Wifi.cpp	Fri Jan 03 06:28:20 2014 +0000
@@ -49,16 +49,17 @@
     if(!sortInterfaceMode()) {
         return false;
     }
-
-    //cant do as a basic command after factory RESET, echo is on
-    //sendCommand("set uart mode 1", 1000, "set");
-    //wait(2.0f); // just wait a sec for the change
     
     //Set device to non-echo mode
     while (sendBasicCommand("set uart mode 1", 1000) != SUCCESS) {
         printf("[ERROR] Failed to set to non-echo mode\n\r");
         //return false;
     }
+    // do this twice because the module response doesnt seem to always take
+    while (sendBasicCommand("set uart mode 1", 1000) != SUCCESS) {
+        printf("[ERROR] Failed to set to non-echo mode\n\r");
+        //return false;
+    }
 
     //Set device to manual infrastructure mode
     if (sendBasicCommand("set wlan join 0", 1000) != SUCCESS) {
@@ -157,7 +158,7 @@
 
 void Wifi::disconnect()
 {
-    wait(2.0f);
+    wait(5.0f);
     printf("[DEBUG] Disconnecting from network\r\n");
 
     if(socketOpened) {