summaryrefslogtreecommitdiff
path: root/n/accel/accel.c
diff options
context:
space:
mode:
authorburg2004-09-21 16:41:08 +0000
committerburg2004-09-21 16:41:08 +0000
commit2f9746bd5c5dd83b66dbd832d34c22ab4afde10a (patch)
treec0604c71a20978a3543b9ab22022f1e2320f6ccc /n/accel/accel.c
parente13b9ba42de78ef57f11ad0a2f45f4f4648fce77 (diff)
Correction de la méthode de calcul de l'accélération.
Diffstat (limited to 'n/accel/accel.c')
-rw-r--r--n/accel/accel.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/n/accel/accel.c b/n/accel/accel.c
index eaa848a..fb63fc9 100644
--- a/n/accel/accel.c
+++ b/n/accel/accel.c
@@ -130,6 +130,8 @@ test_callback (uint8_t c, uint8_t argc, proto_arg_t argv[])
break;
case 'y' : proto_send2('Y',Ty >> 8, Tx);
break;
+ case 'r' : proto_send2('R',T2 >> 8, T2);
+ break;
case 't' : proto_send2('T',Timer1 >> 8, Timer1);
break;
case 'g' : proto_send2('x',Gx >> 8, Gx);
@@ -142,7 +144,7 @@ test_callback (uint8_t c, uint8_t argc, proto_arg_t argv[])
rs232_putc('V');
proto_send2('y',Vy >> 8,Vy);
break;
- case 'z' : reset;
+ case 'z' : reset();
default : proto_send1('E',2); //erreur 2 Command incorrect
}
}
@@ -161,12 +163,12 @@ int
main (void)
{
//initialisation
- rs232_init();
+ rs232_init();
proto_init(test_callback,rs232_putc);
proto_send0('Z');
- //initialisation du timer prescaler 254
+ //initialisation du timer prescaler 256
TCCR1B = _BV(ICES1) | _BV(CS12);
// Input Capture Interrupt enable & Timer 1 overflow
TIMSK = _BV(TICIE1) | _BV(TOIE1);
@@ -189,10 +191,10 @@ main (void)
T2 = (Td + Tc - Tb) /2;
// remise de TCNT1 pour mesurer le temps
TCNT1 = 0;
- Gx = calculG(Tx,T2_cal,G0x);
- Gy = calculG(Ty,T2_cal,G0y);
- Vx += (Gx) >> 8;
- Vy += (Gy) >> 8;
+ Gx = calculGb(Tx,T2,T1x_cal);
+ Gy = calculGb(Ty,T2,T1y_cal);
+ Vx +=Gx;
+ Vy +=Gy;
Timer1 = TCNT1;
//remise dans l'tat de capture
//Todo : remettre dans cet tat plutt