#include "actuator.h"
#define COBROLLER_SPEED 800
+//#define COBROLLER_SPEED 400
#define SERVO_DOOR_OPEN 250
#define SERVO_DOOR_CLOSED 470
#include "spickle.h"
#include "shovel.h"
-extern uint16_t state_debug;
-
struct cmd_event_result {
fixed_string_t arg0;
fixed_string_t arg1;
u08 bit=0;
struct cmd_event_result * res = parsed_result;
-
+
if (!strcmp_P(res->arg1, PSTR("all"))) {
bit = DO_ENCODERS | DO_CS | DO_BD | DO_POWER;
if (!strcmp_P(res->arg2, PSTR("on")))
parse_pgm_token_string_t cmd_state_debug_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_state_debug_result, arg0, str_state_debug_arg0);
parse_pgm_token_num_t cmd_state_debug_on = TOKEN_NUM_INITIALIZER(struct cmd_state_debug_result, on, UINT8);
-prog_char help_state_debug[] = "Set debug timer for state machine";
+prog_char help_state_debug[] = "Set debug for state machine";
parse_pgm_inst_t cmd_state_debug = {
.f = cmd_state_debug_parsed, /* function to call */
.data = NULL, /* 2nd arg of func */
void i2c_recvevent(uint8_t * buf, int8_t size)
{
void *void_cmd = buf;
-
+
static uint8_t a = 0;
-
+
a++;
if (a & 0x10)
LED2_TOGGLE();
-
+
if (size <= 0) {
goto error;
}
-
+
switch (buf[0]) {
/* Commands (no answer needed) */
- case I2C_CMD_GENERIC_LED_CONTROL:
+ case I2C_CMD_GENERIC_LED_CONTROL:
{
struct i2c_cmd_led_control *cmd = void_cmd;
if (size != sizeof (*cmd))
i2c_led_control(cmd->led_num, cmd->state);
break;
}
-
+
case I2C_CMD_COBBOARD_SET_MODE:
{
struct i2c_cmd_cobboard_set_mode *cmd = void_cmd;
spickle_init();
shovel_init();
-/* state_init(); */
+ state_init();
printf_P(PSTR("\r\n"));
printf_P(PSTR("Dass das Gluck deinen Haus setzt.\r\n"));
gen.log_level = 5;
cobboard.flags |= DO_CS;
-/* state_machine(); */
+ state_machine();
cmdline_interact();
return 0;
#define RIGHT_SPICKLE_ENCODER ((void *)1)
#define SHOVEL_ENCODER ((void *)2)
+#define SERVO_DOOR_PWM ((void *)&gen.servo2)
+
#define LEFT_SPICKLE_PWM ((void *)&gen.pwm1_4A)
#define RIGHT_SPICKLE_PWM ((void *)&gen.pwm2_4B)
#define SHOVEL_PWM ((void *)&gen.pwm3_1A)
#define _SHOVEL_H_
#define SHOVEL_DOWN 100
-#define SHOVEL_MID 4000
+#define SHOVEL_MID 6000
#define SHOVEL_UP 10000
void shovel_init(void);
return 0;
if (vt100_parser(&local_vt100, c) == KEY_CTRL_C)
return 1;
+ printf_P(PSTR("CTRL-C\r\n"));
return 0;
}
/* if there is no cob, return */
if (state_cob_present(side))
return;
-
+
/* if it is black, nothing to do */
if (state_cob_color(side) == I2C_COB_BLACK)
return;
/* eat the cob */
spickle_pack(side);
state_debug_wait_key_pressed();
+ /* xxx */
+ time_wait_ms(250);
+ left_cobroller_on();
delay = spickle_get_pack_delay(side);
time_wait_ms(delay);
wait_ms(200);
state_debug_wait_key_pressed();
shovel_down();
+ left_cobroller_off();
state_debug_wait_key_pressed();
+ time_wait_ms(500);
}
/* eject cobs */
/* pack/deply spickles, enable/disable roller */
if (L_DEPLOY(state_mode)) {
spickle_deploy(I2C_LEFT_SIDE);
- left_cobroller_on();
+ //left_cobroller_on();
+ left_cobroller_off();
}
else {
spickle_pack(I2C_LEFT_SIDE);
void state_init(void);
+extern uint8_t state_debug;
+
#endif