DCF77 driver seems to be broken
Achim Gratz
Stromeko at nexgo.de
Sun Feb 19 18:51:37 UTC 2017
Achim Gratz writes:
> I believe that the definition of timestamp_t as a union of timeval and
> l_fp in parse.h is the root of these troubles. If some code somewhere
> in parseclock assigns a timespec to that union instead, that would
> overwrite some stuff past that memory, I think.
That turned out to be a distraction. I've demoted timestamp_t to a
typedef on the last working commit and it didn't break anything as far I
can tell. But the first application of putting a timspec instead of a
timeval in broke (again), so I abandoned that thought. Instead the
following monkeypatch finally made things work halfway on master:
--- a/libparse/parse.c
+++ b/libparse/parse.c
@@ -38,7 +38,7 @@ parse_timedout(
delt = *tstamp;
delt -= parseio->parse_lastchar;
delta = lfp_uintv_to_tspec(delt);
- if (cmp_tspec(delta, *del) == TIMESPEC_GREATER_THAN)
+ if (cmp_tspec(delta, *del) == TIMESPEC_LESS_THAN)
{
parseprintf(DD_PARSE, ("parse: timedout: TRUE\n"));
return true;
The better patch is probably to fix either the comments or the inline
functions in timespecops.h that have their logic reversed (apparently
since the beginning) and possibly fix the current uses in systime.c and
add tests that actually test for something else than equality.
> But there's likely yet another bug or wrong assumption in there
> somewhere that I don't have time right now to hunt down. The code in
> master has already eliminated the union, but the bug is still there
> anyway.
So, while the above gets the code to recognize the refclock time again,
there's some timeout somewhere that makes the clock lose reach in the
time between each successful detection of the minute. That's probably
somewhere where a constant should now be multiplied by 1000 (µs->ns),
but isn't. Haven't found that one yet.
Regards,
Achim.
--
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+
Factory and User Sound Singles for Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds
More information about the devel
mailing list