change colors
authorOlivier Matz <zer0@droids-corp.org>
Tue, 30 Mar 2010 19:08:23 +0000 (21:08 +0200)
committerOlivier Matz <zer0@droids-corp.org>
Tue, 30 Mar 2010 19:08:23 +0000 (21:08 +0200)
16 files changed:
projects/microb2010/ballboard/commands_ballboard.c
projects/microb2010/cobboard/commands_cobboard.c
projects/microb2010/common/i2c_commands.h
projects/microb2010/mainboard/commands_mainboard.c
projects/microb2010/mainboard/commands_traj.c
projects/microb2010/mainboard/strat.c
projects/microb2010/mainboard/strat.h
projects/microb2010/mainboard/strat_utils.c
projects/microb2010/tests/hostsim/commands_mainboard.c
projects/microb2010/tests/hostsim/commands_traj.c
projects/microb2010/tests/hostsim/i2c_commands.h
projects/microb2010/tests/hostsim/strat.c
projects/microb2010/tests/hostsim/strat.h
projects/microb2010/tests/hostsim/strat_utils.c
projects/microb2010/tests/test_board2008/commands_traj.c
projects/microb2010/tests/test_board2008/strat_utils.c

index 03dc830..cae215e 100644 (file)
@@ -140,18 +140,18 @@ struct cmd_color_result {
 static void cmd_color_parsed(void *parsed_result, void *data)
 {
        struct cmd_color_result *res = (struct cmd_color_result *) parsed_result;
 static void cmd_color_parsed(void *parsed_result, void *data)
 {
        struct cmd_color_result *res = (struct cmd_color_result *) parsed_result;
-       if (!strcmp_P(res->color, PSTR("red"))) {
-               ballboard.our_color = I2C_COLOR_RED;
+       if (!strcmp_P(res->color, PSTR("yellow"))) {
+               ballboard.our_color = I2C_COLOR_YELLOW;
        }
        }
-       else if (!strcmp_P(res->color, PSTR("green"))) {
-               ballboard.our_color = I2C_COLOR_GREEN;
+       else if (!strcmp_P(res->color, PSTR("blue"))) {
+               ballboard.our_color = I2C_COLOR_BLUE;
        }
        printf_P(PSTR("Done\r\n"));
 }
 
 prog_char str_color_arg0[] = "color";
 parse_pgm_token_string_t cmd_color_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_color_result, arg0, str_color_arg0);
        }
        printf_P(PSTR("Done\r\n"));
 }
 
 prog_char str_color_arg0[] = "color";
 parse_pgm_token_string_t cmd_color_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_color_result, arg0, str_color_arg0);
-prog_char str_color_color[] = "green#red";
+prog_char str_color_color[] = "blue#yellow";
 parse_pgm_token_string_t cmd_color_color = TOKEN_STRING_INITIALIZER(struct cmd_color_result, color, str_color_color);
 
 prog_char help_color[] = "Set our color";
 parse_pgm_token_string_t cmd_color_color = TOKEN_STRING_INITIALIZER(struct cmd_color_result, color, str_color_color);
 
 prog_char help_color[] = "Set our color";
index 249a69b..eb77cba 100644 (file)
@@ -146,18 +146,18 @@ struct cmd_color_result {
 static void cmd_color_parsed(void *parsed_result, __attribute__((unused)) void *data)
 {
        struct cmd_color_result *res = (struct cmd_color_result *) parsed_result;
 static void cmd_color_parsed(void *parsed_result, __attribute__((unused)) void *data)
 {
        struct cmd_color_result *res = (struct cmd_color_result *) parsed_result;
-       if (!strcmp_P(res->color, PSTR("red"))) {
-               cobboard.our_color = I2C_COLOR_RED;
+       if (!strcmp_P(res->color, PSTR("yellow"))) {
+               cobboard.our_color = I2C_COLOR_YELLOW;
        }
        }
-       else if (!strcmp_P(res->color, PSTR("green"))) {
-               cobboard.our_color = I2C_COLOR_GREEN;
+       else if (!strcmp_P(res->color, PSTR("blue"))) {
+               cobboard.our_color = I2C_COLOR_BLUE;
        }
        printf_P(PSTR("Done\r\n"));
 }
 
 prog_char str_color_arg0[] = "color";
 parse_pgm_token_string_t cmd_color_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_color_result, arg0, str_color_arg0);
        }
        printf_P(PSTR("Done\r\n"));
 }
 
 prog_char str_color_arg0[] = "color";
 parse_pgm_token_string_t cmd_color_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_color_result, arg0, str_color_arg0);
-prog_char str_color_color[] = "green#red";
+prog_char str_color_color[] = "blue#yellow";
 parse_pgm_token_string_t cmd_color_color = TOKEN_STRING_INITIALIZER(struct cmd_color_result, color, str_color_color);
 
 prog_char help_color[] = "Set our color";
 parse_pgm_token_string_t cmd_color_color = TOKEN_STRING_INITIALIZER(struct cmd_color_result, color, str_color_color);
 
 prog_char help_color[] = "Set our color";
index 49cdb8e..fb4829f 100644 (file)
 #define I2C_COBBOARD_ADDR    2
 #define I2C_BALLBOARD_ADDR   3
 
 #define I2C_COBBOARD_ADDR    2
 #define I2C_BALLBOARD_ADDR   3
 
-#define I2C_LEFT_SIDE   0
-#define I2C_RIGHT_SIDE  1
-#define I2C_AUTO_SIDE   2
-#define I2C_CENTER_SIDE 3
+#define I2C_LEFT_SIDE    0
+#define I2C_RIGHT_SIDE   1
+#define I2C_AUTO_SIDE    2
+#define I2C_CENTER_SIDE  3
 
 
-#define I2C_COLOR_RED   0
-#define I2C_COLOR_GREEN 1
+#define I2C_COLOR_YELLOW 0
+#define I2C_COLOR_BLUE   1
 
 #define I2C_COB_BLACK   0
 #define I2C_COB_WHITE   1
 
 #define I2C_COB_BLACK   0
 #define I2C_COB_WHITE   1
index f4e37a8..29ecd3d 100644 (file)
@@ -291,15 +291,15 @@ static void cmd_start_parsed(void *parsed_result, void *data)
                gen.log_level = 0;
        }
 
                gen.log_level = 0;
        }
 
-       if (!strcmp_P(res->color, PSTR("red"))) {
-               mainboard.our_color = I2C_COLOR_RED;
-               i2c_set_color(I2C_COBBOARD_ADDR, I2C_COLOR_RED);
-               i2c_set_color(I2C_BALLBOARD_ADDR, I2C_COLOR_RED);
+       if (!strcmp_P(res->color, PSTR("yellow"))) {
+               mainboard.our_color = I2C_COLOR_YELLOW;
+               i2c_set_color(I2C_COBBOARD_ADDR, I2C_COLOR_YELLOW);
+               i2c_set_color(I2C_BALLBOARD_ADDR, I2C_COLOR_YELLOW);
        }
        }
-       else if (!strcmp_P(res->color, PSTR("green"))) {
-               mainboard.our_color = I2C_COLOR_GREEN;
-               i2c_set_color(I2C_COBBOARD_ADDR, I2C_COLOR_GREEN);
-               i2c_set_color(I2C_BALLBOARD_ADDR, I2C_COLOR_GREEN);
+       else if (!strcmp_P(res->color, PSTR("blue"))) {
+               mainboard.our_color = I2C_COLOR_BLUE;
+               i2c_set_color(I2C_COBBOARD_ADDR, I2C_COLOR_BLUE);
+               i2c_set_color(I2C_BALLBOARD_ADDR, I2C_COLOR_BLUE);
        }
 
        strat_start();
        }
 
        strat_start();
@@ -310,7 +310,7 @@ static void cmd_start_parsed(void *parsed_result, void *data)
 
 prog_char str_start_arg0[] = "start";
 parse_pgm_token_string_t cmd_start_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_start_result, arg0, str_start_arg0);
 
 prog_char str_start_arg0[] = "start";
 parse_pgm_token_string_t cmd_start_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_start_result, arg0, str_start_arg0);
-prog_char str_start_color[] = "green#red";
+prog_char str_start_color[] = "blue#yellow";
 parse_pgm_token_string_t cmd_start_color = TOKEN_STRING_INITIALIZER(struct cmd_start_result, color, str_start_color);
 prog_char str_start_debug[] = "debug#match";
 parse_pgm_token_string_t cmd_start_debug = TOKEN_STRING_INITIALIZER(struct cmd_start_result, debug, str_start_debug);
 parse_pgm_token_string_t cmd_start_color = TOKEN_STRING_INITIALIZER(struct cmd_start_result, color, str_start_color);
 prog_char str_start_debug[] = "debug#match";
 parse_pgm_token_string_t cmd_start_debug = TOKEN_STRING_INITIALIZER(struct cmd_start_result, debug, str_start_debug);
@@ -543,22 +543,22 @@ struct cmd_color_result {
 static void cmd_color_parsed(void *parsed_result, void *data)
 {
        struct cmd_color_result *res = (struct cmd_color_result *) parsed_result;
 static void cmd_color_parsed(void *parsed_result, void *data)
 {
        struct cmd_color_result *res = (struct cmd_color_result *) parsed_result;
-       if (!strcmp_P(res->color, PSTR("red"))) {
-               mainboard.our_color = I2C_COLOR_RED;
-               i2c_set_color(I2C_COBBOARD_ADDR, I2C_COLOR_RED);
-               i2c_set_color(I2C_BALLBOARD_ADDR, I2C_COLOR_RED);
+       if (!strcmp_P(res->color, PSTR("yellow"))) {
+               mainboard.our_color = I2C_COLOR_YELLOW;
+               i2c_set_color(I2C_COBBOARD_ADDR, I2C_COLOR_YELLOW);
+               i2c_set_color(I2C_BALLBOARD_ADDR, I2C_COLOR_YELLOW);
        }
        }
-       else if (!strcmp_P(res->color, PSTR("green"))) {
-               mainboard.our_color = I2C_COLOR_GREEN;
-               i2c_set_color(I2C_COBBOARD_ADDR, I2C_COLOR_GREEN);
-               i2c_set_color(I2C_BALLBOARD_ADDR, I2C_COLOR_GREEN);
+       else if (!strcmp_P(res->color, PSTR("blue"))) {
+               mainboard.our_color = I2C_COLOR_BLUE;
+               i2c_set_color(I2C_COBBOARD_ADDR, I2C_COLOR_BLUE);
+               i2c_set_color(I2C_BALLBOARD_ADDR, I2C_COLOR_BLUE);
        }
        printf_P(PSTR("Done\r\n"));
 }
 
 prog_char str_color_arg0[] = "color";
 parse_pgm_token_string_t cmd_color_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_color_result, arg0, str_color_arg0);
        }
        printf_P(PSTR("Done\r\n"));
 }
 
 prog_char str_color_arg0[] = "color";
 parse_pgm_token_string_t cmd_color_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_color_result, arg0, str_color_arg0);
-prog_char str_color_color[] = "green#red";
+prog_char str_color_color[] = "blue#yellow";
 parse_pgm_token_string_t cmd_color_color = TOKEN_STRING_INITIALIZER(struct cmd_color_result, color, str_color_color);
 
 prog_char help_color[] = "Set our color";
 parse_pgm_token_string_t cmd_color_color = TOKEN_STRING_INITIALIZER(struct cmd_color_result, color, str_color_color);
 
 prog_char help_color[] = "Set our color";
index 0d83688..55bda53 100644 (file)
@@ -743,16 +743,16 @@ static void cmd_position_parsed(void * parsed_result, void * data)
        else if (!strcmp_P(res->arg1, PSTR("set"))) {
                position_set(&mainboard.pos, res->arg2, res->arg3, res->arg4);
        }
        else if (!strcmp_P(res->arg1, PSTR("set"))) {
                position_set(&mainboard.pos, res->arg2, res->arg3, res->arg4);
        }
-       else if (!strcmp_P(res->arg1, PSTR("autoset_green"))) {
-               mainboard.our_color = I2C_COLOR_GREEN;
-               i2c_set_color(I2C_COBBOARD_ADDR, I2C_COLOR_GREEN);
-               i2c_set_color(I2C_BALLBOARD_ADDR, I2C_COLOR_GREEN);
+       else if (!strcmp_P(res->arg1, PSTR("autoset_blue"))) {
+               mainboard.our_color = I2C_COLOR_BLUE;
+               i2c_set_color(I2C_COBBOARD_ADDR, I2C_COLOR_BLUE);
+               i2c_set_color(I2C_BALLBOARD_ADDR, I2C_COLOR_BLUE);
                auto_position();
        }
        else if (!strcmp_P(res->arg1, PSTR("autoset_red"))) {
                auto_position();
        }
        else if (!strcmp_P(res->arg1, PSTR("autoset_red"))) {
-               mainboard.our_color = I2C_COLOR_RED;
-               i2c_set_color(I2C_COBBOARD_ADDR, I2C_COLOR_RED);
-               i2c_set_color(I2C_BALLBOARD_ADDR, I2C_COLOR_RED);
+               mainboard.our_color = I2C_COLOR_YELLOW;
+               i2c_set_color(I2C_COBBOARD_ADDR, I2C_COLOR_YELLOW);
+               i2c_set_color(I2C_BALLBOARD_ADDR, I2C_COLOR_YELLOW);
                auto_position();
        }
 
                auto_position();
        }
 
@@ -765,7 +765,7 @@ static void cmd_position_parsed(void * parsed_result, void * data)
 
 prog_char str_position_arg0[] = "position";
 parse_pgm_token_string_t cmd_position_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_position_result, arg0, str_position_arg0);
 
 prog_char str_position_arg0[] = "position";
 parse_pgm_token_string_t cmd_position_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_position_result, arg0, str_position_arg0);
-prog_char str_position_arg1[] = "show#reset#autoset_green#autoset_red";
+prog_char str_position_arg1[] = "show#reset#autoset_blue#autoset_red";
 parse_pgm_token_string_t cmd_position_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_position_result, arg1, str_position_arg1);
 
 prog_char help_position[] = "Show/reset (x,y,a) position";
 parse_pgm_token_string_t cmd_position_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_position_result, arg1, str_position_arg1);
 
 prog_char help_position[] = "Show/reset (x,y,a) position";
index 864b00b..6743d37 100644 (file)
@@ -81,7 +81,7 @@ struct strat_infos strat_infos = {
 
 void strat_set_bounding_box(void)
 {
 
 void strat_set_bounding_box(void)
 {
-       if (get_color() == I2C_COLOR_RED) {
+       if (get_color() == I2C_COLOR_YELLOW) {
                strat_infos.area_bbox.x1 = 300;
                strat_infos.area_bbox.y1 = 200;
                strat_infos.area_bbox.x2 = 2720; /* needed for c1 */
                strat_infos.area_bbox.x1 = 300;
                strat_infos.area_bbox.y1 = 200;
                strat_infos.area_bbox.x2 = 2720; /* needed for c1 */
index add640a..e92ff4f 100644 (file)
 #define _STRAT_H_
 
 /* convert coords according to our color */
 #define _STRAT_H_
 
 /* convert coords according to our color */
-#define COLOR_Y(y)     ((mainboard.our_color==I2C_COLOR_RED)? (y) : (AREA_Y-(y)))
-#define COLOR_A(a)     ((mainboard.our_color==I2C_COLOR_RED)? (a) : (-a))
-#define COLOR_SIGN(x)  ((mainboard.our_color==I2C_COLOR_RED)? (x) : (-x))
-#define COLOR_INVERT(x) ((mainboard.our_color==I2C_COLOR_RED)? (x) : (!x))
+#define COLOR_Y(y)     ((mainboard.our_color==I2C_COLOR_YELLOW)? (y) : (AREA_Y-(y)))
+#define COLOR_A(a)     ((mainboard.our_color==I2C_COLOR_YELLOW)? (a) : (-a))
+#define COLOR_SIGN(x)  ((mainboard.our_color==I2C_COLOR_YELLOW)? (x) : (-x))
+#define COLOR_INVERT(x) ((mainboard.our_color==I2C_COLOR_YELLOW)? (x) : (!x))
 
 /* area */
 #define AREA_X 3000
 
 /* area */
 #define AREA_X 3000
index b1bf942..06df8c7 100644 (file)
@@ -171,13 +171,13 @@ uint8_t robot_is_in_area(int16_t margin)
 }
 
 /* return 1 or 0 depending on which side of a line (y=cste) is the
 }
 
 /* return 1 or 0 depending on which side of a line (y=cste) is the
- * robot. works in red or green color. */
+ * robot. works in yellow or blue color. */
 uint8_t y_is_more_than(int16_t y)
 {
        int16_t posy;
        
        posy = position_get_y_s16(&mainboard.pos);
 uint8_t y_is_more_than(int16_t y)
 {
        int16_t posy;
        
        posy = position_get_y_s16(&mainboard.pos);
-       if (mainboard.our_color == I2C_COLOR_RED) {
+       if (mainboard.our_color == I2C_COLOR_YELLOW) {
                if (posy > y)
                        return 1;
                else
                if (posy > y)
                        return 1;
                else
@@ -192,7 +192,7 @@ uint8_t y_is_more_than(int16_t y)
 }
 
 /* return 1 or 0 depending on which side of a line (x=cste) is the
 }
 
 /* return 1 or 0 depending on which side of a line (x=cste) is the
- * robot. works in red or green color. */
+ * robot. works in yellow or blue color. */
 uint8_t x_is_more_than(int16_t x)
 {
        int16_t posx;
 uint8_t x_is_more_than(int16_t x)
 {
        int16_t posx;
@@ -256,10 +256,10 @@ uint8_t get_color(void)
 /* get the color of the opponent robot */
 uint8_t get_opponent_color(void)
 {
 /* get the color of the opponent robot */
 uint8_t get_opponent_color(void)
 {
-       if (mainboard.our_color == I2C_COLOR_RED)
-               return I2C_COLOR_GREEN;
+       if (mainboard.our_color == I2C_COLOR_YELLOW)
+               return I2C_COLOR_BLUE;
        else
        else
-               return I2C_COLOR_RED;
+               return I2C_COLOR_YELLOW;
 }
 
 /* get the xy pos of the opponent robot */
 }
 
 /* get the xy pos of the opponent robot */
index ca84489..782eac0 100644 (file)
@@ -296,15 +296,15 @@ static void cmd_start_parsed(void *parsed_result, void *data)
                gen.log_level = 0;
        }
 
                gen.log_level = 0;
        }
 
-       if (!strcmp_P(res->color, PSTR("red"))) {
-               mainboard.our_color = I2C_COLOR_RED;
-               i2c_set_color(I2C_MECHBOARD_ADDR, I2C_COLOR_RED);
-               i2c_set_color(I2C_SENSORBOARD_ADDR, I2C_COLOR_RED);
+       if (!strcmp_P(res->color, PSTR("yellow"))) {
+               mainboard.our_color = I2C_COLOR_YELLOW;
+               i2c_set_color(I2C_MECHBOARD_ADDR, I2C_COLOR_YELLOW);
+               i2c_set_color(I2C_SENSORBOARD_ADDR, I2C_COLOR_YELLOW);
        }
        }
-       else if (!strcmp_P(res->color, PSTR("green"))) {
-               mainboard.our_color = I2C_COLOR_GREEN;
-               i2c_set_color(I2C_MECHBOARD_ADDR, I2C_COLOR_GREEN);
-               i2c_set_color(I2C_SENSORBOARD_ADDR, I2C_COLOR_GREEN);
+       else if (!strcmp_P(res->color, PSTR("blue"))) {
+               mainboard.our_color = I2C_COLOR_BLUE;
+               i2c_set_color(I2C_MECHBOARD_ADDR, I2C_COLOR_BLUE);
+               i2c_set_color(I2C_SENSORBOARD_ADDR, I2C_COLOR_BLUE);
        }
 
        printf_P(PSTR("Check that lintel is loaded\r\n"));
        }
 
        printf_P(PSTR("Check that lintel is loaded\r\n"));
@@ -324,7 +324,7 @@ static void cmd_start_parsed(void *parsed_result, void *data)
 
 prog_char str_start_arg0[] = "start";
 parse_pgm_token_string_t cmd_start_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_start_result, arg0, str_start_arg0);
 
 prog_char str_start_arg0[] = "start";
 parse_pgm_token_string_t cmd_start_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_start_result, arg0, str_start_arg0);
-prog_char str_start_color[] = "green#red";
+prog_char str_start_color[] = "blue#yellow";
 parse_pgm_token_string_t cmd_start_color = TOKEN_STRING_INITIALIZER(struct cmd_start_result, color, str_start_color);
 prog_char str_start_debug[] = "debug#match";
 parse_pgm_token_string_t cmd_start_debug = TOKEN_STRING_INITIALIZER(struct cmd_start_result, debug, str_start_debug);
 parse_pgm_token_string_t cmd_start_color = TOKEN_STRING_INITIALIZER(struct cmd_start_result, color, str_start_color);
 prog_char str_start_debug[] = "debug#match";
 parse_pgm_token_string_t cmd_start_debug = TOKEN_STRING_INITIALIZER(struct cmd_start_result, debug, str_start_debug);
@@ -560,15 +560,15 @@ static void cmd_color_parsed(void *parsed_result, void *data)
        printf("not implemented\n");
 #else
        struct cmd_color_result *res = (struct cmd_color_result *) parsed_result;
        printf("not implemented\n");
 #else
        struct cmd_color_result *res = (struct cmd_color_result *) parsed_result;
-       if (!strcmp_P(res->color, PSTR("red"))) {
-               mainboard.our_color = I2C_COLOR_RED;
-               i2c_set_color(I2C_MECHBOARD_ADDR, I2C_COLOR_RED);
-               i2c_set_color(I2C_SENSORBOARD_ADDR, I2C_COLOR_RED);
+       if (!strcmp_P(res->color, PSTR("yellow"))) {
+               mainboard.our_color = I2C_COLOR_YELLOW;
+               i2c_set_color(I2C_MECHBOARD_ADDR, I2C_COLOR_YELLOW);
+               i2c_set_color(I2C_SENSORBOARD_ADDR, I2C_COLOR_YELLOW);
        }
        }
-       else if (!strcmp_P(res->color, PSTR("green"))) {
-               mainboard.our_color = I2C_COLOR_GREEN;
-               i2c_set_color(I2C_MECHBOARD_ADDR, I2C_COLOR_GREEN);
-               i2c_set_color(I2C_SENSORBOARD_ADDR, I2C_COLOR_GREEN);
+       else if (!strcmp_P(res->color, PSTR("blue"))) {
+               mainboard.our_color = I2C_COLOR_BLUE;
+               i2c_set_color(I2C_MECHBOARD_ADDR, I2C_COLOR_BLUE);
+               i2c_set_color(I2C_SENSORBOARD_ADDR, I2C_COLOR_BLUE);
        }
        printf_P(PSTR("Done\r\n"));
 #endif
        }
        printf_P(PSTR("Done\r\n"));
 #endif
@@ -576,7 +576,7 @@ static void cmd_color_parsed(void *parsed_result, void *data)
 
 prog_char str_color_arg0[] = "color";
 parse_pgm_token_string_t cmd_color_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_color_result, arg0, str_color_arg0);
 
 prog_char str_color_arg0[] = "color";
 parse_pgm_token_string_t cmd_color_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_color_result, arg0, str_color_arg0);
-prog_char str_color_color[] = "green#red";
+prog_char str_color_color[] = "blue#yellow";
 parse_pgm_token_string_t cmd_color_color = TOKEN_STRING_INITIALIZER(struct cmd_color_result, color, str_color_color);
 
 prog_char help_color[] = "Set our color";
 parse_pgm_token_string_t cmd_color_color = TOKEN_STRING_INITIALIZER(struct cmd_color_result, color, str_color_color);
 
 prog_char help_color[] = "Set our color";
@@ -1427,7 +1427,7 @@ struct cmd_pickup_test_result {
        int16_t dist;
 };
 
        int16_t dist;
 };
 
-/* return red or green sensor */
+/* return yellow or blue sensor */
 #define COLOR_IR_SENSOR()                                              \
        ({                                                              \
                uint8_t __ret = 0;                                      \
 #define COLOR_IR_SENSOR()                                              \
        ({                                                              \
                uint8_t __ret = 0;                                      \
index f693820..e84e4e3 100644 (file)
@@ -769,19 +769,19 @@ static void cmd_position_parsed(void * parsed_result, void * data)
        else if (!strcmp_P(res->arg1, PSTR("set"))) {
                position_set(&mainboard.pos, res->arg2, res->arg3, res->arg4);
        }
        else if (!strcmp_P(res->arg1, PSTR("set"))) {
                position_set(&mainboard.pos, res->arg2, res->arg3, res->arg4);
        }
-       else if (!strcmp_P(res->arg1, PSTR("autoset_green"))) {
-               mainboard.our_color = I2C_COLOR_GREEN;
+       else if (!strcmp_P(res->arg1, PSTR("autoset_blue"))) {
+               mainboard.our_color = I2C_COLOR_BLUE;
 #ifndef HOST_VERSION
 #ifndef HOST_VERSION
-               i2c_set_color(I2C_MECHBOARD_ADDR, I2C_COLOR_GREEN);
-               i2c_set_color(I2C_SENSORBOARD_ADDR, I2C_COLOR_GREEN);
+               i2c_set_color(I2C_MECHBOARD_ADDR, I2C_COLOR_BLUE);
+               i2c_set_color(I2C_SENSORBOARD_ADDR, I2C_COLOR_BLUE);
 #endif
                auto_position();
        }
        else if (!strcmp_P(res->arg1, PSTR("autoset_red"))) {
 #endif
                auto_position();
        }
        else if (!strcmp_P(res->arg1, PSTR("autoset_red"))) {
-               mainboard.our_color = I2C_COLOR_RED;
+               mainboard.our_color = I2C_COLOR_YELLOW;
 #ifndef HOST_VERSION
 #ifndef HOST_VERSION
-               i2c_set_color(I2C_MECHBOARD_ADDR, I2C_COLOR_RED);
-               i2c_set_color(I2C_SENSORBOARD_ADDR, I2C_COLOR_RED);
+               i2c_set_color(I2C_MECHBOARD_ADDR, I2C_COLOR_YELLOW);
+               i2c_set_color(I2C_SENSORBOARD_ADDR, I2C_COLOR_YELLOW);
 #endif
                auto_position();
        }
 #endif
                auto_position();
        }
@@ -795,7 +795,7 @@ static void cmd_position_parsed(void * parsed_result, void * data)
 
 prog_char str_position_arg0[] = "position";
 parse_pgm_token_string_t cmd_position_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_position_result, arg0, str_position_arg0);
 
 prog_char str_position_arg0[] = "position";
 parse_pgm_token_string_t cmd_position_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_position_result, arg0, str_position_arg0);
-prog_char str_position_arg1[] = "show#reset#autoset_green#autoset_red";
+prog_char str_position_arg1[] = "show#reset#autoset_blue#autoset_red";
 parse_pgm_token_string_t cmd_position_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_position_result, arg1, str_position_arg1);
 
 prog_char help_position[] = "Show/reset (x,y,a) position";
 parse_pgm_token_string_t cmd_position_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_position_result, arg1, str_position_arg1);
 
 prog_char help_position[] = "Show/reset (x,y,a) position";
index fdb5d49..47207fc 100644 (file)
@@ -31,8 +31,8 @@
 #define I2C_AUTO_SIDE   2 /* for prepare_pickup */
 #define I2C_CENTER_SIDE 3 /* for prepare_pickup */
 
 #define I2C_AUTO_SIDE   2 /* for prepare_pickup */
 #define I2C_CENTER_SIDE 3 /* for prepare_pickup */
 
-#define I2C_COLOR_RED   0
-#define I2C_COLOR_GREEN 1
+#define I2C_COLOR_YELLOW   0
+#define I2C_COLOR_BLUE 1
 
 #define I2C_AUTOBUILD_DEFAULT_DIST 210
 
 
 #define I2C_AUTOBUILD_DEFAULT_DIST 210
 
index 4cc17fb..dc6d865 100644 (file)
@@ -183,11 +183,11 @@ struct strat_infos strat_infos = {
        
        /* lintel dispensers */
        .l1 = {
        
        /* lintel dispensers */
        .l1 = {
-               .x = 912, /* XXX for red only */
+               .x = 912, /* XXX for yellow only */
                .name = "lin_disp1",
        },
        .l2 = {
                .name = "lin_disp1",
        },
        .l2 = {
-               .x = 1312,  /* XXX for red only */
+               .x = 1312,  /* XXX for yellow only */
                .name = "lin_disp2",
        },
 
                .name = "lin_disp2",
        },
 
@@ -244,7 +244,7 @@ struct strat_infos strat_infos = {
 
 void strat_set_bounding_box(void)
 {
 
 void strat_set_bounding_box(void)
 {
-       if (get_color() == I2C_COLOR_RED) {
+       if (get_color() == I2C_COLOR_YELLOW) {
                strat_infos.area_bbox.x1 = 300;
                strat_infos.area_bbox.y1 = 200;
                strat_infos.area_bbox.x2 = 2720; /* needed for c1 */
                strat_infos.area_bbox.x1 = 300;
                strat_infos.area_bbox.y1 = 200;
                strat_infos.area_bbox.x2 = 2720; /* needed for c1 */
@@ -273,7 +273,7 @@ void strat_preinit(void)
 
 #ifndef HOST_VERSION
        i2c_mechboard_mode_init();
 
 #ifndef HOST_VERSION
        i2c_mechboard_mode_init();
-       if (get_color() == I2C_COLOR_RED)
+       if (get_color() == I2C_COLOR_YELLOW)
                i2c_mechboard_mode_prepare_pickup(I2C_LEFT_SIDE);
        else
                i2c_mechboard_mode_prepare_pickup(I2C_RIGHT_SIDE);
                i2c_mechboard_mode_prepare_pickup(I2C_LEFT_SIDE);
        else
                i2c_mechboard_mode_prepare_pickup(I2C_RIGHT_SIDE);
@@ -537,7 +537,7 @@ void strat_reset_infos(void)
        strat_set_bounding_box();
 
        /* set lintel position, depending on color */
        strat_set_bounding_box();
 
        /* set lintel position, depending on color */
-       if (mainboard.our_color == I2C_COLOR_RED) {
+       if (mainboard.our_color == I2C_COLOR_YELLOW) {
                strat_infos.l1.x = 912;
                strat_infos.l2.x = 1312;
        }
                strat_infos.l1.x = 912;
                strat_infos.l2.x = 1312;
        }
index 2b2b96a..e79d195 100644 (file)
 #define _STRAT_H_
 
 /* convert coords according to our color */
 #define _STRAT_H_
 
 /* convert coords according to our color */
-#define COLOR_Y(y)     ((mainboard.our_color==I2C_COLOR_RED)? (y) : (AREA_Y-(y)))
-#define COLOR_A(a)     ((mainboard.our_color==I2C_COLOR_RED)? (a) : (-a))
-#define COLOR_SIGN(x)  ((mainboard.our_color==I2C_COLOR_RED)? (x) : (-x))
-#define COLOR_INVERT(x) ((mainboard.our_color==I2C_COLOR_RED)? (x) : (!x))
+#define COLOR_Y(y)     ((mainboard.our_color==I2C_COLOR_YELLOW)? (y) : (AREA_Y-(y)))
+#define COLOR_A(a)     ((mainboard.our_color==I2C_COLOR_YELLOW)? (a) : (-a))
+#define COLOR_SIGN(x)  ((mainboard.our_color==I2C_COLOR_YELLOW)? (x) : (-x))
+#define COLOR_INVERT(x) ((mainboard.our_color==I2C_COLOR_YELLOW)? (x) : (!x))
 
 /* area */
 #define AREA_X 3000
 
 /* area */
 #define AREA_X 3000
@@ -56,7 +56,7 @@
  *    C2       6  7  8   v                  C2 
  *     |------ 9 10 11   .            ------| 
  *     |     |           .            |     | 
  *    C2       6  7  8   v                  C2 
  *     |------ 9 10 11   .            ------| 
  *     |     |           .            |     | 
- *     | red |           .            |green
+ *     | yellow |           .            |blue
  *     +-----+--L1--L2-------L2--L1---+-----+
  *                       x
  */
  *     +-----+--L1--L2-------L2--L1---+-----+
  *                       x
  */
index 57c5a0b..6e1bef8 100644 (file)
@@ -173,13 +173,13 @@ uint8_t robot_is_near_disc(void)
 }
 
 /* return 1 or 0 depending on which side of a line (y=cste) is the
 }
 
 /* return 1 or 0 depending on which side of a line (y=cste) is the
- * robot. works in red or green color. */
+ * robot. works in yellow or blue color. */
 uint8_t y_is_more_than(int16_t y)
 {
        int16_t posy;
        
        posy = position_get_y_s16(&mainboard.pos);
 uint8_t y_is_more_than(int16_t y)
 {
        int16_t posy;
        
        posy = position_get_y_s16(&mainboard.pos);
-       if (mainboard.our_color == I2C_COLOR_RED) {
+       if (mainboard.our_color == I2C_COLOR_YELLOW) {
                if (posy > y)
                        return 1;
                else
                if (posy > y)
                        return 1;
                else
@@ -194,7 +194,7 @@ uint8_t y_is_more_than(int16_t y)
 }
 
 /* return 1 or 0 depending on which side of a line (x=cste) is the
 }
 
 /* return 1 or 0 depending on which side of a line (x=cste) is the
- * robot. works in red or green color. */
+ * robot. works in yellow or blue color. */
 uint8_t x_is_more_than(int16_t x)
 {
        int16_t posx;
 uint8_t x_is_more_than(int16_t x)
 {
        int16_t posx;
@@ -258,10 +258,10 @@ uint8_t get_color(void)
 /* get the color of the opponent robot */
 uint8_t get_opponent_color(void)
 {
 /* get the color of the opponent robot */
 uint8_t get_opponent_color(void)
 {
-       if (mainboard.our_color == I2C_COLOR_RED)
-               return I2C_COLOR_GREEN;
+       if (mainboard.our_color == I2C_COLOR_YELLOW)
+               return I2C_COLOR_BLUE;
        else
        else
-               return I2C_COLOR_RED;
+               return I2C_COLOR_YELLOW;
 }
 
 /* get the xy pos of the opponent robot */
 }
 
 /* get the xy pos of the opponent robot */
index 74d116d..e27babf 100644 (file)
@@ -665,7 +665,7 @@ static void cmd_position_parsed(void * parsed_result, void * data)
        else if (!strcmp_P(res->arg1, PSTR("set"))) {
                position_set(&mainboard.pos, res->arg2, res->arg3, res->arg4);
        }
        else if (!strcmp_P(res->arg1, PSTR("set"))) {
                position_set(&mainboard.pos, res->arg2, res->arg3, res->arg4);
        }
-       else if (!strcmp_P(res->arg1, PSTR("autoset_green"))) {
+       else if (!strcmp_P(res->arg1, PSTR("autoset_blue"))) {
                auto_position();
        }
        else if (!strcmp_P(res->arg1, PSTR("autoset_red"))) {
                auto_position();
        }
        else if (!strcmp_P(res->arg1, PSTR("autoset_red"))) {
@@ -681,7 +681,7 @@ static void cmd_position_parsed(void * parsed_result, void * data)
 
 prog_char str_position_arg0[] = "position";
 parse_pgm_token_string_t cmd_position_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_position_result, arg0, str_position_arg0);
 
 prog_char str_position_arg0[] = "position";
 parse_pgm_token_string_t cmd_position_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_position_result, arg0, str_position_arg0);
-prog_char str_position_arg1[] = "show#reset#autoset_green#autoset_red";
+prog_char str_position_arg1[] = "show#reset#autoset_blue#autoset_red";
 parse_pgm_token_string_t cmd_position_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_position_result, arg1, str_position_arg1);
 
 prog_char help_position[] = "Show/reset (x,y,a) position";
 parse_pgm_token_string_t cmd_position_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_position_result, arg1, str_position_arg1);
 
 prog_char help_position[] = "Show/reset (x,y,a) position";
index 2816744..4f510f2 100644 (file)
@@ -182,13 +182,13 @@ uint8_t robot_is_in_area(int16_t margin)
 /* } */
 
 /* /\* return 1 or 0 depending on which side of a line (y=cste) is the */
 /* } */
 
 /* /\* return 1 or 0 depending on which side of a line (y=cste) is the */
-/*  * robot. works in red or green color. *\/ */
+/*  * robot. works in yellow or blue color. *\/ */
 /* uint8_t y_is_more_than(int16_t y) */
 /* { */
 /*     int16_t posy; */
        
 /*     posy = position_get_y_s16(&mainboard.pos); */
 /* uint8_t y_is_more_than(int16_t y) */
 /* { */
 /*     int16_t posy; */
        
 /*     posy = position_get_y_s16(&mainboard.pos); */
-/*     if (mainboard.our_color == I2C_COLOR_RED) { */
+/*     if (mainboard.our_color == I2C_COLOR_YELLOW) { */
 /*             if (posy > y) */
 /*                     return 1; */
 /*             else */
 /*             if (posy > y) */
 /*                     return 1; */
 /*             else */
@@ -203,7 +203,7 @@ uint8_t robot_is_in_area(int16_t margin)
 /* } */
 
 /* return 1 or 0 depending on which side of a line (x=cste) is the
 /* } */
 
 /* return 1 or 0 depending on which side of a line (x=cste) is the
- * robot. works in red or green color. */
+ * robot. works in yellow or blue color. */
 uint8_t x_is_more_than(int16_t x)
 {
        int16_t posx;
 uint8_t x_is_more_than(int16_t x)
 {
        int16_t posx;
@@ -267,10 +267,10 @@ uint8_t get_color(void)
 /* /\* get the color of the opponent robot *\/ */
 /* uint8_t get_opponent_color(void) */
 /* { */
 /* /\* get the color of the opponent robot *\/ */
 /* uint8_t get_opponent_color(void) */
 /* { */
-/*     if (mainboard.our_color == I2C_COLOR_RED) */
-/*             return I2C_COLOR_GREEN; */
+/*     if (mainboard.our_color == I2C_COLOR_YELLOW) */
+/*             return I2C_COLOR_BLUE; */
 /*     else */
 /*     else */
-/*             return I2C_COLOR_RED; */
+/*             return I2C_COLOR_YELLOW; */
 /* } */
 
 /* /\* get the xy pos of the opponent robot *\/ */
 /* } */
 
 /* /\* get the xy pos of the opponent robot *\/ */