Ajout d'un fonction d'init oubliée dans la stratégie + test complémentaire pour LEDs
This commit is contained in:
		
							parent
							
								
									ec67302805
								
							
						
					
					
						commit
						c66f1011bc
					
				| @ -85,6 +85,7 @@ int main() { | |||||||
|     //while(mode_test());
 |     //while(mode_test());
 | ||||||
|     i2c_maitre_init(); |     i2c_maitre_init(); | ||||||
|     Trajet_init(); |     Trajet_init(); | ||||||
|  |     Balise_VL53L1X_init(); | ||||||
| 
 | 
 | ||||||
|     set_position_avec_gyroscope(1); |     set_position_avec_gyroscope(1); | ||||||
|     if(get_position_avec_gyroscope()){ |     if(get_position_avec_gyroscope()){ | ||||||
|  | |||||||
							
								
								
									
										56
									
								
								Test.c
									
									
									
									
									
								
							
							
						
						
									
										56
									
								
								Test.c
									
									
									
									
									
								
							| @ -1423,11 +1423,24 @@ int test_angle_balise(void){ | |||||||
|     int lettre; |     int lettre; | ||||||
|     float distance, angle=3.1281; |     float distance, angle=3.1281; | ||||||
| 
 | 
 | ||||||
|  |     enum { | ||||||
|  |         TEST_BLEU, | ||||||
|  |         ATTENTE1, | ||||||
|  |         TEST_VERT, | ||||||
|  |         ATTENTE2, | ||||||
|  |         TEST_RESET, | ||||||
|  |         ATTENTE3, | ||||||
|  |         TEST_ANGLE | ||||||
|  |     }etat_test_led=TEST_BLEU; | ||||||
|  | 
 | ||||||
|     i2c_maitre_init(); |     i2c_maitre_init(); | ||||||
|     Balise_VL53L1X_init(); |     Balise_VL53L1X_init(); | ||||||
|     Localisation_set(1000,1500,0); |     Localisation_set(1000,1500,0); | ||||||
| 
 | 
 | ||||||
|     multicore_launch_core1(affiche_monitoring); |     multicore_launch_core1(affiche_monitoring); | ||||||
|  |     uint temps_ms, timer_ms=1000; | ||||||
|  | 
 | ||||||
|  |     temps_ms = Temps_get_temps_ms(); | ||||||
|      |      | ||||||
|     do{ |     do{ | ||||||
|         temps_cycle_check(); |         temps_cycle_check(); | ||||||
| @ -1435,13 +1448,48 @@ int test_angle_balise(void){ | |||||||
|         i2c_gestion(i2c0); |         i2c_gestion(i2c0); | ||||||
|         i2c_annexe_gestion(); |         i2c_annexe_gestion(); | ||||||
|         Balise_VL53L1X_gestion(); |         Balise_VL53L1X_gestion(); | ||||||
|  |         if(temps_ms != Temps_get_temps_ms()){ | ||||||
|  |             temps_ms = Temps_get_temps_ms(); | ||||||
| 
 | 
 | ||||||
|         distance = Balise_VL53L1X_get_distance_obstacle_mm(angle); |             switch(etat_test_led){ | ||||||
|         Trajet_set_obstacle_mm(distance); |                 case TEST_BLEU: | ||||||
|  |                     i2c_annexe_couleur_balise(0b00011100, 0x0FFF); | ||||||
|  |                     timer_ms--; | ||||||
|  |                     if(timer_ms<2){ | ||||||
|  |                         etat_test_led=TEST_VERT; | ||||||
|  |                         timer_ms=1000; | ||||||
|  |                     } | ||||||
|  |                     break; | ||||||
|  |                  | ||||||
|  |                 case TEST_VERT: | ||||||
|  |                     i2c_annexe_couleur_balise(0b00000011, 0x0FFF); | ||||||
|  |                     timer_ms--; | ||||||
|  |                     if(timer_ms<2){ | ||||||
|  |                         etat_test_led=TEST_RESET; | ||||||
|  |                         timer_ms=10000; | ||||||
|  |                     } | ||||||
|  |                     break; | ||||||
|  | 
 | ||||||
|  |                 case TEST_RESET: | ||||||
|  |                     i2c_annexe_couleur_balise(0, 0x00); | ||||||
|  |                     timer_ms--; | ||||||
|  |                     if(timer_ms<2){ | ||||||
|  |                         etat_test_led=TEST_ANGLE; | ||||||
|  |                         timer_ms=0; | ||||||
|  |                     } | ||||||
|  |                     break; | ||||||
|  | 
 | ||||||
|  |                 case TEST_ANGLE: | ||||||
|  |                     timer_ms++; | ||||||
|  |                     angle=(float)timer_ms / 1000.; | ||||||
|  |                     Trajet_set_obstacle_mm(Balise_VL53L1X_get_distance_obstacle_mm(angle)); | ||||||
|  |                     break; | ||||||
|  |                  | ||||||
|  |             } | ||||||
|  |         } | ||||||
| 
 | 
 | ||||||
|         lettre = getchar_timeout_us(0); |         lettre = getchar_timeout_us(0); | ||||||
|     }while(1); |     }while(lettre == PICO_ERROR_TIMEOUT || lettre == 0); | ||||||
|     //}while(lettre == PICO_ERROR_TIMEOUT || lettre == 0);
 |  | ||||||
|          |          | ||||||
|     return 0; |     return 0; | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user