summaryrefslogtreecommitdiff
path: root/digital/ai/src/utils/chrono.c
diff options
context:
space:
mode:
Diffstat (limited to 'digital/ai/src/utils/chrono.c')
-rw-r--r--digital/ai/src/utils/chrono.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/digital/ai/src/utils/chrono.c b/digital/ai/src/utils/chrono.c
index 41e39b87..8560c3e0 100644
--- a/digital/ai/src/utils/chrono.c
+++ b/digital/ai/src/utils/chrono.c
@@ -44,7 +44,7 @@
static uint32_t chrono_tick_left_;
/** Last timer tick value. */
-static uint8_t chrono_last_tick_;
+static uint16_t chrono_last_tick_;
/** Is chrono started? */
static uint8_t chrono_started_;
@@ -62,8 +62,8 @@ chrono_update (void)
{
if (chrono_started_)
{
- uint8_t new_tick = timer_get_tick ();
- uint8_t diff = new_tick - chrono_last_tick_;
+ uint16_t new_tick = timer_get_tick ();
+ uint16_t diff = new_tick - chrono_last_tick_;
chrono_last_tick_ = new_tick;
if (diff > chrono_tick_left_)
chrono_tick_left_ = 0;
@@ -84,7 +84,10 @@ chrono_is_match_over (void)
uint32_t
chrono_remaining_time (void)
{
- return chrono_tick_left_ * TIMER_PERIOD_MS;
+ if (!chrono_started_)
+ return CHRONO_MATCH_DURATION_MS;
+ else
+ return chrono_tick_left_ * TIMER_PERIOD_MS;
}
void