summaryrefslogtreecommitdiff
path: root/n/asserv/src/goto.c
diff options
context:
space:
mode:
Diffstat (limited to 'n/asserv/src/goto.c')
-rw-r--r--n/asserv/src/goto.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/n/asserv/src/goto.c b/n/asserv/src/goto.c
index 552f853..07ab840 100644
--- a/n/asserv/src/goto.c
+++ b/n/asserv/src/goto.c
@@ -54,7 +54,7 @@ uint8_t goto_finish;
/* -AutoDec */
/** Linear control mode. */
-static void
+void
goto_linear_mode (void)
{
uint16_t d;
@@ -72,7 +72,8 @@ goto_linear_mode (void)
speed_right = 0;
speed_left_aim = 0;
speed_right_aim = 0;
- goto_finish = 1;
+ if (!goto_finish)
+ goto_finish = 1;
}
else
{
@@ -98,7 +99,7 @@ goto_linear (int16_t d)
}
/** Angular control mode. */
-static void
+void
goto_angular_mode (void)
{
int32_t angle_diff;
@@ -113,7 +114,8 @@ goto_angular_mode (void)
speed_right = 0;
speed_left_aim = 0;
speed_right_aim = 0;
- goto_finish = 1;
+ if (!goto_finish)
+ goto_finish = 1;
}
else
{
@@ -135,7 +137,7 @@ goto_angular (int8_t a)
}
/** Position control mode. */
-static void
+static inline void
goto_position_mode (void)
{
int32_t c, s, arc;
@@ -149,7 +151,8 @@ goto_position_mode (void)
speed_right = 0;
speed_left_aim = 0;
speed_right_aim = 0;
- goto_finish = 1;
+ if (!goto_finish)
+ goto_finish = 1;
}
else
{
@@ -228,7 +231,8 @@ goto_position_exact_mode (void)
{
speed_left_aim = 0;
speed_right_aim = 0;
- goto_finish = 1;
+ if (!goto_finish)
+ goto_finish = 1;
}
else
{
@@ -243,7 +247,7 @@ goto_position_exact_mode (void)
}
/** Counter control mode. */
-static void
+void
goto_counter_mode (void)
{
int16_t dl, dr;
@@ -253,7 +257,8 @@ goto_counter_mode (void)
if (dl < 3 && dl > -3
&& dr < 3 && dr > -3)
{
- goto_finish = 1;
+ if (!goto_finish)
+ goto_finish = 1;
}
dl248 = dl;
dr248 = dr;
@@ -272,7 +277,7 @@ goto_counter (int16_t l, int16_t r)
}
/** We fuck the wall mode. */
-static void
+void
goto_ftw_mode (void)
{
/* Change speed. */
@@ -295,7 +300,8 @@ goto_ftw_mode (void)
speed_right_aim = 0;
}
if (!(PINA & (_BV (0) | _BV (7))))
- goto_finish = 1;
+ if (!goto_finish)
+ goto_finish = 1;
}
/** Setup ftw mode. */
@@ -309,7 +315,7 @@ goto_ftw (int8_t s)
}
/** Update the speed according to the desired destination. */
-static void
+void
goto_update (void)
{
switch (goto_mode)
@@ -321,7 +327,7 @@ goto_update (void)
goto_angular_mode ();
break;
case 2:
- goto_position_mode ();
+ //goto_position_mode ();
break;
case 4:
goto_counter_mode ();