From 4018bef35759af836dcd87d7d1b7eee7de57dfb2 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Tue, 29 Apr 2008 09:42:13 +0200 Subject: * digital/io/src: - added distance sensors support for simulation. - added preliminary sharps commands. --- digital/io/src/main.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'digital/io/src/main.c') 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" @@ -68,6 +69,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. */ @@ -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 -- cgit v1.2.3