From 0c20cb99937e84b5b2301a3ec374950dd0d3e504 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Sun, 31 Mar 2013 16:25:43 -0600 Subject: [PATCH] allow state transition at 0:00 --- main.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index 180084d..f5d1516 100644 --- a/main.c +++ b/main.c @@ -20,7 +20,9 @@ volatile bool tick = false; // Set high when jiffy clock ticks // Clocks are in deciseconds uint16_t score_a = 0; uint16_t score_b = 0; -int16_t period_clock = -600 * 30; +int16_t period_clock = -(30 * 60 * 10); +int16_t jam_duration = -(2 * 60 * 10); +int16_t lineup_duration = (-30 * 10); int16_t jam_clock = 0; enum { SETUP, @@ -69,6 +71,8 @@ const uint8_t setup_digits[] = { 0x1b, 0x12, 0x72 }; +const + #define mode(on) bit(PORTD, MODE, on) #define sin(on) bit(PORTD, SIN, on) #define sclk(on) bit(PORTD, SCLK, on) @@ -212,14 +216,14 @@ update_controller() uint8_t val = nesprobe(); int inc = 1; - if ((val & BTN_A) && (state != JAM)) { + if ((val & BTN_A) && ((state != JAM) || (jam_clock == 0))) { state = JAM; - jam_clock = -600 * 2; + jam_clock = jam_duration; } - if ((val & BTN_B) && (state != LINEUP)) { + if ((val & BTN_B) && ((state != LINEUP) || (jam_clock == 0))) { state = LINEUP; - jam_clock = -300; + jam_clock = lineup_duration; } if ((val & BTN_START) && (state != TIMEOUT)) {