]> git.itanic.dy.fi Git - log-plotter/blobdiff - data.c
data: Move the total charge field at the end of the data
[log-plotter] / data.c
diff --git a/data.c b/data.c
index 0e334d810554f4b4240283bee2626631fddc99ec..89a1f33f5c1dedc3bdcff2bafa3315277c81b0fb 100644 (file)
--- a/data.c
+++ b/data.c
@@ -262,11 +262,12 @@ int read_data(int infd, int outfd)
 
                parse_logline(buf, &data);
 
-               dump_data(&data);
-
-               if (isnan(data.timestamp))
+               /* Fill in possibly missing timestamp */
+               if (isnan(data.timestamp) || data.timestamp == 0);
                        data.timestamp = cur_time - start_time;
 
+               dump_data(&data);
+
                if (!outfd)
                        continue;
 
@@ -293,9 +294,10 @@ int read_data(int infd, int outfd)
                        data.cell_voltage[7],
                        data.cell_voltage[8],
                        data.cell_voltage[9],
-                       data.total_charge,
                        data.int_temp,
-                       data.ext_temp);
+                       data.ext_temp,
+                       data.total_charge);
+
                ret = write(outfd, str, len);
                if (ret < 0) {
                        pr_err("write: %m\n");