Timo Kokkonen [Mon, 23 Jul 2012 15:07:19 +0000 (18:07 +0300)]
Have extra 20ms delay after every 16th read entry
Some times the meter refuses to return all entries as expected, and
just returns some crap instead. This becomes especially notcieable
once the meter has reached the limit of 2000 glucose readings.
Having an extra 20ms delay between readings once every 16th reads
appears to help ensuring all data is read reliably out of the device.
Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
Timo Kokkonen [Mon, 23 Jul 2012 15:01:28 +0000 (18:01 +0300)]
Do not return error if no more entries are read
Since commit 009c9b76361 the tool was always returning an error
condition when the last entry was read from the meter. This is not
correct as reading the last entry is not an error condition.
Unfortunately it is not know how to detect the lack of entries from
the device from the last read entry. Therefore, in case we fail to
read proper data from the device, we will always assume we were able
to read all entries.
Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
Timo Kokkonen [Tue, 27 Mar 2012 19:13:43 +0000 (22:13 +0300)]
options.c: Indent with tabs, not spaces
The coding convention on this project is to indent with tabs. Replace
spaces wit tabs to unify the convention. For example git diffs look
bit odd if tab and space indenting is mixed.
Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
Timo Kokkonen [Tue, 27 Mar 2012 19:07:51 +0000 (22:07 +0300)]
Replace existing printf functions with trace(...)
This unifies the way printing is done. Everything goes to stderr by
default. Using genering tracing functions also removes the custom
trace_level handling.
Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
Timo Kokkonen [Tue, 27 Mar 2012 18:52:06 +0000 (21:52 +0300)]
contour-protocol: Replace bad macros with static functions
These macros in question were modifying variables outside of their
parameter listing. As the macros were also used in places where using
some of the variables don't make any sense, the were also some
compiler warning that were introduced since gcc version 4.6:
contour-protocol.c: In function ‘contour_read_entry’:
contour-protocol.c:296:6: warning: variable ‘j’ set but not used [-Wunused-but-set-variable]
As there are so many calls to the macros it makes sense to replace
them with static functions. This also cures the compiler
warning. Another plus side is that now using the macro should not have
any hard to miss side effects to other variables.
Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
Timo Kokkonen [Tue, 27 Mar 2012 17:59:38 +0000 (20:59 +0300)]
main: Only set non-zero elements in user_options structure
As the number of elements may increase over time, it is better to zero
out the entire strucutre and then explicity set default values only on
those entries that have non-zero default.
Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
Timo Kokkonen [Tue, 27 Mar 2012 16:42:00 +0000 (19:42 +0300)]
main.c: Remove forward declaration for token()
The forward declaration can be avoided by moving the function before
any call sites. As an added bonus, the function is marked as static as
it is not used in any other C file.
Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
Timo Kokkonen [Mon, 19 Mar 2012 16:50:32 +0000 (18:50 +0200)]
Add copyright notices
I, as the creator of this project, am making a decision to distribute
this project under the GPLv2 license. Now you know it. Thank you. Live
long and prosper.
Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
Timo Kokkonen [Wed, 27 Apr 2011 17:59:31 +0000 (20:59 +0300)]
Significantly reduce the delays between messages
There only needs to be relatively short delay between the different
messages, but the delay between different messages varies quite
much. The delays introduced here are far from being optimal, but
reducing the delays too much causes unexpected behaviour.
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>