Timo Kokkonen [Mon, 7 Oct 2013 18:11:41 +0000 (21:11 +0300)]
Move time stamp initialization after first proper log entry is read
If we initialize the time stamp too early, the first log entry that we
read will not have zero as its timestamp. Move the initialization
after we know the data is valid to avoid the problem.
Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
Timo Kokkonen [Mon, 7 Oct 2013 18:08:56 +0000 (21:08 +0300)]
Discard too short log lines
Some times the serial output contains incorrect entries, typically in
the beginning of log acquicition. Discard them so that they don't
clutter the log output.
Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
Timo Kokkonen [Sun, 6 Oct 2013 19:25:04 +0000 (22:25 +0300)]
read_data: Handle the input data more gracefully
The serial port is giving the data to us very slowly, perhaps only a
few bytes a time. Therefore we need to take special care in order to
not handle incomplete log lines.
Add a new function to read one complete line of data from the
device. Once the complete line is read, write it to the logfile (if
one is open) and then also to the console.
Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
Timo Kokkonen [Sun, 6 Oct 2013 14:57:09 +0000 (17:57 +0300)]
Add more advanced debug macro
Make it possible to have multiple debug levels. This makes it possible
to remove unneeded (debug) output when user is not interested in
seeing the output.
Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
Timo Kokkonen [Sat, 5 Oct 2013 19:20:33 +0000 (22:20 +0300)]
Add draw_plots.sh
This simple helper script draws all plots for a given logfile. The
.plot files are adjusted to not use a fixed file name, but instead
rely on the calling script to set the file into "datafile" variable.
Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
Timo Kokkonen [Mon, 30 Sep 2013 18:09:07 +0000 (21:09 +0300)]
main: Fix busy loop with reading
As the baud.c opens the serial device with O_NBLOCK flag, read will
just return immediately when there is nothing to read. That basically
makes the read loop a a busy loop, consuming one CPU core fully at all
times.
Fix the problem by using epoll to wait until something becomes
available on the serial port to read.
Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
Timo Kokkonen [Sun, 29 Sep 2013 19:30:52 +0000 (22:30 +0300)]
Add couple of example gnuplot files for plotting graphs
voltage_and_current.plot: This one plots somewhat typical charging
graphs with voltage, current and accumulated charge visible.
balancing.plot: This one plots a graph of the balancing action. Cell
voltages compared to the average cell voltages (over average of five
samples) is plotted.
Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
Timo Kokkonen [Sun, 29 Sep 2013 19:05:52 +0000 (22:05 +0300)]
Initial commit
Add a very very simple version of the "plotter". It does no plotting,
it only opens the serial device with correct baud rate, reads out the
data at correct baud rate (correct for an iCharger 206B charer) and
prints out exactly what it read. Dumb as hell but works.
Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>