From aac728065795c763a2db92871e85494545837ce2 Mon Sep 17 00:00:00 2001 From: pgp Date: Mon, 1 Feb 2021 18:46:50 +0100 Subject: [PATCH] changements compte-tour & scribe --- src/main.cpp | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index d37e042..8e83e41 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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; } }