From 3eee6cd17a6f0acba9089a4a2387a2679cee1833 Mon Sep 17 00:00:00 2001 From: pgp Date: Mon, 1 Feb 2021 18:30:15 +0100 Subject: [PATCH] changements compte-tour & scribe --- src/main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 5afaec4..c0779a3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -24,6 +24,7 @@ bool sem_scribe = false; // sémaphore pour le compteur int16_t count = 0; // variable de compteur int16_t old_count = 0; int vRotReel; // vitesse réelle mesurée du moteur +unsigned long chrono_scribe; unsigned long start_chrono_scribe= 0; // minuteur pour le déclenchement du compteur bool sema_compte_tour = false; // semaphore poour le compte tour unsigned long depart_compte_tour = 0; // valeur de millis au déclenchement du compte-tour @@ -335,15 +336,14 @@ void scribe_sd (){ pcnt_counter_pause(PCNT_TEST_UNIT); pcnt_counter_clear(PCNT_TEST_UNIT); pcnt_counter_resume(PCNT_TEST_UNIT); - start_chrono_scribe = millis(); - + start_chrono_scribe = millis(); } - if ( sem_scribe == true && (millis() - start_chrono_scribe) >= intervalle_d_ecriture ){ + chrono_scribe = millis() - start_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 chrono_scribe = millis() - start_chrono_scribe; int vRotMoyen = count*60000/(pptr*chrono_scribe); snprintf(buffer, sizeof buffer, "%d", vRotMoyen); appendFile(SD, fichier, horodatage);