wait that ballboard is ready before eject
authorzer0 <zer0@carbon.local>
Tue, 4 May 2010 17:17:36 +0000 (19:17 +0200)
committerzer0 <zer0@carbon.local>
Tue, 4 May 2010 17:17:36 +0000 (19:17 +0200)
projects/microb2010/mainboard/strat.c

index ced55e3..3ef6675 100644 (file)
@@ -294,7 +294,14 @@ static uint8_t strat_eject(void)
 
        DEBUG(E_USER_STRAT, "%s():%d", __FUNCTION__, __LINE__);
        strat_hardstop();
 
        DEBUG(E_USER_STRAT, "%s():%d", __FUNCTION__, __LINE__);
        strat_hardstop();
+#ifdef HOST_VERSION
        time_wait_ms(2000);
        time_wait_ms(2000);
+#else
+       WAIT_COND_OR_TIMEOUT(ballboard.status == I2C_BALLBOARD_STATUS_F_BUSY,
+                            2000);
+       WAIT_COND_OR_TIMEOUT(ballboard.status == I2C_BALLBOARD_STATUS_F_READY,
+                            2000);
+#endif
 
        /* half turn */
        trajectory_a_rel(&mainboard.traj, COLOR_A(180));
 
        /* half turn */
        trajectory_a_rel(&mainboard.traj, COLOR_A(180));