From af22488810653fdbc36f23a0cc622d371918a3ad Mon Sep 17 00:00:00 2001 From: dalmais Date: Sun, 1 May 2005 18:57:43 +0000 Subject: changement de la manière dont est renvoyé les valeurs de la tourelle. --- n/es/src/main.c | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) (limited to 'n') diff --git a/n/es/src/main.c b/n/es/src/main.c index 973e320..bc8cb41 100644 --- a/n/es/src/main.c +++ b/n/es/src/main.c @@ -84,13 +84,15 @@ int main (void) uint8_t temp_sens = 1; uint8_t compteur = 0; uint16_t tableau_sharp[3]; - + uint8_t renvoie_tourelle; + /// intialisation DDRD = 0xC0; DDRA = 0x00; DDRB = 0x13; DDRC = 0x00; + rs232_init (); proto_send0('z'); pont_init(); @@ -128,17 +130,40 @@ int main (void) if(temp_sens != sens) { temp_sens = sens; // permet de savoir quand on a fini un tour - proto_send1b ('t',nombre_valeur_tourelle); + + if(nombre_valeur_tourelle > 0) { - proto_send1b ('u',angle_tourelle[0]); - proto_send1w ('v',tableau_longueur_tourelle[angle_tourelle[0]]); + renvoie_tourelle = angle_tourelle[0]; + renvoie_tourelle &= 255; + proto_send2w ('t',renvoie_tourelle,tableau_longueur_tourelle[angle_tourelle[0]]); } + else proto_send2w ('t',0x0100,0x00); + + if(nombre_valeur_tourelle > 1) { - proto_send1b ('w',angle_tourelle[1]); - proto_send1w ('x',tableau_longueur_tourelle[angle_tourelle[1]]); + renvoie_tourelle = angle_tourelle[1]; + renvoie_tourelle &= 511; + proto_send2w ('t',renvoie_tourelle,tableau_longueur_tourelle[angle_tourelle[1]]); + } + else proto_send2w ('t',0x0200,0x00); + if(nombre_valeur_tourelle > 2) + { + renvoie_tourelle = angle_tourelle[2]; + renvoie_tourelle &= 765; + proto_send2w ('t',renvoie_tourelle,tableau_longueur_tourelle[angle_tourelle[2]]); + } + else proto_send2w ('t',0x0300,0x00); + if(nombre_valeur_tourelle > 3) + { + renvoie_tourelle = angle_tourelle[3]; + renvoie_tourelle &= 1023; + proto_send2w ('t',renvoie_tourelle,tableau_longueur_tourelle[angle_tourelle[3]]); } + else proto_send2w ('t',0x0400,0x00); + + nombre_valeur_tourelle = 0; } -- cgit v1.2.3