int8_t state_set_mode(uint8_t mode)
{
state_mode = mode;
- /* XXX synchrounous pack here */
- STMCH_DEBUG("%s(): l_deploy=%d l_harvest=%d "
- "r_deploy=%d r_harvest=%d eject=%d",
- __FUNCTION__, L_DEPLOY(mode), L_HARVEST(mode),
- R_DEPLOY(mode), R_HARVEST(mode), EJECT(mode));
+
+/* STMCH_DEBUG("%s(): l_deploy=%d l_harvest=%d " */
+/* "r_deploy=%d r_harvest=%d eject=%d", */
+/* __FUNCTION__, L_DEPLOY(mode), L_HARVEST(mode), */
+/* R_DEPLOY(mode), R_HARVEST(mode), EJECT(mode)); */
+
return 0;
}
{
cob_count = 0;
shovel_mid();
+ servo_door_open();
time_wait_ms(2000);
shovel_down();
+ servo_door_close();
}
/* main state machine */
state_init();
}
- /* pack spickles */
- if (L_DEPLOY(state_mode))
+ /* pack/deply spickles, enable/disable roller */
+ if (L_DEPLOY(state_mode)) {
spickle_deploy(I2C_LEFT_SIDE);
- else
+ left_cobroller_on();
+ }
+ else {
spickle_pack(I2C_LEFT_SIDE);
- if (R_DEPLOY(state_mode))
+ left_cobroller_off();
+ }
+ if (R_DEPLOY(state_mode)) {
spickle_deploy(I2C_RIGHT_SIDE);
- else
+ right_cobroller_on();
+ }
+ else {
spickle_pack(I2C_RIGHT_SIDE);
+ right_cobroller_off();
+ }
/* harvest */
if (L_DEPLOY(state_mode) && L_HARVEST(state_mode))
{
vt100_init(&local_vt100);
shovel_down();
+ servo_door_close();
spickle_pack(I2C_LEFT_SIDE);
spickle_pack(I2C_RIGHT_SIDE);
state_mode = 0;
uint8_t mode;
};
+#define I2C_CMD_BALLBOARD_SET_MODE 0x10
+
+struct i2c_cmd_ballboard_set_mode {
+ struct i2c_cmd_hdr hdr;
+
+#define I2C_BALLBOARD_MODE_OFF 0x00
+#define I2C_BALLBOARD_MODE_HARVEST 0x01
+#define I2C_BALLBOARD_MODE_EJECT 0x02
+#define I2C_BALLBOARD_MODE_PREP_L_FORK 0x03
+#define I2C_BALLBOARD_MODE_TAKE_L_FORK 0x04
+#define I2C_BALLBOARD_MODE_PREP_R_FORK 0x05
+#define I2C_BALLBOARD_MODE_TAKE_R_FORK 0x06
+ uint8_t mode;
+};
+
/****/
/* requests and their answers */
/****/