SWUpdate library to be used with RPC.

Fork of SWUpdate by David Smart

Revision:
14:0e012d53c6df
Parent:
9:73067ef14c30
Child:
15:49cc43dcbbf6
--- a/SWUpdate.cpp	Sat Jun 21 19:39:27 2014 +0000
+++ b/SWUpdate.cpp	Fri Jun 27 20:57:23 2014 +0000
@@ -11,7 +11,7 @@
 
 extern "C" void mbed_reset();
 
-//#define DEBUG "SWup"
+#define DEBUG "SWup"
 #include <cstdio>
 #if (defined(DEBUG) && !defined(TARGET_LPC11U24))
 #define DBG(x, ...)  std::printf("[DBG %s %3d] "x"\r\n", DEBUG, __LINE__, ##__VA_ARGS__);
@@ -101,7 +101,7 @@
     struct dirent *p;
     bool noFailed = true;
    
-    snprintf(curbin, SW_MAX_FQFN, "%s%03d.bin", name, ver);
+    snprintf(curbin, SW_MAX_FQFN, "%s%02d.bin", name, ver);
     INFO("Remove bin files excluding {%s}", curbin);
     d = opendir("/local/");
     // Get a directory handle
@@ -164,7 +164,7 @@
             INFO("          file size: %d", fsize);
             if (inst_ver != latest_ver) {
                 INFO("  Downloading firmware ver %d ...", latest_ver);
-                sprintf(fwfn, "/local/%s%03d.BIN", name, latest_ver);
+                sprintf(fwfn, "/local/%s%02d.BIN", name, latest_ver);
                 snprintf(fqurl, 150, "%s/%s.bin", url, name);
         
                 HTTPFile latest(fwfn);