summaryrefslogtreecommitdiff
path: root/n/es-2006/src
diff options
context:
space:
mode:
authorlambert2006-05-24 20:50:24 +0000
committerlambert2006-05-24 20:50:24 +0000
commit7fcd40ef44f7df3db0d26eaef5ee108307aa1881 (patch)
treec85d5a2045aee936bbb416328572b2bdc0c342b6 /n/es-2006/src
parent08c46b0aa2c1791ca404a60ca0f75e4687553076 (diff)
* voila le barillet est fonctionnel
* aspiration avant avec 2 balles OK * extraction ar OK * depot ar OK * vidange OK -> Bref ca fonctionne
Diffstat (limited to 'n/es-2006/src')
-rw-r--r--n/es-2006/src/barillet.c69
1 files changed, 52 insertions, 17 deletions
diff --git a/n/es-2006/src/barillet.c b/n/es-2006/src/barillet.c
index 87c3074..a41bed1 100644
--- a/n/es-2006/src/barillet.c
+++ b/n/es-2006/src/barillet.c
@@ -102,8 +102,9 @@
#define ROTATION_FIN (0x11)
#define AV_EX_VU (0x20)
#define AV_EX_PASSE (0x21)
-#define AV_EX_ROTATION (0x22 | ETAT_ROTATION)
-#define AV_EX_FIN (0x23)
+#define AV_EX_SOLO (0x22)
+#define AV_EX_ROTATION (0x23 | ETAT_ROTATION)
+#define AV_EX_FIN (0x24)
#define AR_EX (0x30)
#define AR_EX_VU (0x31)
#define AR_EX_PASSE (0x32)
@@ -113,9 +114,11 @@
#define AR_DEP_VU (0x41)
#define AR_DEP_PASSE (0x42)
#define AR_DEP_FIN (0x43)
-#define VIDANGE (0x50)
-#define VIDANGE_VU (0x51) // cahnger les noms
-#define VIDANGE_PASSE (0x52)
+#define VIDANGE_1 (0x50 | ETAT_ROTATION)
+#define VIDANGE_2 (0x51)
+#define VIDANGE_3 (0x52 | ETAT_ROTATION)
+#define VIDANGE_4 (0x53)
+#define VIDANGE_5 (0x54)
/* at barillet. */
volatile uint8_t etat_en_cours_;
@@ -290,8 +293,9 @@ vidange_barillet(void)
{
if ( ( etat_en_cours_ == STAND_BY || etat_en_cours_ == STAND_BY_FULL ) )
{
- etat_en_cours_ = VIDANGE;
- rotation_barillet( 0x26, VIDANGE );
+ compt_vidange = 0;
+ etat_en_cours_ = VIDANGE_1;
+ rotation_barillet( 0x26, VIDANGE_1 );
}
}
@@ -316,16 +320,8 @@ void sequenceur_barillet()
case SLEEP:
break;
case STAND_BY:
- if ( vidange_ )
- {
- vidange_barillet();
- }
break;
case STAND_BY_FULL:
- if ( vidange_ )
- {
- vidange_barillet();
- }
break;
case STAND_BY_ARRET:
break;
@@ -336,6 +332,11 @@ void sequenceur_barillet()
case AV_EX_VU:
/* Time out en cas de deux balles dans le trou avant. */
case AV_EX_PASSE:
+ OCR_TURB_AVANT = VITESSE_TURB_MIN_ - 17;
+ if (PINE & _BV(6))
+ etat_en_cours_ = AV_EX_SOLO;
+ break;
+ case AV_EX_SOLO:
rotation_barillet ((pos_actuel_ + 8) % 40, AV_EX_ROTATION);
break;
case AV_EX_FIN:
@@ -368,6 +369,37 @@ void sequenceur_barillet()
// XXX ack
etat_en_cours_ = STAND_BY_ARRET;
break;
+
+ /* revoir les fonctions a apeller */
+ case VIDANGE_1:
+ break;
+ case VIDANGE_2:
+ /* ouverture du servo moteur */
+ servo_motor_open_trash();
+ etat_en_cours_ = VIDANGE_3;
+ rotation_barillet (0, VIDANGE_3);
+ break;
+ case VIDANGE_3:
+ /* rotation du barillet en cours */
+ break;
+ case VIDANGE_4:
+ attente_ = 300;
+ etat_en_cours_ = VIDANGE_5;
+ break;
+ case VIDANGE_5:
+ compt_vidange = compt_vidange + 1;
+ if ( compt_vidange == 5 )
+ /* vidange terminee */
+ {
+ servo_motor_close_trash();
+ etat_en_cours_ = STAND_BY_FULL;
+ }
+ if ( compt_vidange <= 4 )
+ {
+ etat_en_cours_ = VIDANGE_3;
+ rotation_barillet( ( (pos_actuel_ + 8)%40), VIDANGE_3);
+ }
+ break;
default : break;
}
}
@@ -403,7 +435,10 @@ rotation_barillet (uint8_t pos_final, uint8_t etat)
}
/* Delay pour la commutation du pont en H. */
utils_delay_us (DELAY_);
- OCR_TURB_AVANT = VITESSE_TURB_MIN_;
+ if (etat != AV_EX_ROTATION )
+ {
+ OCR_TURB_AVANT = VITESSE_TURB_MIN_;
+ }
OCR_TURB_ARRIERE = VITESSE_TURB_MIN_;
/* Affectation de la vitesse du barillet. */
if ((dist_pas_trigo <= 2) || (dist_trigo <= 2))
@@ -531,7 +566,7 @@ SIGNAL (SIG_INTERRUPT6)
if (etat_en_cours_ == STAND_BY)
{
etat_en_cours_ = AV_EX_VU;
- attente_ = 200;
+ attente_ = 500;
}
else if (etat_en_cours_ == AV_EX_VU)
{