Rozsireni pouziti mutexu

This commit is contained in:
Pavel Brychta 2021-08-04 10:22:52 +02:00
parent cf2b7703a8
commit 919f7ef218

View File

@ -192,12 +192,18 @@ void wsLED::blink(uint32_t speed)
if (NOT_A_PIN != _pin) {
if (LED_BLINK != _ledState) {
#if defined(ESP32)
xSemaphoreTake(_mutex, portMAX_DELAY);
#endif
_handler.detach();
_ledState = LED_BLINK;
_scale = 0xff;
_subState = 1;
_blinkSpeed = speed;
_handler.attach_ms(5, ledTrampoline, this);
#if defined(ESP32)
xSemaphoreGive(_mutex);
#endif
}
}
}
@ -207,11 +213,17 @@ void wsLED::breath(void)
if (NOT_A_PIN != _pin) {
if (LED_BREATH != _ledState) {
#if defined(ESP32)
xSemaphoreTake(_mutex, portMAX_DELAY);
#endif
_handler.detach();
_ledState = LED_BREATH;
_subState = 0;
setColor(_color1);
_handler.attach_ms(5, ledTrampoline, this);
#if defined(ESP32)
xSemaphoreGive(_mutex);
#endif
}
}
}