Expulsion des balles une par une.

This commit is contained in:
Samuel 2023-04-23 16:36:08 +02:00
parent 7ac7b653d6
commit 0b8b32a494

View File

@ -140,6 +140,7 @@ void Homologation(uint32_t step_ms){
enum etat_action_t lance_balles(uint32_t step_ms){ enum etat_action_t lance_balles(uint32_t step_ms){
enum etat_action_t etat_action = ACTION_EN_COURS; enum etat_action_t etat_action = ACTION_EN_COURS;
static uint32_t tempo_ms; static uint32_t tempo_ms;
static uint32_t nb_iteration;
static enum{ static enum{
LANCE_PROPULSEUR_ON, LANCE_PROPULSEUR_ON,
@ -151,14 +152,24 @@ enum etat_action_t lance_balles(uint32_t step_ms){
case LANCE_PROPULSEUR_ON: case LANCE_PROPULSEUR_ON:
i2c_annexe_active_propulseur(); i2c_annexe_active_propulseur();
tempo_ms = 1000; tempo_ms = 1000;
nb_iteration=0;
etat_lance_balle = LANCE_TEMPO_PROP_ON; etat_lance_balle = LANCE_TEMPO_PROP_ON;
break; break;
case LANCE_TEMPO_PROP_ON: case LANCE_TEMPO_PROP_ON:
if (tempo_ms < step_ms){ if (tempo_ms < step_ms){
nb_iteration++;
if(nb_iteration > 10){
etat_action = ACTION_TERMINEE;
etat_lance_balle = LANCE_PROPULSEUR_ON;
i2c_annexe_desactive_propulseur();
}else{
etat_lance_balle = LANCE_PORTE_OUVERTE; etat_lance_balle = LANCE_PORTE_OUVERTE;
tempo_ms = 300;
}
i2c_annexe_ouvre_porte(); i2c_annexe_ouvre_porte();
tempo_ms = 6000;
}else{ }else{
tempo_ms -= step_ms; tempo_ms -= step_ms;
} }
@ -166,13 +177,15 @@ enum etat_action_t lance_balles(uint32_t step_ms){
case LANCE_PORTE_OUVERTE: case LANCE_PORTE_OUVERTE:
if (tempo_ms < step_ms){ if (tempo_ms < step_ms){
etat_lance_balle = LANCE_PROPULSEUR_ON; i2c_annexe_ferme_porte();
i2c_annexe_desactive_propulseur(); etat_lance_balle = LANCE_TEMPO_PROP_ON;
etat_action = ACTION_TERMINEE; tempo_ms = 450;
}else{ }else{
tempo_ms -= step_ms; tempo_ms -= step_ms;
} }
break; break;
} }
return etat_action; return etat_action;
} }