mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Fix LedDeviceLpd8806
This commit is contained in:
parent
244b4e6886
commit
7d354aa72d
@ -24,38 +24,6 @@ bool LedDeviceLpd8806::init(const QJsonObject &deviceConfig)
|
|||||||
return isInitOK;
|
return isInitOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int LedDeviceLpd8806::open()
|
|
||||||
{
|
|
||||||
int retval = -1;
|
|
||||||
QString errortext;
|
|
||||||
_deviceReady = false;
|
|
||||||
|
|
||||||
// General initialisation and configuration of LedDevice
|
|
||||||
if ( init(_devConfig) )
|
|
||||||
{
|
|
||||||
// Perform an initial reset to start accepting data on the first led
|
|
||||||
|
|
||||||
const unsigned clearSize = _ledCount/32+1;
|
|
||||||
if ( writeBytes(clearSize, _ledBuffer.data()) < 0 )
|
|
||||||
{
|
|
||||||
errortext = QString ("Failed to do initial write");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Everything is OK -> enable device
|
|
||||||
_deviceReady = true;
|
|
||||||
setEnable(true);
|
|
||||||
retval = 0;
|
|
||||||
}
|
|
||||||
// On error/exceptions, set LedDevice in error
|
|
||||||
if ( retval < 0 )
|
|
||||||
{
|
|
||||||
this->setInError( errortext );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
int LedDeviceLpd8806::write(const std::vector<ColorRgb> &ledValues)
|
int LedDeviceLpd8806::write(const std::vector<ColorRgb> &ledValues)
|
||||||
{
|
{
|
||||||
// Copy the colors from the ColorRgb vector to the Ldp8806 data vector
|
// Copy the colors from the ColorRgb vector to the Ldp8806 data vector
|
||||||
|
@ -95,14 +95,6 @@ public:
|
|||||||
/// @return true if success
|
/// @return true if success
|
||||||
virtual bool init(const QJsonObject &deviceConfig) override;
|
virtual bool init(const QJsonObject &deviceConfig) override;
|
||||||
|
|
||||||
protected:
|
|
||||||
///
|
|
||||||
/// Opens and initiatialises the output device
|
|
||||||
///
|
|
||||||
/// @return Zero on succes (i.e. device is ready and enabled) else negative
|
|
||||||
///
|
|
||||||
virtual int open() override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
/// Writes the led color values to the led-device
|
/// Writes the led color values to the led-device
|
||||||
|
Loading…
Reference in New Issue
Block a user