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);
-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";
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);
-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";
#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
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();
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);
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);
-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";
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"))) {
- 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();
}
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";
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 */
#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
}
/* 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);
- if (mainboard.our_color == I2C_COLOR_RED) {
+ if (mainboard.our_color == I2C_COLOR_YELLOW) {
if (posy > y)
return 1;
else
}
/* 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;
/* 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
- return I2C_COLOR_RED;
+ return I2C_COLOR_YELLOW;
}
/* get the xy pos of the opponent robot */
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"));
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);
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
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";
int16_t dist;
};
-/* return red or green sensor */
+/* return yellow or blue sensor */
#define COLOR_IR_SENSOR() \
({ \
uint8_t __ret = 0; \
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
- 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"))) {
- mainboard.our_color = I2C_COLOR_RED;
+ mainboard.our_color = I2C_COLOR_YELLOW;
#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();
}
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";
#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
/* lintel dispensers */
.l1 = {
- .x = 912, /* XXX for red only */
+ .x = 912, /* XXX for yellow only */
.name = "lin_disp1",
},
.l2 = {
- .x = 1312, /* XXX for red only */
+ .x = 1312, /* XXX for yellow only */
.name = "lin_disp2",
},
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 */
#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);
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;
}
#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
* C2 6 7 8 v C2
* |------ 9 10 11 . ------|
* | | . | |
- * | red | . |green|
+ * | yellow | . |blue|
* +-----+--L1--L2-------L2--L1---+-----+
* x
*/
}
/* 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);
- if (mainboard.our_color == I2C_COLOR_RED) {
+ if (mainboard.our_color == I2C_COLOR_YELLOW) {
if (posy > y)
return 1;
else
}
/* 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;
/* 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
- return I2C_COLOR_RED;
+ return I2C_COLOR_YELLOW;
}
/* get the xy pos of the opponent robot */
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"))) {
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";
/* } */
/* /\* 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); */
-/* if (mainboard.our_color == I2C_COLOR_RED) { */
+/* if (mainboard.our_color == I2C_COLOR_YELLOW) { */
/* if (posy > y) */
/* return 1; */
/* else */
/* } */
/* 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;
/* /\* 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 */
-/* return I2C_COLOR_RED; */
+/* return I2C_COLOR_YELLOW; */
/* } */
/* /\* get the xy pos of the opponent robot *\/ */