git.droids-corp.org
/
aversive.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
indent
[aversive.git]
/
projects
/
microb2010
/
ballboard
/
state.c
diff --git
a/projects/microb2010/ballboard/state.c
b/projects/microb2010/ballboard/state.c
index
9568be8
..
f9a5f8a
100644
(file)
--- a/
projects/microb2010/ballboard/state.c
+++ b/
projects/microb2010/ballboard/state.c
@@
-56,7
+56,7
@@
static struct vt100 local_vt100;
static volatile uint8_t state_mode;
static struct vt100 local_vt100;
static volatile uint8_t state_mode;
-static uint8_t ball_count;
+static
volatile
uint8_t ball_count;
/* short aliases */
#define INIT I2C_BALLBOARD_MODE_INIT
/* short aliases */
#define INIT I2C_BALLBOARD_MODE_INIT
@@
-82,6
+82,7
@@
uint8_t state_get_ball_count(void)
return ball_count;
}
return ball_count;
}
+#if 0
static void state_debug_wait_key_pressed(void)
{
if (!state_debug)
static void state_debug_wait_key_pressed(void)
{
if (!state_debug)
@@
-89,11
+90,13
@@
static void state_debug_wait_key_pressed(void)
printf_P(PSTR("press a key\r\n"));
while (!cmdline_keypressed());
}
printf_P(PSTR("press a key\r\n"));
while (!cmdline_keypressed());
}
+#endif
/* set a new state, return 0 on success */
int8_t state_set_mode(uint8_t mode)
{
state_mode = mode;
/* set a new state, return 0 on success */
int8_t state_set_mode(uint8_t mode)
{
state_mode = mode;
+ STMCH_DEBUG("%s(): mode=%x ", __FUNCTION__, mode);
/* STMCH_DEBUG("%s(): l_deploy=%d l_harvest=%d " */
/* "r_deploy=%d r_harvest=%d eject=%d", */
/* STMCH_DEBUG("%s(): l_deploy=%d l_harvest=%d " */
/* "r_deploy=%d r_harvest=%d eject=%d", */
@@
-127,7
+130,7
@@
uint8_t state_get_mode(void)
/* harvest balls from area */
static void state_do_harvest(void)
{
/* harvest balls from area */
static void state_do_harvest(void)
{
- state_debug_wait_key_pressed();
+
//
state_debug_wait_key_pressed();
roller_on();
}
roller_on();
}
@@
-135,18
+138,26
@@
static void state_do_harvest(void)
static void state_do_eject(void)
{
roller_reverse();
static void state_do_eject(void)
{
roller_reverse();
+ time_wait_ms(2000);
}
/* main state machine */
void state_machine(void)
{
}
/* main state machine */
void state_machine(void)
{
+ uint8_t mode = 0;
+
while (state_want_exit() == 0) {
while (state_want_exit() == 0) {
+ if (state_mode != mode) {
+ mode = state_mode;
+ STMCH_DEBUG("%s(): mode=%x ", __FUNCTION__, mode);
+ }
+
switch (state_mode) {
case INIT:
switch (state_mode) {
case INIT:
- state_mode = OFF;
state_init();
state_init();
+ state_mode = OFF;
break;
case OFF:
break;
case OFF: