]> rtime.felk.cvut.cz Git - eurobot/public.git/commitdiff
Canged handling of back switch
authorMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 24 Apr 2009 20:20:48 +0000 (22:20 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 24 Apr 2009 20:22:37 +0000 (22:22 +0200)
src/robofsm/robot_orte.c

index 18df45280e9c93c579c95eb9469737645f049a1e..5d341222cad6a4a82c19a7d460a28d8d88cc0930 100644 (file)
@@ -322,15 +322,15 @@ void rcv_puck_distance_cb(const ORTERecvInfo *info, void *vinstance,
 void rcv_puck_inside_cb(const ORTERecvInfo *info, void *vinstance,
                            void *recvCallBackParam)
 {
-       static bool previous_switch_status;
        switch (info->status) {
        case NEW_DATA: {
                if (robot.use_back_switch) {
-                       if (robot.orte.puck_inside.status & 0x01) {
+                       static bool previous_switch_status = 0;
+                       if (robot.orte.puck_inside.status & 0x02) {
                                //FSM_SIGNAL(ACT, EV_PUCK_INSIDE, NULL);
 
                                /* React on the first switch or when moving backward. */
-                               if ((previous_switch_status & 0x01) == 0 ||
+                               if ((previous_switch_status & 0x02) == 0 ||
                                    robot.moves_backward) {
                                        FSM_SIGNAL(MOTION, EV_OBSTACLE_BEHIND, NULL);
                                }