]> git.droids-corp.org - aversive.git/commitdiff
weak pack
authorzer0 <zer0@carbon.local>
Fri, 7 May 2010 22:59:55 +0000 (00:59 +0200)
committerzer0 <zer0@carbon.local>
Fri, 7 May 2010 22:59:55 +0000 (00:59 +0200)
projects/microb2010/mainboard/commands_mainboard.c
projects/microb2010/mainboard/i2c_protocol.c
projects/microb2010/mainboard/i2c_protocol.h
projects/microb2010/mainboard/strat.c

index 84ab748df4bb267439ae91aee806fc832bcc4ea1..2335ce38662fc347a09540081d0c547470bf8724 100644 (file)
@@ -790,6 +790,10 @@ static void cmd_cobboard_setmode2_parsed(void *parsed_result, void *data)
                i2c_cobboard_set_mode(I2C_COBBOARD_MODE_HARVEST);
                i2c_cobboard_pack(side);
        }
+       else if (!strcmp_P(res->arg1, PSTR("pack_weak"))) {
+               i2c_cobboard_set_mode(I2C_COBBOARD_MODE_HARVEST);
+               i2c_cobboard_pack_weak(side);
+       }
        else if (!strcmp_P(res->arg1, PSTR("deploy_nomove"))) {
                i2c_cobboard_set_mode(I2C_COBBOARD_MODE_HARVEST);
                i2c_cobboard_deploy_nomove(side);
@@ -802,7 +806,7 @@ static void cmd_cobboard_setmode2_parsed(void *parsed_result, void *data)
 
 prog_char str_cobboard_setmode2_arg0[] = "cobboard";
 parse_pgm_token_string_t cmd_cobboard_setmode2_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_cobboard_setmode2_result, arg0, str_cobboard_setmode2_arg0);
-prog_char str_cobboard_setmode2_arg1[] = "harvest#deploy#pack#harvest_nomove#deploy_nomove";
+prog_char str_cobboard_setmode2_arg1[] = "harvest#deploy#pack#pack_weak#harvest_nomove#deploy_nomove";
 parse_pgm_token_string_t cmd_cobboard_setmode2_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_cobboard_setmode2_result, arg1, str_cobboard_setmode2_arg1);
 prog_char str_cobboard_setmode2_arg2[] = "left#right";
 parse_pgm_token_string_t cmd_cobboard_setmode2_arg2 = TOKEN_STRING_INITIALIZER(struct cmd_cobboard_setmode2_result, arg2, str_cobboard_setmode2_arg2);
index 3354e394a003aaeffa56600488535065317e0ea6..22970c025503b30307c427951c66d641a04d60b7 100644 (file)
@@ -431,6 +431,11 @@ int8_t i2c_cobboard_pack(uint8_t side)
        return i2c_cobboard_set_spickle(side, 0);
 }
 
+int8_t i2c_cobboard_pack_weak(uint8_t side)
+{
+       return i2c_cobboard_set_spickle(side, I2C_COBBOARD_SPK_WEAK);
+}
+
 int8_t i2c_cobboard_autoharvest(uint8_t side)
 {
        return i2c_cobboard_set_spickle(side,
index 06cd47e54bdcbb73db53effd026fa13d498f540f..b5a8136876d92b7804202d9c5518200088e5b5cc 100644 (file)
@@ -37,6 +37,7 @@ int8_t i2c_led_control(uint8_t addr, uint8_t led, uint8_t state);
 
 int8_t i2c_cobboard_set_mode(uint8_t mode);
 int8_t i2c_cobboard_pack(uint8_t side);
+int8_t i2c_cobboard_pack_weak(uint8_t side);
 int8_t i2c_cobboard_autoharvest(uint8_t side);
 int8_t i2c_cobboard_deploy(uint8_t side);
 int8_t i2c_cobboard_autoharvest_nomove(uint8_t side);
index ad37ec44a3d86076fd2729ee39561c0123684f17..883ce6533645a0b29d9c5a7ba45e9f1bdcafb409 100644 (file)
@@ -69,7 +69,7 @@
 #define COL_SCAN_PRE_MARGIN 250
 
 static volatile uint8_t strat_running = 0;
-static volatile uint8_t want_pack = 0;
+volatile uint8_t strat_want_pack = 0;
 volatile uint8_t strat_lpack60 = 0;
 volatile uint8_t strat_rpack60 = 0;
 struct strat_conf strat_conf;
@@ -225,7 +225,7 @@ static void check_corn(void)
 
        /* control the cobboard mode for left spickle */
        if (lcob_near && strat_db.corn_table[lidx]->present) {
-               if (get_cob_count() >= 5 || want_pack || strat_lpack60) {
+               if (get_cob_count() >= 5 || strat_want_pack || strat_lpack60) {
                        /* nothing  */
                }
                else {
@@ -241,15 +241,15 @@ static void check_corn(void)
        }
        else {
                /* no cob near us, we can pack or deploy freely */
-               if (get_cob_count() >= 5 || want_pack || strat_lpack60)
-                       i2c_cobboard_pack(I2C_LEFT_SIDE);
+               if (get_cob_count() >= 5 || strat_want_pack || strat_lpack60)
+                       i2c_cobboard_pack_weak(I2C_LEFT_SIDE);
                else
                        i2c_cobboard_deploy(I2C_LEFT_SIDE);
        }
 
        /* control the cobboard mode for right spickle */
        if (rcob_near && strat_db.corn_table[ridx]->present) {
-               if (get_cob_count() >= 5 || want_pack || strat_rpack60) {
+               if (get_cob_count() >= 5 || strat_want_pack || strat_rpack60) {
                        /* nothing */
                }
                else {
@@ -265,8 +265,8 @@ static void check_corn(void)
        }
        else {
                /* no cob near us, we can pack or deploy freely */
-               if (get_cob_count() >= 5 || want_pack || strat_rpack60)
-                       i2c_cobboard_pack(I2C_RIGHT_SIDE);
+               if (get_cob_count() >= 5 || strat_want_pack || strat_rpack60)
+                       i2c_cobboard_pack_weak(I2C_RIGHT_SIDE);
                else
                        i2c_cobboard_deploy(I2C_RIGHT_SIDE);
        }
@@ -302,7 +302,7 @@ static uint8_t strat_eject(void)
        err = WAIT_COND_OR_TRAJ_END(get_cob_count() >= 5,
                                    TRAJ_FLAGS_NO_NEAR);
        if (err == 0) {
-               want_pack = 1;
+               strat_want_pack = 1;
                strat_set_speed(SPEED_CLITOID_FAST, SPEED_ANGLE_SLOW);
                err = wait_traj_end(TRAJ_FLAGS_NO_NEAR);
        }
@@ -341,7 +341,7 @@ static uint8_t strat_eject(void)
        time_wait_ms(2000);
 
        strat_event_enable();
-       want_pack = 0;
+       strat_want_pack = 0;
        return 0;
 }