void *recvCallBackParam)
{
struct robot_switches_type *instance = (struct robot_switches_type *)vinstance;
+ static bool last_left, last_right;
switch (info->status) {
case NEW_DATA:
robot.team_color = instance->team_color;
if (instance->bumper_pressed)
FSM_SIGNAL(MOTION, EV_OBSTACLE_BEHIND, NULL);
- if (instance->bumper_left || instance->bumper_right)
+ if ((!last_left && instance->bumper_left) ||
+ (!last_right && instance->bumper_right))
FSM_SIGNAL(MOTION, EV_OBSTACLE_SIDE, NULL);
+ last_right = instance->bumper_right;
+ last_left = instance->bumper_left;
break;
case DEADLINE:
break;