X-Git-Url: http://git.droids-corp.org/?p=aversive.git;a=blobdiff_plain;f=projects%2Fmicrob2010%2Fmainboard%2Fstrat_corn.c;h=8d3f839cd5e9bb93220485eb4c42e1d419bcca68;hp=5224787a5976685669d9ff17431d283cc471ba1a;hb=38196781643cba8e1d681aafb28cdadc51fe20ec;hpb=9d056416278ae5d772a0fc1f7d2d11a4461fb673 diff --git a/projects/microb2010/mainboard/strat_corn.c b/projects/microb2010/mainboard/strat_corn.c index 5224787..8d3f839 100644 --- a/projects/microb2010/mainboard/strat_corn.c +++ b/projects/microb2010/mainboard/strat_corn.c @@ -66,9 +66,8 @@ #include "sensor.h" #include "actuator.h" -#if 0 /* return 1 if there is a corn near, and fill the index ptr */ -uint8_t corn_is_near(int8_t *corn_idx, uint8_t side) +int8_t corn_is_near(uint8_t *corn_idx, uint8_t side) { #define SENSOR_CORN_DIST 225 #define SENSOR_CORN_ANGLE 90 @@ -91,11 +90,11 @@ uint8_t corn_is_near(int8_t *corn_idx, uint8_t side) y_corn_int = y_corn; wp = xycoord_to_corn_idx(&x_corn_int, &y_corn_int); - if (wp->corn.idx < 0) + if (wp == NULL) return 0; + *corn_idx = wp->corn.idx; return 1; } -#endif /* * - send the correct commands to the spickles @@ -219,9 +218,11 @@ uint8_t line2line(uint8_t dir1, uint8_t num1, strat_get_speed(&d_speed, &a_speed); /* XXX 600 -> cste */ - if (err == 0 && d_speed < 600 && - mainboard.traj.state == RUNNING_CLITOID_LINE) - strat_set_speed(600, SPEED_ANGLE_FAST); + /* XXX does not work, do better */ +/* if (err == 0 && d_speed < 600 && */ +/* mainboard.traj.state == RUNNING_CLITOID_LINE) */ +/* strat_set_speed(600, SPEED_ANGLE_FAST); */ + err = wait_traj_end(0xFF); return err;