summaryrefslogtreecommitdiff
path: root/n/asserv/src
diff options
context:
space:
mode:
authorschodet2005-01-18 11:52:35 +0000
committerschodet2005-01-18 11:52:35 +0000
commit738cf14d7426cfe5725ede86c2bfb58320da189a (patch)
tree93bb81964119bfc5c942f6f8dc996a6725fc8759 /n/asserv/src
parentdbca5be8de1fb0e50bc9356d19d11c2dd9344629 (diff)
Ajout vérification de débordement à corriger.
Diffstat (limited to 'n/asserv/src')
-rw-r--r--n/asserv/src/postrack.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/n/asserv/src/postrack.c b/n/asserv/src/postrack.c
index 5af427e..646a67b 100644
--- a/n/asserv/src/postrack.c
+++ b/n/asserv/src/postrack.c
@@ -36,7 +36,7 @@ uint16_t postrack_footing;
* must divide by 2pi to convert unit (Arc=Angle * Radius only works for
* radians).
* - dd (see postrack_update) is in f11.16 format, we multiply by 256 to have
- * a angle in 8.24 format.
+ * a angle in f8.24 format.
* - this factor is in f8.24 format, therefore, 1 is writen (1L << 24). */
int32_t postrack_footing_factor;
@@ -80,8 +80,11 @@ postrack_update (void)
{
dd = counter_right_diff - counter_left_diff; /* 11b */
dd <<= 16; /* 11.16b */
- da = dsp_mul_f824 (dd, postrack_footing_factor);
- // XXX: WARNING ! could r overflow ?
+ da = dsp_mul_f824 (dd, postrack_footing_factor);/* 8.24b */
+ // XXX: WARNING ! could r overflow ? Yes :,-(
+ // Should try too divide by da later, but this means two divisions
+ // instead of one.
+ // Also, this division is false because da is not radians !
r = dsp_div_f824 (d, da); /* 16.16b */
na = postrack_a + da;
postrack_x +=