X-Git-Url: http://git.droids-corp.org/?p=aversive.git;a=blobdiff_plain;f=projects%2Fmicrob2010%2Fmainboard%2Fstrat_db.c;h=9fe4329ea423c57ba19cee5fad04140bec631491;hp=d2835fe76a6022a247bbb49a367bba92d564686a;hb=cc67fe587de07a329525c8f5c8ecfd1fabbf83b8;hpb=17aadc4c8c3e60c2b5e6bbba91c8542849addbd7 diff --git a/projects/microb2010/mainboard/strat_db.c b/projects/microb2010/mainboard/strat_db.c index d2835fe..9fe4329 100644 --- a/projects/microb2010/mainboard/strat_db.c +++ b/projects/microb2010/mainboard/strat_db.c @@ -149,7 +149,10 @@ int8_t ijcoord_to_xycoord(uint8_t i, uint8_t j, int16_t *x, int16_t *y) if (i >= WAYPOINTS_NBX && j >= WAYPOINTS_NBY) return -1; *x = (OFFSET_CORN_X + i*STEP_CORN_X); - *y = COLOR_Y(OFFSET_CORN_Y + j*STEP_CORN_Y); + if (i&1) + *y = COLOR_Y(OFFSET_CORN_Y + j*STEP_CORN_Y + STEP_CORN_Y/2); + else + *y = COLOR_Y(OFFSET_CORN_Y + j*STEP_CORN_Y); return 0; } @@ -173,10 +176,14 @@ int8_t xycoord_to_ijcoord(int16_t *xp, int16_t *yp, uint8_t *ip, uint8_t *jp) if ((i & 1) == 1) { j = y / STEP_CORN_Y; } + else if ((i & 3) == 0) { + j = y / (STEP_CORN_Y*2); + j = j*2 + 1; + } else { - y += (STEP_CORN_Y/2); - y /= (STEP_CORN_Y*2); - j = (y * 2) + 1; + y += (STEP_CORN_Y); + j = y / (STEP_CORN_Y*2); + j = j*2; } if (ijcoord_to_xycoord(i, j, &x, &y) < 0) @@ -194,7 +201,6 @@ int8_t xycoord_to_ijcoord(int16_t *xp, int16_t *yp, uint8_t *ip, uint8_t *jp) return 0; } - /******** CORN */ /* return the index of a corn given its i,j coords. */ @@ -492,7 +498,6 @@ void strat_db_init(void) /* tomato */ idx = ijcoord_to_tomato_idx(i, j); if (idx >= 0) { - printf("%d %d\n", i, j); wp->type = WP_TYPE_TOMATO; wp->present = 1; wp->tomato.idx = idx;