summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--n/asserv/src/goto.c4
-rw-r--r--n/asserv/src/taz.c100
2 files changed, 90 insertions, 14 deletions
diff --git a/n/asserv/src/goto.c b/n/asserv/src/goto.c
index 1d8dffb..721eba4 100644
--- a/n/asserv/src/goto.c
+++ b/n/asserv/src/goto.c
@@ -254,8 +254,8 @@ goto_counter_mode (void)
int32_t dl248, dr248;
dl = goto_counter_left - counter_left;
dr = goto_counter_right - counter_right;
- if (dl < 20 && dl > -20
- && dr < 20 && dr > -20)
+ if (dl < 100 && dl > -100
+ && dr < 100 && dr > -100)
{
if (!goto_finish)
goto_finish = 1;
diff --git a/n/asserv/src/taz.c b/n/asserv/src/taz.c
index 533f634..da5eff1 100644
--- a/n/asserv/src/taz.c
+++ b/n/asserv/src/taz.c
@@ -358,7 +358,7 @@ taz_state_1 (void)
/* Démare les sharps. */
twi_master_read (0x02, (uint8_t *) motor_sharps, 12);
motor_print_sharps_cpt = 1;
- motor_print_sharps = 8;
+ motor_print_sharps = 4;
motor_print_sharps_no_send = 1;
}
break;
@@ -598,32 +598,107 @@ taz_state_2 (void)
break;
case 26:
if (goto_finish)
- taz_substate = 28;
+ taz_substate = 30;
else if (taz_test_socles ())
taz_substate = 27;
break;
case 27:
if (taz_dir_socle ())
{
- taz_substate = 28;
+ taz_substate = 30;
goto_linear (450 * taz_scale);
}
break;
- case 28:
+
+ case 30:
+ if (goto_finish)
+ {
+ taz_substate = 31;
+ /* Direction notre camps pour shooter les quilles gratuites. */
+ goto_angular (0x80);
+ }
+ break;
+ case 31:
+ if (goto_finish)
+ {
+ taz_substate = 32;
+ /* Vers le pont. */
+ goto_linear (((uint32_t) OR2 + 400 - (postrack_x >> 8)) * taz_scale);
+ }
+ break;
+ case 32:
+ if (goto_finish)
+ {
+ taz_substate = 33;
+ /* 90° */
+ goto_angular (0xc0);
+ }
+ break;
+ case 33:
+ if (goto_finish)
+ {
+ taz_substate = 34;
+ /* Vers le milieu. */
+ goto_linear (((uint32_t) 900 - 55 + (postrack_y >> 8)) * taz_scale);
+ }
+ break;
+ case 34:
+ if (goto_finish)
+ {
+ taz_substate = 35;
+ /* Direction les quilles. */
+ goto_angular (0x80);
+ }
+ break;
+ case 35:
+ if (goto_finish)
+ {
+ taz_substate = 36;
+ /* Shoote les quilles. */
+ goto_linear (300 * taz_scale);
+ }
+ break;
+ case 36:
+ if (goto_finish)
+ {
+ taz_substate = 40;
+ /* Shoote les quilles. */
+ goto_linear (-300 * taz_scale);
+ }
+ break;
+
+ case 40:
+ if (goto_finish)
+ {
+ taz_substate = 41;
+ goto_angular (0x20);
+ }
+ break;
+ case 41:
+ if (goto_finish)
+ {
+ r = taz_find_quilles (0x40, 0);
+ if (r)
+ {
+ taz_substate = 42;
+ goto_linear (600 * taz_scale);
+ }
+ }
+ break;
+ case 42:
if (goto_finish)
{
- taz_substate = 29;
- goto_angular (0x60);
+ taz_substate = 43;
+ goto_angular (0x20);
}
break;
- case 29:
+ case 43:
if (goto_finish)
{
- uint8_t a = v32_to_v8 (postrack_a, 2) + 0xf0;
- r = taz_find_quilles (a, 0);
- if (r == 1)
+ r = taz_find_quilles (0xe0, 1);
+ if (r)
{
- taz_substate = 26;
+ taz_substate = 44;
goto_linear (600 * taz_scale);
}
}
@@ -700,7 +775,8 @@ taz_update (void)
&& (speed_right_e_old == speed_e_sat || speed_right_e_old == -speed_e_sat))
{
speed_restart ();
- goto_counter (-70 * taz_scale, -100 * taz_scale);
+ goto_counter (speed_left_e_old == speed_e_sat ? -70 * taz_scale : 70 * taz_scale,
+ speed_right_e_old == speed_e_sat ? -100 * taz_scale : 100 * taz_scale);
taz_bloc = 1;
proto_send1b ('b', 1);
return;