mirror of
https://github.com/tbnobody/OpenDTU.git
synced 2025-12-15 11:19:47 +01:00
Make setLed method compatible with Arduino Framework 3
This commit is contained in:
@@ -135,7 +135,12 @@ void LedSingleClass::setLed(const uint8_t ledNo, const bool ledState)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ESP_ARDUINO_VERSION_MAJOR < 3
|
||||||
const uint32_t currentPWM = ledcRead(analogGetChannel(pin.led[ledNo]));
|
const uint32_t currentPWM = ledcRead(analogGetChannel(pin.led[ledNo]));
|
||||||
|
#else
|
||||||
|
const uint32_t currentPWM = ledcRead(pin.led[ledNo]);
|
||||||
|
#endif
|
||||||
|
|
||||||
const uint32_t targetPWM = ledState ? pwmTable[config.Led_Single[ledNo].Brightness] : LED_OFF;
|
const uint32_t targetPWM = ledState ? pwmTable[config.Led_Single[ledNo].Brightness] : LED_OFF;
|
||||||
|
|
||||||
if (currentPWM == targetPWM) {
|
if (currentPWM == targetPWM) {
|
||||||
|
|||||||
Reference in New Issue
Block a user