changements compte-tour & scribe

This commit is contained in:
pgp 2021-02-01 18:46:50 +01:00
parent a9e8060428
commit aac7280657

View file

@ -183,15 +183,15 @@ void compte_tour() {
int offset = (millis() - depart_compte_tour );
if (offset >= intervalle_compte_tour && sema_compte_tour == true){
chrono_compte_tour = millis()- start_chrono_scribe;
//chrono_compte_tour = millis()- start_chrono_scribe;
pcnt_get_counter_value(PCNT_UNIT_0, &count);
int diff_count = count - old_count;
vRotReel = (60000*diff_count/(pptr*offset)); //vitesse en tours par min (4 pulsations /tour, 2 montantes, 2 descendantes)
old_count = count;
Serial.println("count =");
Serial.println(count);
Serial.println("chrono_compte_tour=");
Serial.println(chrono_compte_tour);
//Serial.println("chrono_compte_tour=");
//Serial.println(chrono_compte_tour);
Serial.println("vRrotReel=");
Serial.println(vRotReel);
gaz_moteur();// ajustement des gaz en fonction de la vitesse mesurée
@ -341,19 +341,20 @@ void scribe_sd (){
chrono_scribe = millis() - start_chrono_scribe;
Serial.println("chrono_scribe=");
Serial.println(chrono_scribe);
if ( sem_scribe == true && chrono_scribe >= intervalle_d_ecriture ){
Serial.println("balise scribe");
char timestamp[] = "YY-MM-DD-hh:mm:ss";
char *horodatage = now.toString(timestamp);
char buffer[64];
int vRotMoyen = count*60000/(pptr*chrono_scribe);
snprintf(buffer, sizeof buffer, "%d", vRotMoyen);
appendFile(SD, fichier, horodatage);
appendFile(SD, fichier, " " );
appendFile(SD, fichier, buffer);
appendFile(SD, fichier, "\n" );
Serial.println("ECRITURE SUR SD");
sem_scribe = false;
Serial.println("balise scribe");
char timestamp[] = "YY-MM-DD-hh:mm:ss";
char *horodatage = now.toString(timestamp);
char buffer[64];
int vRotMoyen = count*60000/(pptr*chrono_scribe);
snprintf(buffer, sizeof buffer, "%d", vRotMoyen);
appendFile(SD, fichier, horodatage);
appendFile(SD, fichier, " " );
appendFile(SD, fichier, buffer);
appendFile(SD, fichier, "\n" );
Serial.println("ECRITURE SUR SD");
sem_scribe = false;
}
}