chiark / gitweb /
Adjust pulsewidth and gapwidth.
authorBen Harris <bjh21@bjh21.me.uk>
Sat, 24 Nov 2018 09:39:56 +0000 (09:39 +0000)
committerBen Harris <bjh21@bjh21.me.uk>
Sat, 8 Dec 2018 22:30:09 +0000 (22:30 +0000)
Since pulsewidth is the length of the sleep in pulse(), it's
guaranteed that the actual pulse will be longer than this, so we can
safely set it to the minimum allowed, for minimum power consumption.

On the other hand, gapwidth should be raised slightly since a real
Clock No. 36 could would leave at least 500 ms between pulses (in
"advance" mode with a 500 ms pulse width).

clunk.c

diff --git a/clunk.c b/clunk.c
index 4cb8a70cd12124a08d72fb92eb74bb2cab5293db..9e1854265d1316b4c9dfbf125de060afde240ede 100644 (file)
--- a/clunk.c
+++ b/clunk.c
  *
  * <http://gpoclocksystems.byethost22.com/pages/pr479b.html>
  */
-static long const pulsewidth = 250000000; /* nanoseconds */
+static long const pulsewidth = 200000000; /* nanoseconds */
 
 /*
- * Minimum gap between pulses.
+ * Minimum gap between pulses.  The fastest a Clock No. 36 could emit
+ * pulses was once per second, so with a maximum pulse width of
+ * 500 ms, that leaves 500 ms between pulses.
  */
-static long const gapwidth = 250000000; /* nanoseconds */
+static long const gapwidth = 500000000; /* nanoseconds */
 
 /*
  * Maximum error to correct by advancing the clock rather than
@@ -92,7 +94,7 @@ record_tick(void)
                 * The straightforward thing to do here would simply
                 * be to pwrite() to the state file.  However, we
                 * don't do that because we'd like to drop the clock
-                * GPIO line in 250 ms, and the write might take
+                * GPIO line in 200 ms, and the write might take
                 * longer than that (especially since statefd is
                 * opened with O_DSYNC).  So it's time to plunge into
                 * POSIX aio.  Happily, it's pleasant enough in a