Fix #676 (#679) LedDevice Open() did not initialised the device correctly.

* Cast fix
* Fix #676
This commit is contained in:
LordGrey
2020-02-14 21:58:10 +01:00
committed by GitHub
parent ed5455458b
commit 0fa5a24cec
4 changed files with 33 additions and 13 deletions

View File

@@ -11,6 +11,11 @@ LedDeviceWS281x::~LedDeviceWS281x()
{
}
LedDevice* LedDeviceWS281x::construct(const QJsonObject &deviceConfig)
{
return new LedDeviceWS281x(deviceConfig);
}
bool LedDeviceWS281x::init(const QJsonObject &deviceConfig)
{
QString errortext;
@@ -84,11 +89,6 @@ void LedDeviceWS281x::close()
}
}
LedDevice* LedDeviceWS281x::construct(const QJsonObject &deviceConfig)
{
return new LedDeviceWS281x(deviceConfig);
}
// Send new values down the LED chain
int LedDeviceWS281x::write(const std::vector<ColorRgb> &ledValues)
{

View File

@@ -15,12 +15,12 @@ public:
///
/// @param deviceConfig json device config
///
LedDeviceWS281x(const QJsonObject &deviceConfig);
explicit LedDeviceWS281x(const QJsonObject &deviceConfig);
///
/// Destructor of the LedDevice, waits for DMA to complete and then cleans up
///
~LedDeviceWS281x() override;
virtual ~LedDeviceWS281x() override;
/// constructs leddevice
static LedDevice* construct(const QJsonObject &deviceConfig);
@@ -30,7 +30,7 @@ public:
///
/// @param deviceConfig the json device config
/// @return true if success
bool init(const QJsonObject &deviceConfig) override;
virtual bool init(const QJsonObject &deviceConfig) override;
public slots:
///
@@ -39,7 +39,7 @@ public slots:
///
virtual void close() override;
private:
protected:
///
/// Writes the led color values to the led-device
///
@@ -48,6 +48,8 @@ private:
///
virtual int write(const std::vector<ColorRgb> &ledValues) override;
private:
ws2811_t _led_string;
int _channel;
RGBW::WhiteAlgorithm _whiteAlgorithm;