]> git.droids-corp.org - aversive.git/commitdiff
cobboard updated
authorzer0 <zer0@carbon.local>
Sat, 3 Apr 2010 13:01:51 +0000 (15:01 +0200)
committerzer0 <zer0@carbon.local>
Sat, 3 Apr 2010 13:01:51 +0000 (15:01 +0200)
projects/microb2010/cobboard/actuator.c
projects/microb2010/cobboard/commands_cobboard.c
projects/microb2010/cobboard/i2c_protocol.c
projects/microb2010/cobboard/main.c
projects/microb2010/cobboard/main.h
projects/microb2010/cobboard/shovel.h
projects/microb2010/cobboard/state.c
projects/microb2010/cobboard/state.h

index 46065409ea58f6bac22aa0e0b354e3425cd70b8b..cebcd2aaf05d1b0fed3e22f97c4d3f66c99501ba 100644 (file)
@@ -46,6 +46,7 @@
 #include "actuator.h"
 
 #define COBROLLER_SPEED 800
+//#define COBROLLER_SPEED 400
 
 #define SERVO_DOOR_OPEN 250
 #define SERVO_DOOR_CLOSED 470
index eb77cbab17f7e46a0fdd6eb57859cc264637cdf9..888d15a366761139e90a92339bc1074822db6d69 100644 (file)
@@ -53,8 +53,6 @@
 #include "spickle.h"
 #include "shovel.h"
 
-extern uint16_t state_debug;
-
 struct cmd_event_result {
        fixed_string_t arg0;
        fixed_string_t arg1;
@@ -68,7 +66,7 @@ static void cmd_event_parsed(void *parsed_result, __attribute__((unused)) void *
        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")))
@@ -374,7 +372,7 @@ prog_char str_state_debug_arg0[] = "state_debug";
 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 */
index 77846d098bb24b5e5b47cf0eeec67c85f66a8225..9de2d4ccbf17d423e4e9633be8bffa851a6c85e5 100644 (file)
@@ -113,21 +113,21 @@ static int8_t i2c_set_mode(struct i2c_cmd_cobboard_set_mode *cmd)
 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))
@@ -135,7 +135,7 @@ void i2c_recvevent(uint8_t * buf, int8_t size)
                        i2c_led_control(cmd->led_num, cmd->state);
                        break;
                }
-               
+
        case I2C_CMD_COBBOARD_SET_MODE:
                {
                        struct i2c_cmd_cobboard_set_mode *cmd = void_cmd;
index 8ba5d521f6f15cd81f5f0cec89ffdef212c15a56..39318d9facfb733e61a4ac6c2423970f4d4768e4 100755 (executable)
@@ -253,7 +253,7 @@ int main(void)
        spickle_init();
        shovel_init();
 
-/*     state_init(); */
+       state_init();
 
        printf_P(PSTR("\r\n"));
        printf_P(PSTR("Dass das Gluck deinen Haus setzt.\r\n"));
@@ -263,7 +263,7 @@ int main(void)
        gen.log_level = 5;
        cobboard.flags |= DO_CS;
 
-/*     state_machine(); */
+       state_machine();
        cmdline_interact();
 
        return 0;
index dce48255edf7fdbfecb9148d169a1613d4dd32f3..a0dbac82f45f57475ce79adced56c27a8bee51b3 100755 (executable)
@@ -50,6 +50,8 @@
 #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)
index 1f2e53bc8b9cc7db16aebed14d1dfacd1e6b0fbf..7ba8445ec1301c9e9fc28f7093bcb242c3ae9d46 100644 (file)
@@ -23,7 +23,7 @@
 #define _SHOVEL_H_
 
 #define SHOVEL_DOWN 100
-#define SHOVEL_MID  4000
+#define SHOVEL_MID  6000
 #define SHOVEL_UP   10000
 
 void shovel_init(void);
index 8e8affc60c131f03469b39e386744e73b2f307c0..2903a4a0d0b7f0fd5de90e0b979f898e796609c8 100644 (file)
@@ -139,6 +139,7 @@ static uint8_t state_want_exit(void)
                return 0;
        if (vt100_parser(&local_vt100, c) == KEY_CTRL_C)
                return 1;
+       printf_P(PSTR("CTRL-C\r\n"));
        return 0;
 }
 
@@ -155,7 +156,7 @@ static void state_do_harvest(uint8_t side)
        /* 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;
@@ -163,6 +164,9 @@ static void state_do_harvest(uint8_t side)
        /* 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);
 
@@ -177,7 +181,9 @@ static void state_do_harvest(uint8_t side)
        wait_ms(200);
        state_debug_wait_key_pressed();
        shovel_down();
+       left_cobroller_off();
        state_debug_wait_key_pressed();
+       time_wait_ms(500);
 }
 
 /* eject cobs */
@@ -205,7 +211,8 @@ void state_machine(void)
                /* 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);
index 118926a194f8da1ffee7b022251d560c8cca6d76..8dcb6c1418b8f8a67c5aaf2e7bd96caf12b4fb7e 100644 (file)
@@ -35,4 +35,6 @@ void state_machine(void);
 
 void state_init(void);
 
+extern uint8_t state_debug;
+
 #endif