summaryrefslogtreecommitdiffhomepage
path: root/digital/io/src/main.c
diff options
context:
space:
mode:
authorNicolas Schodet2008-04-29 09:42:13 +0200
committerNicolas Schodet2008-04-29 09:42:13 +0200
commit4018bef35759af836dcd87d7d1b7eee7de57dfb2 (patch)
tree5d60b653eb168c17d28287d901fdaf001471ec7f /digital/io/src/main.c
parentffe3f998b5d15133e84edac1820459af411a02ba (diff)
* digital/io/src:
- added distance sensors support for simulation. - added preliminary sharps commands.
Diffstat (limited to 'digital/io/src/main.c')
-rw-r--r--digital/io/src/main.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/digital/io/src/main.c b/digital/io/src/main.c
index d36043a9..608a0bad 100644
--- a/digital/io/src/main.c
+++ b/digital/io/src/main.c
@@ -45,6 +45,7 @@
#include "top.h" /* top_* */
#include "chrono.h" /* chrono_end_match */
#include "gutter.h" /* gutter_generate_wait_finished_event */
+#include "sharp.h"
#include "io.h"
@@ -69,6 +70,11 @@ enum team_color_e bot_color;
uint8_t main_post_event_for_top_fsm = 0xFF;
/**
+ * Sharps stats counters.
+ */
+uint8_t main_stats_sharps, main_stats_sharps_cpt;
+
+/**
* Initialize the main and all its subsystems.
*/
static void
@@ -218,6 +224,18 @@ main_loop (void)
}
/* TODO: Check other sensors */
}
+
+ /* Send Sharps stats. */
+ if (main_stats_sharps && !--main_stats_sharps_cpt)
+ {
+ main_stats_sharps_cpt = main_stats_sharps;
+ /* XXX: Temporary put here. */
+ sharp_update (0xff);
+ proto_send4w ('H', sharp_get_raw (0),
+ sharp_get_raw (1),
+ sharp_get_raw (2),
+ sharp_get_raw (3));
+ }
}
}
@@ -281,6 +299,10 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args)
proto_send1b ('S', switch_get_color () << 1 | switch_get_jack ());
break;
+ case c ('H', 1):
+ main_stats_sharps_cpt = main_stats_sharps = args[0];
+ break;
+
/* EEPROM command */
case c ('e', 1):
/* Save/clear config