From 0af54b04b8c6e468c10bf62cd8f32ec8d19ee1b4 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 12 Jun 2022 18:02:59 +0200 Subject: [PATCH] Optimisation de l'allumage --- src/main.cpp | 33 ++------------------------------- src/my_MQTT.h | 4 ---- src/my_leds.h | 4 ---- 3 files changed, 2 insertions(+), 39 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 01ad164..1d05f1d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -15,7 +15,7 @@ #include //#define ModeDebug -const String firmwareActualVersion = "1.0.0"; +const String firmwareActualVersion = "1.1.0"; #ifdef ModeDebug #define DEBUG(message) \ @@ -49,7 +49,6 @@ int LED_COUNT = 66; // LEDS -boolean g_BOO_AnimationSeconde = true; #include "my_leds.h" @@ -104,8 +103,6 @@ void setup() { strip.show(); // Turn OFF all pixels ASAP strip.setBrightness(255); LED_Animation(5); - g_BOO_AnimationSeconde = true; - DEBUG("************************** Tout est initialise"); } @@ -120,10 +117,6 @@ void setup() { unsigned long lastRecu = 0; int numled = 0; void loop() { - // On écoute le serveur OTA - // OTA_doUpdate(); - - // Test si la connection Wifi existe toujours ................................... if (WiFi.status() != WL_CONNECTED) { // Si on est déconnecté on tente de se reconnecter automatiquement avec les anciens settings. @@ -145,28 +138,6 @@ void loop() { - - // Animation des LEDS toutes les secondes ......................................... - if (millis() - lastRecu > 1000 ) { - lastRecu = millis(); - - // Allumage d'une led - if ( g_BOO_AnimationSeconde ) { - if ( numled >= LED_COUNT /2 ) { - LED_AllumeBaton( numled -1, 0,0,0 ); // Noir - LED_AllumeBaton( numled -2, 0,0,0 ); // Noir - numled = 0; - } - LED_AllumeBaton( numled, 255,0,100 ); // Rouge - LED_AllumeBaton( numled -1, 50,0,70 ); // Noir - LED_AllumeBaton( numled -2, 0,0,0 ); // Noir - - numled++; - } - } - - - // Traitement des Messages MQTT ................................................... // Tout est fait dans MQTT_callback() -} +} \ No newline at end of file diff --git a/src/my_MQTT.h b/src/my_MQTT.h index 94a4fe4..3469da9 100644 --- a/src/my_MQTT.h +++ b/src/my_MQTT.h @@ -88,16 +88,12 @@ void MQTT_callback(char* topic, byte* payload, unsigned int length) { if ( String( message ) == "ON") { DEBUG("Allumage les leds"); - c.B = 255; - LED_changeCouleur( c, 10 ); } else if ( String( message ) == "OFF") { DEBUG("Extinction des leds"); LED_changeCouleurInverse( c, 1 ); } - g_BOO_AnimationSeconde = false; - // ..................................................................................... } else if ( strcmp( topic, topic_lumiere_color) == 0) { diff --git a/src/my_leds.h b/src/my_leds.h index de82e72..0e87ea7 100644 --- a/src/my_leds.h +++ b/src/my_leds.h @@ -299,7 +299,6 @@ void LED_Remplissage(unsigned int value){ // [1..9] // void LED_Animation(int num) { - g_BOO_AnimationSeconde = false; DEBUG(num); switch ( num ) { case 0: @@ -320,9 +319,6 @@ void LED_Animation(int num) { case 5: rainbowCycle(10); break; - case 6: - g_BOO_AnimationSeconde = true; - break; default: DEBUG("Animation inconnue ->" + String(num) ); break;