summaryrefslogtreecommitdiff
path: root/n/es-2007/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'n/es-2007/src/main.c')
-rw-r--r--n/es-2007/src/main.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/n/es-2007/src/main.c b/n/es-2007/src/main.c
index 5c457c8..bf5b734 100644
--- a/n/es-2007/src/main.c
+++ b/n/es-2007/src/main.c
@@ -53,7 +53,8 @@ uint8_t sniff_ball_stat_enable, sniff_ball_stats;
/* Config and statistics for SHarps */
uint8_t sharp_stat_enable[SHARP_NUMBER], sharp_stat_freq[SHARP_NUMBER];
uint8_t sharp_enable[SHARP_NUMBER], sharp_enable_freq[SHARP_NUMBER];
-uint8_t sharp_analyse[SHARP_NUMBER], sharp_analyse_freq[SHARP_NUMBER];
+/* Analysed value of the sharps (something in front ?) */
+uint8_t sharp_analyse_enable[SHARP_NUMBER], sharp_analyse_freq[SHARP_NUMBER];
/* Stats for colour selection and jack */
uint8_t others_jackcolor_stat_enable, others_jackcolor_stats;
@@ -165,11 +166,17 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args)
/* SHarps */
/* Update frequency */
case c ('h', 2):
+ /* first argument: sharp id;
+ * second argument: frequency value.
+ */
for (compt = 0; compt < SHARP_NUMBER; compt++)
if (args[0] & _BV(compt))
sharp_enable[compt] = sharp_enable_freq[compt] = args[1];
break;
/* Stats frequency */
+ /* first argument: sharp id;
+ * second argument: frequency value.
+ */
case c ('H', 2):
for (compt = 0; compt < SHARP_NUMBER; compt++)
if (args[0] & _BV(compt))
@@ -179,6 +186,15 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args)
sharp_config_threshold (args[0], v8_to_v16 (args[1], args[2]),
v8_to_v16 (args[3], args[4]));
break;
+ /* Analysed frequency */
+ /* first argument: sharp id;
+ * second argument: frequency value.
+ */
+ case c ('A', 2):
+ for (compt = 0; compt < SHARP_NUMBER; compt++)
+ if (args[0] & _BV(compt))
+ sharp_analyse_enable[compt] = sharp_analyse_freq[compt] = args[1];
+
/* LCD */
case c ('l', 16):
@@ -415,6 +431,14 @@ main (void)
/* XXX 16 bits sucks */
proto_send2w ('H', compt, sharp_values[compt]);
}
+ /* Print analysed value */
+ if (sharp_analyse_enable[compt] && !--sharp_analyse_freq[compt])
+ {
+ /* Re init stats system for this sharp */
+ sharp_analyse_freq[compt] = sharp_analyse_enable[compt];
+ /* Ask for analyse value and send it */
+ proto_send2b ('A', compt, sharp_analyse_values (compt));
+ }
}
main_stats[2] = TCNT0;