From 9400090f1b542ae285171c2d12386333093d3ab4 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Wed, 3 Apr 2013 21:52:46 -0600 Subject: [PATCH] Have period clock count at the right time --- main.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/main.c b/main.c index 0d774ca..fa5a5f7 100644 --- a/main.c +++ b/main.c @@ -110,15 +110,6 @@ draw() //XXX testing - if ((state == TIMEOUT) && (jam_clock % 8 == 0)) { - for (clk = 0; clk < 4; clk += 1) { - write(0); - } - } else { - clk = (abs(period_clock / 10) / 60) * 100; - clk += abs(period_clock / 10) % 60; - write_num(clk, 4); - } write_num(score_b, 2); @@ -135,6 +126,18 @@ draw() write_num(score_a, 2); + + if ((state == TIMEOUT) && (jam_clock % 8 == 0)) { + // Blank it out + for (clk = 0; clk < 4; clk += 1) { + write(0); + } + } else { + clk = (abs(period_clock / 10) / 60) * 100; + clk += abs(period_clock / 10) % 60; + write_num(clk, 4); + } + latch(); pulse(); } @@ -249,13 +252,13 @@ loop() switch (state) { case SETUP: break; - case TIMEOUT: + case JAM: + case LINEUP: if (period_clock) { period_clock += 1; } // fall through - case JAM: - case LINEUP: + case TIMEOUT: if (jam_clock) { jam_clock += 1; }