Firmware updater for SCM-LTE-01 and SCM-LTE-BETA

Dependencies:   SakuraIO mbed

Revision:
3:4793e04b9f3b
Parent:
2:fe531746e3f4
Child:
4:dcdbc20449ec
--- a/main.cpp	Mon Apr 16 02:53:38 2018 +0000
+++ b/main.cpp	Mon Apr 16 03:00:02 2018 +0000
@@ -34,6 +34,8 @@
     uint8_t ret;
     char version[33] = {0};
 
+    wait(1);
+
     // Check module
     uint16_t productId = sakuraio.getProductID();
     switch(productId) {
@@ -47,8 +49,15 @@
             pc.printf("Please check connection %d\r\n", productId);
             return 1;
     }
-
-    wait_ms(1000);
+    
+    
+    pc.printf("Get current version\r\n");
+    ret = sakuraio.getFirmwareVersion(version);
+    if((ret = sakuraio.getFirmwareVersion(version)) != CMD_ERROR_NONE) {
+        pc.printf("Error code=%d\r\n", ret);
+        return 1;
+    }
+    pc.printf("Current: %s\r\n", version);
 
 
     // Waiting for online
@@ -63,15 +72,6 @@
     pc.printf("\r\nOnline\r\n");
 
 
-    pc.printf("Get current version\r\n");
-    ret = sakuraio.getFirmwareVersion(version);
-    if((ret = sakuraio.getFirmwareVersion(version)) != CMD_ERROR_NONE) {
-        pc.printf("Error code=%d\r\n", ret);
-        return 1;
-    }
-    pc.printf("Current: %s\r\n", version);
-
-
     wait_ms(1000);