summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordufourj2007-05-17 08:10:50 +0000
committerdufourj2007-05-17 08:10:50 +0000
commitbe89d65330a79a52af93ab2b427d6ca320d41899 (patch)
treeccf9d5f8dfaf34ae6f9e16f75b5eccf1c4ff572b
parent1f4663124d2b5e287f88e6608dcc534f02d46533 (diff)
* Sharp:
- simplify management of sharp: just simply ack we have seen something and stop computing new value.
-rw-r--r--n/es-2007/src/main.c33
1 files changed, 11 insertions, 22 deletions
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 */