client.loop a chaque passage coute pas plus cher et c'est hyper reactif

This commit is contained in:
Julien Cabillot 2017-03-10 00:46:52 +01:00 committed by Cabillot Julien
parent 482a8aef7e
commit d407a71ce9

View File

@ -153,12 +153,10 @@ void ledCylon()
{ {
// Effet cylon : on allume une led, on attends, on eteinds, on passe à la suivante // Effet cylon : on allume une led, on attends, on eteinds, on passe à la suivante
for(int i = 0; i < LED_NUM; i++) { for(int i = 0; i < LED_NUM; i++) {
EVERY_N_SECONDS(1) {
client.loop(); client.loop();
if (ledEffect != LED_EFFECT_CYLON) { if (ledEffect != LED_EFFECT_CYLON) {
return; return;
} }
}
leds[i] = color; leds[i] = color;
FastLED.delay(1000 / speed); FastLED.delay(1000 / speed);
@ -167,12 +165,10 @@ void ledCylon()
} }
for(int i = LED_NUM - 1; i > 0; i--) { for(int i = LED_NUM - 1; i > 0; i--) {
EVERY_N_SECONDS(1) {
client.loop(); client.loop();
if (ledEffect != LED_EFFECT_CYLON) { if (ledEffect != LED_EFFECT_CYLON) {
return; return;
} }
}
leds[i] = color; leds[i] = color;
FastLED.delay(1000 / speed); FastLED.delay(1000 / speed);
@ -202,7 +198,6 @@ void ledFullColor()
} }
void loop() { void loop() {
Serial.print(".");
// MQTT // MQTT
testConnectMQTT(); testConnectMQTT();
client.loop(); client.loop();