summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcohensol2007-05-09 18:41:12 +0000
committercohensol2007-05-09 18:41:12 +0000
commit0ef2f592a4264293db5384202ac5d76c15aa7f68 (patch)
tree328db513e90177c1fef71d8e2a6488afbf3c5801
parentccd1ec9c14cff45b8d90b48a997a0240e4783d7e (diff)
Modification de l'es ajout des commandes des capteurs
-rw-r--r--n/es-2007/src/Makefile2
-rw-r--r--n/es-2007/src/main.c21
2 files changed, 12 insertions, 11 deletions
diff --git a/n/es-2007/src/Makefile b/n/es-2007/src/Makefile
index a819f51..74256f5 100644
--- a/n/es-2007/src/Makefile
+++ b/n/es-2007/src/Makefile
@@ -1,7 +1,7 @@
BASE = ../../avr
AVR_PROGS = es
es_SOURCES = main.c sensor_rvb.c sniff_rvb.c timer_1.c ascenseur.c \
- servo_motor.c sharp.c lcd.c ack.c
+ servo_motor.c sharp.c lcd.c ack.c capteurs.c
MODULES = proto uart utils adc twi
CONFIGFILE = avrconfig.h
# atmega8, atmega8535, atmega128...
diff --git a/n/es-2007/src/main.c b/n/es-2007/src/main.c
index 44d4ca6..26bfde9 100644
--- a/n/es-2007/src/main.c
+++ b/n/es-2007/src/main.c
@@ -41,6 +41,7 @@
#include "lcd.h" /* Communication with the LCD card */
#include "ack.h" /* Ack module */
#include "ascenseur.h"
+#include "capteurs.h" /*Captors sensors */
/* Statistics for RVB sensors */
uint8_t sensor_rvb_stat_enable[RVB_MAX_SENSOR], sensor_rvb_stats[RVB_MAX_SENSOR];
@@ -140,20 +141,20 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args)
sniff_rvb_set_ref_color (compt, args[2]);
break;
/* Print stats of the colour seen by the sensor */
- case c ('A', 3):
- temp_16b = v8_to_v16 (args[0], args[1]);
- for (compt = 0; compt < RVB_MAX_SENSOR; compt++)
- if (temp_16b & _BV(compt))
- sniff_rvb_stat_enable[compt] = sniff_rvb_stats[compt] =
- args[2];
+ case c ('A', 1):
+ if(isRightHSActive()) args[0] = 1;
+ else args[0] = 0;
break;
+
/* Print stats for ball */
- case c ('B', 1):
- sniff_ball_stats = sniff_ball_stat_enable = args[0];
+ case c ('B',1 ):
+ if(isLeftHSActive()) args[0] = 1;
+ else args[0] = 0;
break;
/* Print stats for front RVB Sniff */
case c ('C', 1):
- sniff_rvb_front_enable = sniff_rvb_front_stats = args[0];
+ if(isBackSideActive()) args[0] = 1;
+ else args[0] = 0;
break;
/* RVB Hole sensor */
case c ('D', 1):
@@ -210,7 +211,7 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args)
case c ('a', 3):
ascenseur_bouge (args[0], args[1], args[2]);
break;
-
+
/* Unknown commands */
default:
proto_send0 ('?');