summaryrefslogtreecommitdiff
path: root/n
diff options
context:
space:
mode:
authordufourj2006-05-24 12:22:45 +0000
committerdufourj2006-05-24 12:22:45 +0000
commit55e5056593ad021213e97c6418382ac051d85d93 (patch)
tree362c719cf38bb4d6e4949dc0b72bb73cc8304112 /n
parent75192e6d726a30bde79482cdcdf11477233165a6 (diff)
Ai :
- commit de travaille. Es : - merge des fonctions du barillet. ES : - protection contre l'analyse quand les capteurs sont pas pret ; - fonction de gestion capteur RVB frontaux seulement.
Diffstat (limited to 'n')
-rw-r--r--n/es-2006/src/main.c23
-rw-r--r--n/es-2006/src/sensor_rvb.c6
-rw-r--r--n/es-2006/src/sensor_rvb.h4
3 files changed, 32 insertions, 1 deletions
diff --git a/n/es-2006/src/main.c b/n/es-2006/src/main.c
index 4878f0d..172c385 100644
--- a/n/es-2006/src/main.c
+++ b/n/es-2006/src/main.c
@@ -56,6 +56,9 @@ uint8_t sharp_enable[SHARP_NUMBER], sharp_enable_freq[SHARP_NUMBER];
/* Stats for colour selection and jack */
uint8_t others_jackcolor_stat_enable, others_jackcolor_stats;
+/* Stat for RVB front sensors */
+uint8_t sniff_rvb_front_enable, sniff_rvb_front_stats;
+
/* XXX Debug stats */
uint8_t main_stats[4];
uint8_t main_stats_freq, main_stats_enable;
@@ -142,7 +145,11 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args)
break;
/* Print stats for ball */
case c ('B', 1):
- sniff_ball_stats = sniff_ball_stat_enable = args[1];
+ sniff_ball_stats = sniff_ball_stat_enable = args[0];
+ break;
+ /* Print stats for front RVB Sniff */
+ case c ('C', 1):
+ sniff_rvb_front_enable = sniff_rvb_front_stats = args[0];
break;
/* Enable all sensors */
case c ('u', 1):
@@ -333,6 +340,20 @@ main (void)
sniff_ball_stats = sniff_ball_stat_enable;
proto_send2b ('B', sniff_rvb_analysis_ball (7), sniff_rvb_analysis_ball (8));
}
+ /* Print stats for front sensors */
+ if (sniff_rvb_front_enable && !--sniff_rvb_front_stats)
+ {
+ if (sensor_rvb_state_sleeeping ())
+ {
+ /* Re init stats system for this sensor */
+ sniff_rvb_front_stats = sniff_rvb_front_enable;
+ proto_send2b
+ ('C', sniff_rvb_analysis_color (4, RVB_SNIFF_ALL_COLORS),
+ sniff_rvb_analysis_color (6, RVB_SNIFF_ALL_COLORS));
+ }
+ else
+ sniff_rvb_front_stats = 1;
+ }
main_stats[1] = TCNT0;
diff --git a/n/es-2006/src/sensor_rvb.c b/n/es-2006/src/sensor_rvb.c
index 2bda0dd..46b2598 100644
--- a/n/es-2006/src/sensor_rvb.c
+++ b/n/es-2006/src/sensor_rvb.c
@@ -86,6 +86,12 @@ volatile uint8_t sensor_rvb_cur_;
/** Update everything for you. */
inline void sensor_rvb_update (void);
+/** Are you sleeping */
+uint8_t
+sensor_rvb_state_sleeeping (void)
+{
+ return (sensor_rvb_state_ == RVB_STATE_SLEEP ? 1 : 0);
+}
/** Select a color :
* 0 : red ;
* 1 : blue ;
diff --git a/n/es-2006/src/sensor_rvb.h b/n/es-2006/src/sensor_rvb.h
index 88a6962..3ffeadc 100644
--- a/n/es-2006/src/sensor_rvb.h
+++ b/n/es-2006/src/sensor_rvb.h
@@ -89,4 +89,8 @@ void sensor_rvb_update_asserv_pins (void);
*/
void sensor_rvb_upper_sensors (uint8_t enable);
+/** Are you sleeping */
+uint8_t sensor_rvb_state_sleeeping (void);
+
+
#endif // sensor_rvb_h