error correction
This commit is contained in:
parent
92448cf9a5
commit
dc2e04e314
@ -137,7 +137,7 @@ static enum system_state handle_state_collision_drive_back(void)
|
||||
system_state_object.collision_timer.running = true;
|
||||
}
|
||||
if(system_state_object.collision_timer.running &&
|
||||
(system_state_object.collision_timer.tick > sys_tick_get_ms())) {
|
||||
(system_state_object.collision_timer.tick < sys_tick_get_ms())) {
|
||||
drive_ctrl_halt();
|
||||
next_state = SYS_COLLISION_TURN;
|
||||
system_state_object.collision_timer.running = false;
|
||||
@ -159,7 +159,7 @@ static enum system_state handle_state_collision_turn(void)
|
||||
shell_write(print_buffer, strlen(print_buffer));
|
||||
drv_open(&rng);
|
||||
// random number between 500 and 4000
|
||||
int sleep = drv_read(&rng, NULL, 0) % 3500 + 500;
|
||||
unsigned int sleep = (unsigned int)drv_read(&rng, NULL, 0) % 3500 + 500;
|
||||
system_state_object.collision_timer.tick = sys_tick_get_ms() + sleep;
|
||||
system_state_object.collision_timer.running = true;
|
||||
// randomize turn direction
|
||||
@ -169,7 +169,7 @@ static enum system_state handle_state_collision_turn(void)
|
||||
drive_ctrl_turn_right();
|
||||
}
|
||||
if(system_state_object.collision_timer.running &&
|
||||
(system_state_object.collision_timer.tick > sys_tick_get_ms())) {
|
||||
(system_state_object.collision_timer.tick < sys_tick_get_ms())) {
|
||||
drive_ctrl_halt();
|
||||
next_state = system_state_object.saved_state;
|
||||
system_state_object.collision_timer.running = false;
|
||||
|
Loading…
Reference in New Issue
Block a user