error correction in system_state.c - close rng after usage

This commit is contained in:
tkl 2016-09-21 14:08:22 +00:00
parent 62aba6e8d9
commit 8a5fa89da6

View File

@ -160,6 +160,7 @@ static enum system_state handle_state_collision_turn(void)
drv_open(&rng); drv_open(&rng);
// random number between 500 and 4000 // random number between 500 and 4000
unsigned int sleep = (unsigned int)drv_read(&rng, NULL, 0) % 3500 + 500; unsigned int sleep = (unsigned int)drv_read(&rng, NULL, 0) % 3500 + 500;
drv_close(&rng);
system_state_object.collision_timer.tick = sys_tick_get_ms() + sleep; system_state_object.collision_timer.tick = sys_tick_get_ms() + sleep;
system_state_object.collision_timer.running = true; system_state_object.collision_timer.running = true;
// randomize turn direction // randomize turn direction