From 15fd42805e45d74204e2c6c990e5b31ef88b43af Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 10 Jun 2022 23:11:06 +0200 Subject: [PATCH] Affichage du nombre de workers --- src/my_MQTT.h | 15 +++++++++++++++ src/my_leds.h | 6 +++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/my_MQTT.h b/src/my_MQTT.h index 0a453c1..94a4fe4 100644 --- a/src/my_MQTT.h +++ b/src/my_MQTT.h @@ -14,6 +14,7 @@ char topic_lumiere_color[8 + 6 + DEVICEID_SIZE]; char topic_lumiere_bright[8 + 11 + DEVICEID_SIZE]; char topic_lumiere_anim[8 + 10 + DEVICEID_SIZE]; char topic_lumiere_rempli[8 + 7 + DEVICEID_SIZE]; +char topic_lumiere_allume_barres[8 + 7 + 7 + DEVICEID_SIZE]; @@ -140,6 +141,19 @@ void MQTT_callback(char* topic, byte* payload, unsigned int length) { DEBUG("Detection du topics :" + String( topic_lumiere_rempli )); DEBUG("Lancement du remplissage à :" + String( message )); LED_Remplissage(String( message ).toInt()); + + + // ..................................................................................... + } else if ( strcmp( topic, topic_lumiere_allume_barres) ==0 ) { + DEBUG("Detection du topics :" + String( topic_lumiere_allume_barres )); + DEBUG("Lancement du remplissage des " + String( message ) + " barres"); + Couleur color; + color.R = 255; + color.V = 255; + color.B = 255; + for(int i = 0; i < String( message ).toInt(); i++){ + LED_AllumeBaton(i, color ); + } } } @@ -169,4 +183,5 @@ void MQTT_setup(){ sprintf( topic_lumiere_bright, "lumiere/brightness/%s", DeviceID); sprintf( topic_lumiere_anim, "lumiere/animation/%s", DeviceID); sprintf( topic_lumiere_rempli, "lumiere/allume/%s", DeviceID); + sprintf( topic_lumiere_allume_barres, "lumiere/allume/%s/barres", DeviceID); } \ No newline at end of file diff --git a/src/my_leds.h b/src/my_leds.h index e025c3d..de82e72 100644 --- a/src/my_leds.h +++ b/src/my_leds.h @@ -33,6 +33,9 @@ void LED_AllumeBaton(unsigned int num, Couleur color){ // ALLUMAGE LEDS DESCENDENTE strip.setPixelColor(LED_COUNT-1 - num, strip.Color( color.R, color.V, color.B )); + + // MISE À JOUR DU LED STRIP + strip.show(); } void LED_AllumeBaton(unsigned int num, unsigned int R, unsigned int V, unsigned int B){ // ALLUMAGE LEDS MONTANTE @@ -285,9 +288,6 @@ void LED_Remplissage(unsigned int value){ // ALLUMAGE DU BATON DE LEDS LED_AllumeBaton(i, color ); - - // MISE À JOUR DU LED STRIP - strip.show(); } }