]> rtime.felk.cvut.cz Git - eurobot/public.git/commitdiff
Merge branch 'master' of localhost:/home/eurobot/git
authorMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 30 Apr 2010 15:55:54 +0000 (17:55 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 30 Apr 2010 15:55:54 +0000 (17:55 +0200)
src/robofsm/robot_orte.c

index ffffd66772b0211f50f69e7f74b6a0e266d81592..1e672ada61ba0c15162768957f0994d6da38926d 100644 (file)
@@ -375,13 +375,17 @@ void rcv_robot_switches_cb(const ORTERecvInfo *info, void *vinstance,
                           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;