From be89d65330a79a52af93ab2b427d6ca320d41899 Mon Sep 17 00:00:00 2001 From: dufourj Date: Thu, 17 May 2007 08:10:50 +0000 Subject: * Sharp: - simplify management of sharp: just simply ack we have seen something and stop computing new value. --- n/es-2007/src/main.c | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) (limited to 'n') diff --git a/n/es-2007/src/main.c b/n/es-2007/src/main.c index 17e548c..7b749ee 100644 --- a/n/es-2007/src/main.c +++ b/n/es-2007/src/main.c @@ -56,9 +56,6 @@ uint8_t sharp_enable[SHARP_NUMBER], sharp_enable_freq[SHARP_NUMBER]; /* Analysed value of the sharps (something in front ?) */ /* FIXME: For debug only */ uint8_t sharp_analyse_enable[SHARP_NUMBER], sharp_analyse_freq[SHARP_NUMBER]; -/* Shark Attack, maximum before considering ack is finished. */ -uint8_t sharp_ack = 10; // Default value -uint8_t sharp_ack_count = 0; /* Stats for colour selection and jack */ uint8_t others_jackcolor_stat_enable, others_jackcolor_stats; @@ -201,12 +198,6 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args) sharp_analyse_enable[compt] = sharp_analyse_freq[compt] = args[1]; break; - /* Set the value for the sharp ack disable cycle time */ - case c ('K', 1): - sharp_ack = args[0]; - break; - - /* LCD */ case c ('l', 16): lcd_print (args, 16); @@ -433,22 +424,20 @@ main (void) sharp_enable_freq[compt] = sharp_enable[compt]; /* Compute value for the Sharp */ sharp_update_values (compt); - /* If we not are not blocked on an ack */ - if (!sharp_ack_count) + /* Analyse the value */ + if (sharp_analyse_values (compt) == SHARP_OBSTACLE) { - /* We analyse the value */ - if (sharp_analyse_values (compt) == SHARP_OBSTACLE) + /* We send an ack to the PC104 */ + ack_set (ACK_SHARP_FRONT); + /* Disable future update */ { - /* We set the ack counter/locker */ - sharp_ack_count = sharp_ack; - /* We send an ack to the PC104 */ - ack_set (ACK_SHARP_FRONT); + int i; + for (i = 0; i < SHARP_NUMBER; i++) + { + sharp_enable[i] = sharp_enable_freq[i] = 0; + } } - } - else - { - /* If we have an ack locker/counter, we manage it */ - sharp_ack_count--; + } } /* Stats */ -- cgit v1.2.3