factory resets

Dependencies:   WiflyInterface mbed

Fork of Wifly_UpdateFirmware by Samuel Mokrani

Revision:
3:5f4c91e62eea
Parent:
2:78b3ac0cd2a7
--- a/main.cpp	Sat Nov 24 20:16:17 2012 +0000
+++ b/main.cpp	Tue Aug 06 02:21:57 2013 +0000
@@ -3,25 +3,35 @@
 #include "mbed.h"
 #include "WiflyInterface.h"
 
-WiflyInterface wifly(p9, p10, p30, p29, "mbed", "password", WPA);
+WiflyInterface wifly(p9, p10, p30, p29, "periodic.lab", "", NONE);
 
 int main() {
+    bool success = true;
 
+    printf("wifly init\r\n");
     wifly.init(); //Use DHCP
-    while(!wifly.connect());
+
+    while(!wifly.connect()) {
+        printf("wifly connecting (%s)...\r\n", wifly.getIPAddress());
+    }
     
-    bool success = true;
-    // once connected, send command to update firmware
+    // once connected, send command to update firmware    
+    printf("set ftp address\r\n");
     if (!wifly.sendCommand("set ftp address 0\r", "AOK"))
         success = false;
+    printf("set dns name\r\n");
     if (!wifly.sendCommand("set dns name rn.microchip.com\r", "AOK"))
         success = false;
+    printf("save\r\n");
     if (!wifly.sendCommand("save\r", "Stor"))
         success = false;
-    if (!wifly.sendCommand("ftp update\r", "FTP OK", NULL, 30000))
+    printf("ftp update\r\n");
+    if (!wifly.sendCommand("ftp update \r", "FTP OK", NULL, 30000))
         success = false;
+    printf("factory reset\r\n");
     if (!wifly.sendCommand("factory RESET\r"))
         success = false;
+    printf("reboot\r\n");
     if (!wifly.sendCommand("reboot\r"))
         success = false;