Rozsireni pouziti mutexu
This commit is contained in:
		@@ -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
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user