Fonction pour lancer les cerises revue, envoie des cerises une à une
This commit is contained in:
		
							parent
							
								
									ee53e6f5f9
								
							
						
					
					
						commit
						19834f0111
					
				
							
								
								
									
										31
									
								
								Strategie.c
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								Strategie.c
									
									
									
									
									
								
							| @ -146,6 +146,7 @@ enum etat_action_t lance_balles(uint32_t step_ms){ | ||||
|         LANCE_PROPULSEUR_ON, | ||||
|         LANCE_TEMPO_PROP_ON, | ||||
|         LANCE_PORTE_OUVERTE, | ||||
|         LANCE_OUVERTURE_INITIALE, | ||||
|     } etat_lance_balle = LANCE_PROPULSEUR_ON; | ||||
| 
 | ||||
|     switch(etat_lance_balle){ | ||||
| @ -153,36 +154,38 @@ enum etat_action_t lance_balles(uint32_t step_ms){ | ||||
|             i2c_annexe_active_propulseur(); | ||||
|             tempo_ms = 1000; | ||||
|             nb_iteration=0; | ||||
|             etat_lance_balle = LANCE_TEMPO_PROP_ON; | ||||
|             etat_lance_balle = LANCE_OUVERTURE_INITIALE; | ||||
|             break; | ||||
|          | ||||
|         case LANCE_OUVERTURE_INITIALE: | ||||
|             if(temporisation_terminee(&tempo_ms, step_ms)){ | ||||
|                 i2c_annexe_ouvre_porte(); | ||||
|                 etat_lance_balle = LANCE_PORTE_OUVERTE; | ||||
|                 tempo_ms = 250; | ||||
|             } | ||||
|             break; | ||||
|          | ||||
|         case LANCE_TEMPO_PROP_ON: | ||||
|             if (tempo_ms < step_ms){ | ||||
|             if(temporisation_terminee(&tempo_ms, step_ms)){ | ||||
|                 i2c_annexe_ouvre_porte(); | ||||
|                 nb_iteration++; | ||||
|                 if(nb_iteration > 10){ | ||||
|                     nb_iteration=0; | ||||
|                     etat_action = ACTION_TERMINEE; | ||||
|                     etat_lance_balle = LANCE_PROPULSEUR_ON; | ||||
|                     i2c_annexe_desactive_propulseur(); | ||||
|                 }else{ | ||||
|                     etat_lance_balle = LANCE_PORTE_OUVERTE; | ||||
|                     tempo_ms = 300; | ||||
|                     tempo_ms = 150; | ||||
|                 } | ||||
|                  | ||||
|                 i2c_annexe_ouvre_porte(); | ||||
|                  | ||||
|             }else{ | ||||
|                 tempo_ms -= step_ms; | ||||
|             } | ||||
|             break; | ||||
|          | ||||
|         case LANCE_PORTE_OUVERTE: | ||||
|             if (tempo_ms < step_ms){ | ||||
|                 i2c_annexe_ferme_porte(); | ||||
|             if(temporisation_terminee(&tempo_ms, step_ms)){ | ||||
|                 i2c_annexe_mi_ferme_porte(); | ||||
|                 etat_lance_balle = LANCE_TEMPO_PROP_ON; | ||||
|                 tempo_ms = 450; | ||||
|                  | ||||
|             }else{ | ||||
|                 tempo_ms -= step_ms; | ||||
|                 tempo_ms = 500; | ||||
|             } | ||||
|             break; | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user