git.droids-corp.org
/
aversive.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
017dbe8
)
forbid strat_eject() when we are not on correct line
author
zer0
<zer0@carbon.local>
Fri, 7 May 2010 23:42:32 +0000
(
01:42
+0200)
committer
zer0
<zer0@carbon.local>
Fri, 7 May 2010 23:42:32 +0000
(
01:42
+0200)
projects/microb2010/mainboard/strat.c
patch
|
blob
|
history
diff --git
a/projects/microb2010/mainboard/strat.c
b/projects/microb2010/mainboard/strat.c
index
152c173
..
ccd1f02
100644
(file)
--- a/
projects/microb2010/mainboard/strat.c
+++ b/
projects/microb2010/mainboard/strat.c
@@
-285,17
+285,37
@@
void strat_event(void *dummy)
//strat_limit_speed();
}
//strat_limit_speed();
}
+/* check that we are on an eject line */
+static uint8_t robot_is_on_eject_line(void)
+{
+ int16_t x, y;
+ uint8_t i, j;
+
+ x = position_get_x_s16(&mainboard.pos);
+ y = position_get_y_s16(&mainboard.pos);
+
+ if (xycoord_to_ijcoord(&x, &y, &i, &j) < 0)
+ return 0;
+
+ if (!wp_belongs_to_line(i, j, 5, LINE_UP) &&
+ !wp_belongs_to_line(i, j, 2, LINE_R_UP))
+ return 0;
+
+ return 1;
+}
/* must be called from a terminal line */
static uint8_t strat_eject(void)
{
uint8_t err;
/* must be called from a terminal line */
static uint8_t strat_eject(void)
{
uint8_t err;
- /* XXX MUST be a on the line !! */
- //XXX return vals
-
DEBUG(E_USER_STRAT, "%s()", __FUNCTION__);
DEBUG(E_USER_STRAT, "%s()", __FUNCTION__);
+ if (!robot_is_on_eject_line()) {
+ DEBUG(E_USER_STRAT, "%s() not on eject line", __FUNCTION__);
+ return END_ERROR;
+ }
+
/* go to eject point */
trajectory_goto_xy_abs(&mainboard.traj, 2625, COLOR_Y(1847));
err = WAIT_COND_OR_TRAJ_END(get_cob_count() >= 5,
/* go to eject point */
trajectory_goto_xy_abs(&mainboard.traj, 2625, COLOR_Y(1847));
err = WAIT_COND_OR_TRAJ_END(get_cob_count() >= 5,