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