Merge pull request #593 from maximkulkin/fix-rpi-pwm

[Hotfix] Fix RPI WS281x LED device initialization
This commit is contained in:
Paulchen Panther 2019-08-12 16:50:27 +02:00 committed by GitHub
commit 0f839f670e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,6 +36,7 @@ bool LedDeviceWS281x::init(const QJsonObject &deviceConfig)
throw std::runtime_error("WS281x: invalid PWM channel; must be 0 or 1."); throw std::runtime_error("WS281x: invalid PWM channel; must be 0 or 1.");
} }
memset(&_led_string, 0, sizeof(_led_string));
_led_string.freq = deviceConfig["freq"].toInt(800000ul); _led_string.freq = deviceConfig["freq"].toInt(800000ul);
_led_string.dmanum = deviceConfig["dma"].toInt(5); _led_string.dmanum = deviceConfig["dma"].toInt(5);
_led_string.channel[_channel].gpionum = deviceConfig["gpio"].toInt(18); _led_string.channel[_channel].gpionum = deviceConfig["gpio"].toInt(18);