summaryrefslogtreecommitdiff
path: root/n/es-2006/src
diff options
context:
space:
mode:
authordufourj2006-05-24 04:17:12 +0000
committerdufourj2006-05-24 04:17:12 +0000
commit84ed888b09f0a4bb430b156eebc0afe5de7a8981 (patch)
tree492ebb5091e5e69c82258c7485138036a455f0e5 /n/es-2006/src
parent6eb802cdd87ebac5fa1c5eb129827ed1149fdb2e (diff)
Es :
- ajout des paramêtres chargés à la création de la classe ; - mise à niveau avec le code avr. ES : - quelques corrections au niveau protocolaire (c, j, k sont disponnibles) ; - ajout de quelques commentaires de questions.
Diffstat (limited to 'n/es-2006/src')
-rw-r--r--n/es-2006/src/ack.h9
-rw-r--r--n/es-2006/src/lcd.c6
-rw-r--r--n/es-2006/src/main.c54
-rw-r--r--n/es-2006/src/sensor_rvb.c1
4 files changed, 34 insertions, 36 deletions
diff --git a/n/es-2006/src/ack.h b/n/es-2006/src/ack.h
index 7eb3d35..98b0dfa 100644
--- a/n/es-2006/src/ack.h
+++ b/n/es-2006/src/ack.h
@@ -30,10 +30,13 @@
/* Do not use, it's only for the main */
extern uint8_t ack_value;
-/** List here what you want to tell to the world and put a description */
+/** List here what you want to tell to the world and put a description.
+ * You must use a different number for each code and it must be lower than 255
+ * of course ! */
+#define ACK_NOTHING 0 /* Nothing to ack */
+#define ACK_CONTACT_FRONT 1 /* Something in the front */
-#define ACK_NOTHING 0
-#define ACK_CONTACT_FRONT 1
+// FIXME, inline ? static ?
/** Reset ack status */
void ack_reset (void)
diff --git a/n/es-2006/src/lcd.c b/n/es-2006/src/lcd.c
index e7cff75..dedff94 100644
--- a/n/es-2006/src/lcd.c
+++ b/n/es-2006/src/lcd.c
@@ -26,7 +26,10 @@
#include "modules/twi/twi.h"
-uint8_t grub_greeting[32] = "Booting : press 1-NFS 2-Auto 3-N";
+uint8_t grub_greeting[32] = "Booting ! Press 1 > NFS 2 > Auto";
+
+// TODO, inline ?
+// Prefers 16 char management, and ask the LCD to rotate line...
/* Init communication with the LCD. */
void lcd_init (void)
@@ -50,6 +53,7 @@ uint8_t lcd_key (void)
return buffer_read;
}
+/* Tell the LCD we have seen the Grub ! */
void lcd_grub_booting (void)
{
lcd_print (grub_greeting, 32);
diff --git a/n/es-2006/src/main.c b/n/es-2006/src/main.c
index 856343f..98d674f 100644
--- a/n/es-2006/src/main.c
+++ b/n/es-2006/src/main.c
@@ -47,7 +47,7 @@ uint8_t sensor_rvb_stat_enable[RVB_MAX_SENSOR], sensor_rvb_stats[RVB_MAX_SENSOR]
uint8_t sniff_rvb_stat_enable[RVB_MAX_SENSOR], sniff_rvb_stats[RVB_MAX_SENSOR];
/* Statistics for RVB ball sensors. */
-uint8_t sniff_ball_stat_enable[2], sniff_ball_stats[2];
+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];
@@ -67,8 +67,8 @@ uint8_t twi_buffer_read;
uint8_t lcd_key_enable, lcd_key_freq;
/* Enable stat for ack */
-uint8_t main_ack_freq = 0xFF;
-uint8_t main_ack_enable = 0xFF;
+uint8_t main_ack_freq, main_ack_enable;
+/* For the ack system, look at ack.h */
uint8_t ack_value;
/** Call when we receive some data from proto (uart) */
@@ -88,6 +88,7 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args)
utils_reset ();
break;
+ /* Main stats / Debug */
case c ('Z', 1):
main_stats_freq = main_stats_enable = args[0];
break;
@@ -95,12 +96,15 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args)
case c ('f', 0):
/* Shut up ! */
ack_reset ();
+ /* Tell us quickly next time please */
main_ack_freq = 1;
break;
case c ('F', 1):
/* Change the frequency of ack */
- main_ack_enable = main_ack_freq = args[0];
+ main_ack_enable = args[0];
+ /* Tell us quickly next time please */
+ main_ack_freq = 1;
break;
/*** RVB ***/
@@ -137,29 +141,16 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args)
args[2];
break;
/* Print stats for ball */
- case c ('B', 2):
- for (compt = 0; compt < 2; compt++)
- if (args[0] & _BV(compt))
- sniff_ball_stats[compt] = sniff_ball_stat_enable[compt] = args[1];
+ case c ('B', 1):
+ sniff_ball_stats = sniff_ball_stat_enable = args[1];
break;
+ /* Enable all sensors */
case c ('u', 1):
sensor_rvb_upper_sensors (args[0]);
break;
- /* contact */
- case c ('c', 0 ):
- proto_send1b ('c', others_contact());
- break;
- /* jack */
- case c ('j', 0 ):
- proto_send1b ('j', others_jack());
- break;
- /* color mode game */
- case c ('k', 0 ):
- proto_send1b ('k', others_selectcoul());
- break;
/* Selection color & jack */
- case c ('q', 1):
+ case c ('O', 1):
others_jackcolor_stat_enable = others_jackcolor_stats = args[0];
break;
@@ -187,10 +178,10 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args)
break;
/* LCD */
- case c ('L', 32):
+ case c ('l', 32):
lcd_print (args, 32);
break;
- case c ('l', 1):
+ case c ('L', 1):
lcd_key_freq = lcd_key_enable = args[0];
break;
@@ -328,13 +319,12 @@ main (void)
}
/* Print stats for ball */
- for (compt = 0; compt < 2; compt++)
- if (sniff_ball_stat_enable[compt] && !--sniff_ball_stats[compt])
- {
- /* Re init stats system for this sensor */
- sniff_ball_stats[compt] = sniff_ball_stat_enable[compt];
- proto_send2b ('B', compt + 7, sniff_rvb_analysis_ball (compt + 7));
- }
+ if (sniff_ball_stat_enable && !--sniff_ball_stats)
+ {
+ /* Re init stats system for this sensor */
+ sniff_ball_stats = sniff_ball_stat_enable;
+ proto_send2b ('B', sniff_rvb_analysis_ball (7), sniff_rvb_analysis_ball (8));
+ }
main_stats[1] = TCNT0;
@@ -344,14 +334,14 @@ main (void)
if (others_jackcolor_stat_enable && !--others_jackcolor_stats)
{
others_jackcolor_stats = others_jackcolor_stat_enable;
- proto_send1b ('q', other_jack_color ());
+ proto_send1b ('O', other_jack_color ());
}
/* LCD */
if (lcd_key_enable && !--lcd_key_freq)
{
lcd_key_freq = lcd_key_enable;
if ((twi_buffer_read = lcd_key ()))
- proto_send1b ('l', twi_buffer_read);
+ proto_send1b ('L', twi_buffer_read);
}
/* gestion du barilet */
diff --git a/n/es-2006/src/sensor_rvb.c b/n/es-2006/src/sensor_rvb.c
index 41954a9..2bda0dd 100644
--- a/n/es-2006/src/sensor_rvb.c
+++ b/n/es-2006/src/sensor_rvb.c
@@ -59,6 +59,7 @@
/*** Config ***/
/** Max input capture before considering we can start the real capture. */
+// FIXME volatile
uint8_t sensor_rvb_conf_max_false_ic_;
/** Max overflow of the timer 1 before thinking the sensor is HS. */
uint8_t sensor_rvb_conf_max_ov_;