bool wait_flag;
uint8_t mode_to_go;
+enum {
+ LEFT=0,
+ RIGHT
+}
+
void serial_comm(int status)
{
uint8_t buff[10];
return 0;
}
+int set_game_color(uint8_t col)
+{
+ return 0;
+}
+
+int move_carousel(uint8_t dir)
+{
+ uint8_t act_car_pos, new_car_pos;
+ ROBOT_LOCK(carousel);
+ act_car_pos = robot.orte.drives.carousel_pos;
+ ROBOT_UNLOCK(carousel);
+ switch(dir) {
+ case LEFT:
+ if(act_car_pos==0)
+ new_car_pos = 4;
+ else
+ new_car_pos = --act_car_pos;
+ break;
+ case RIGHT:
+ if(act_car_pos==4)
+ new_car_pos = 0;
+ else
+ new_car_pos = ++act_car_pos;
+ break;
+ default:
+ break;
+ }
+ ROBOT_LOCK(carousel);
+ robot.orte.drives.carousel_pos = new_car_pos;
+ ROBOT_UNLOCK(carousel);
+}
+
int process_msg(uint8_t *buff) {
- printf("buff[1]=%d\n",buff[1]);
switch(buff[1]) {
case SWITCH_TO_STATUS:
uoled_switch_mode_rep(MODE_STATUS, CHANGE_MODE_STATUS);
case ACTUATORS:
set_actuators(buff[2]);
break;
+ case SET_COLOR:
+ set_game_color(buff[2]);
+ break;
+ case CAR_LEFT:
+ move_carousel(LEFT);
+ break;
+ case CAR_RIGHT:
+ move_carousel(RIGHT);
+ break;
default:
break;
}