Stop LedDevice:write for disabled devices + Nanoleaf Fixes (#629)

* Handle Exceptions in main & Pythoninit

* Have SSDPDiscover generic again

* Have SSDPDiscover generic again

* Change Info- to Debug logs as technical service messages

* Nanoleaf - When switched on, ensure UDP mode

* Include SQL Database in Cross-Compile instructions

* Fix Clazy (QT code checker) and clang Warnings

* Stop LedDevice:write for disabled device

* Nanoleaf: Fix uint printfs

* NanoLeaf: Fix indents to tabs

* NanoLeaf - Add debug verbosity switches

* Device switchability support, FileDevice with timestamp support

* Nanoleaf Light Panels now support External Control V2

* Enhance LedDeviceFile by Timestamp + fix readyness

* Stop color stream, if LedDevice disabled

* Nanoleaf - remove switchability
This commit is contained in:
LordGrey
2019-12-08 13:12:01 +01:00
committed by Paulchen Panther
parent f917f0fceb
commit ce7c99d2cd
14 changed files with 410 additions and 321 deletions

View File

@@ -62,15 +62,15 @@ void LedDevice::setEnable(bool enable)
_enabled = enable;
}
void LedDevice::setActiveDevice(QString dev)
void LedDevice::setActiveDeviceType(QString deviceType)
{
_activeDevice = dev;
_activeDeviceType = deviceType;
}
bool LedDevice::init(const QJsonObject &deviceConfig)
{
_colorOrder = deviceConfig["colorOrder"].toString("RGB");
_activeDevice = deviceConfig["type"].toString("file").toLower();
_activeDeviceType = deviceConfig["type"].toString("file").toLower();
setLedCount(deviceConfig["currentLedCount"].toInt(1)); // property injected to reflect real led count
_latchTime_ms = deviceConfig["latchTime"].toInt(_latchTime_ms);
@@ -108,11 +108,17 @@ int LedDevice::setLedValues(const std::vector<ColorRgb>& ledValues)
return retval;
}
int LedDevice::switchOff()
int LedDevice::writeBlack()
{
return _deviceReady ? write(std::vector<ColorRgb>(_ledCount, ColorRgb::BLACK )) : -1;
}
int LedDevice::switchOff()
{
int rc = writeBlack();
return rc;
}
int LedDevice::switchOn()
{
return 0;
@@ -129,3 +135,4 @@ int LedDevice::rewriteLeds()
{
return _enabled ? write(_ledValues) : -1;
}