Damien Frost / SolarNanoGrid_Field

Fork of SolarNanoGridv3 by SONG Project

Revision:
27:512cf6199b1d
Parent:
26:10e8b9908631
Child:
28:e85a86fc8b59
--- a/SolarNanoGrid.cpp	Tue Jun 21 08:55:54 2016 +0000
+++ b/SolarNanoGrid.cpp	Tue Jun 21 10:14:12 2016 +0000
@@ -184,6 +184,14 @@
         }else{
             DBG("Read Role: %c", role);
         }
+        // SD Version:
+        DBG("SD Version:");
+        if (fscanf (fp,"%d %*c %*s",&sdVersion )!=1){
+            ERR("Config: cannot read version");
+            result = false;
+        }else{
+            DBG("Read sdVersion: %d", sdVersion);
+        }
         // Community ID:
         DBG("Community ID:");
         if (fscanf (fp,"%u %*c %*s",&communityID  )!=1){
@@ -192,14 +200,6 @@
         }else{
             DBG("Read community ID: %u", communityID);
         }
-        // SD Version:
-        DBG("SD Version:");
-        if (fscanf (fp,"%d %*c %*s",&sdVersion )!=1){
-            ERR("Config: cannot read version");
-            result = false;
-        }else{
-            DBG("Read sdVersion: %d", sdVersion);
-        }
         // ID:
         DBG("ID:");
         if (fscanf (fp,"%x %*c %*s",&id)!=1){
@@ -246,7 +246,7 @@
     char channelbuff[32];
     char Role;
     FILE *fp;
-    INFO("");c
+    INFO("");
     INFO("***********************************");
     INFO("*** Creating a new config file. ***");
     INFO("***********************************");
@@ -311,8 +311,8 @@
         //Save the result to a file:
         INFO("Saving the new file to: %s...", name);
         fp = fopen(name, "w");
-        fprintf (fp,"%c : Role\n\r",Role);
-        fprintf (fp,"300 : Version\n\r");
+        fprintf (fp,"%c : Role\r\n",Role);
+        fprintf (fp,"300 : Version\r\n");
         fprintf (fp,"%s : CommunityID\r\n",CommunityIDbuff);
         fprintf (fp,"%s : ID\r\n",IDbuff);
         fprintf (fp,"%s : channel\r\n",channelbuff);