]> git.itanic.dy.fi Git - log-plotter/blobdiff - data.c
data.c: Store cell count and system status into variable array
[log-plotter] / data.c
diff --git a/data.c b/data.c
index 0db2394172131cee49dd6bc97492d24a3e8dddd9..c577a6eafccebc52643d82e065dc63430f80c2ce 100644 (file)
--- a/data.c
+++ b/data.c
@@ -123,6 +123,9 @@ static int parse_logline(const char *buf, struct charger_data *data)
        for (j = 0; j < max_cells; j++, i++) {
                d = atoi(entries[i]);
                ASSIGN_OR_NAN(data->cell_voltage[j], d / 1000.0);
+
+               if (d)
+                       data->cell_count++;
        }
 
        d = atoi(entries[i++]);
@@ -325,6 +328,12 @@ static int read_data(struct eventhandler_entry *h)
                return 0;
 
        if (state_has_changed()) {
+               store_str_variable_value_to_array("status",
+                       state_to_str(plotter_state.system_status), dt->cfg);
+
+               store_int_variable_value_to_array("cell_count",
+                                               data.cell_count, dt->cfg);
+
                ret = open_new_logfile(dt, data.channel);
                if (ret < 0)
                        return ret;