Test every n seconds plutot qu'un nombre de passe

This commit is contained in:
Julien Cabillot 2017-03-06 13:42:43 +01:00 committed by JC
parent c2fe8b118f
commit a4c8fc3606

View File

@ -140,13 +140,12 @@ void ledBlackAll()
void ledCylon() 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
// TODO : trop d'attente entre les clients.loop !!!!
for(int i = 0; i < LED_NUM; i++) { for(int i = 0; i < LED_NUM; i++) {
if ((i % 10) == 0) { 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;
@ -156,14 +155,15 @@ void ledCylon()
FastLED.show(); FastLED.show();
FastLED.delay(1000 / speed); FastLED.delay(1000 / speed);
} }
for(int i = LED_NUM - 1; i > 0; i--) { for(int i = LED_NUM - 1; i > 0; i--) {
if ((i % 10) == 0) { 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.show(); FastLED.show();
FastLED.delay(1000 / speed); FastLED.delay(1000 / speed);