Amélioration communication

This commit is contained in:
Samuel 2025-05-29 22:52:18 +02:00
parent f3dc47a348
commit aa9ec10e42

View File

@ -6,17 +6,14 @@ int Detect_adv_lire(struct detect_adv_reception_t * detect_adv_reception){
return Detect_adv_lire(detect_adv_reception, true);
}
/// @brief Lit les capteurs VL53L1X
int Detect_adv_lire(struct detect_adv_reception_t * detect_adv_reception, bool blocking){
int Detect_adv_lire(struct detect_adv_reception_t * detect_adv_reception, bool continuous_try){
unsigned char tampon2[14];
//(Adresse I2c, Adresse dans le registre, tampon, longueur de donnée)
error = I2C_lire_registre(I2C_SLAVE_detect_adv, 0, detect_adv_reception->distance_cm, 12);
if (error !=0){
while (error !=0 && continuous_try){
affiche_erreur("Scan_Detect_adversaire", "Erreur I2C");
if(blocking){
while(1);
}
}else{
Serial.println("I2C OK");
error = I2C_lire_registre(I2C_SLAVE_detect_adv, 0, detect_adv_reception->distance_cm, 12);
}
return error;
}