From 54bb900c6aa2196d93e89aed585d4bad7f3a87c0 Mon Sep 17 00:00:00 2001 From: dufourj Date: Wed, 24 May 2006 01:04:08 +0000 Subject: ES (commit de travail) : - gestion du ack ; - gestion sharps avec seuil possible ; - meilleur mise à jour des pins de l'asserv pour les trous vus. --- n/es-2006/src/sensor_rvb.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'n/es-2006/src/sensor_rvb.c') diff --git a/n/es-2006/src/sensor_rvb.c b/n/es-2006/src/sensor_rvb.c index 9d15223..41954a9 100644 --- a/n/es-2006/src/sensor_rvb.c +++ b/n/es-2006/src/sensor_rvb.c @@ -42,7 +42,6 @@ #define RVB_MAX_FALSE_IC 3 /** Max overflow of the timer 1 before thinking the sensor is HS. */ /* TODO Find a way to compute this value */ -/* FIXME with the new sensor config, we can lowdown this value, I hope */ #define RVB_MAX_OVERFLOW 253 /** Wait time between IO change in ns. */ #define RVB_SENSOR_DELAY_IO 125 @@ -62,8 +61,7 @@ /** Max input capture before considering we can start the real capture. */ uint8_t sensor_rvb_conf_max_false_ic_; /** Max overflow of the timer 1 before thinking the sensor is HS. */ -/* XXX, 8 bits ? */ -uint16_t sensor_rvb_conf_max_ov_; +uint8_t sensor_rvb_conf_max_ov_; /** RVB sensor state flag. */ volatile uint8_t sensor_rvb_state_; /** Internal computed result for one color. */ @@ -200,7 +198,7 @@ sensor_rvb_init (void) /** Configure some internal variables. */ void -sensor_rvb_config (uint8_t false_ic, uint16_t max_ov) +sensor_rvb_config (uint8_t false_ic, uint8_t max_ov) { sensor_rvb_conf_max_false_ic_ = false_ic; sensor_rvb_conf_max_ov_ = max_ov; @@ -362,16 +360,19 @@ sensor_rvb_update_asserv_pins (void) { uint8_t compt; - for (compt = 0; compt < 4; compt++) + if (sensor_rvb_state_ == RVB_STATE_SLEEP) { - /* Is sensor capture valid */ - if (sensor_rvb_values[compt][0] < RVB_INVALID_CAPTURE) + for (compt = 0; compt < 4; compt++) { - if (sniff_rvb_analysis_color (compt, RVB_SNIFF_ONLY_GREEN) - != RVB_SNIFF_GREEN) - PORTA |= _BV (compt + 4); - else - PORTA &= ~_BV (compt + 4); + /* Is sensor capture valid */ + if (sensor_rvb_values[compt][0] < RVB_INVALID_CAPTURE) + { + if (sniff_rvb_analysis_color (compt, RVB_SNIFF_ONLY_GREEN) + != RVB_SNIFF_GREEN) + PORTA |= _BV (compt + 4); + else + PORTA &= ~_BV (compt + 4); + } } } -- cgit v1.2.3