diff --git a/ws2812fx/README.md b/ws2812fx/README.md new file mode 100644 index 00000000..b516a2eb --- /dev/null +++ b/ws2812fx/README.md @@ -0,0 +1,7 @@ +# WS2812FX + +Plug-In for the WS2812FX project, a WS2812 effect library for Arduino and ESP8266. +Flash your microcontroller with the provided "serial_control" example. Connect the microcontroller +over USB to the nymea device. + +See also: https://github.com/kitesurfer1404/WS2812FX diff --git a/ws2812fx/devicepluginws2812fx.cpp b/ws2812fx/devicepluginws2812fx.cpp index 1989fd39..e40fd5c1 100644 --- a/ws2812fx/devicepluginws2812fx.cpp +++ b/ws2812fx/devicepluginws2812fx.cpp @@ -46,14 +46,6 @@ DevicePluginWs2812fx ::DevicePluginWs2812fx () Device::DeviceSetupStatus DevicePluginWs2812fx::setupDevice(Device *device) { - if(!m_reconnectTimer) { - m_reconnectTimer = new QTimer(this); - m_reconnectTimer->setSingleShot(true); - m_reconnectTimer->setInterval(5000); - - connect(m_reconnectTimer, &QTimer::timeout, this, &DevicePluginWs2812fx::onReconnectTimer); - } - if (device->deviceClassId() == ws2812fxDeviceClassId) { QString interface = device->paramValue(ws2812fxDeviceSerialPortParamTypeId).toString(); @@ -82,6 +74,14 @@ Device::DeviceSetupStatus DevicePluginWs2812fx::setupDevice(Device *device) device->setStateValue(ws2812fxConnectedStateTypeId, true); m_usedInterfaces.append(interface); m_serialPorts.insert(device, serialPort); + + if(!m_reconnectTimer) { + m_reconnectTimer = new QTimer(this); + m_reconnectTimer->setSingleShot(true); + m_reconnectTimer->setInterval(5000); + + connect(m_reconnectTimer, &QTimer::timeout, this, &DevicePluginWs2812fx::onReconnectTimer); + } } else { return Device::DeviceSetupStatusFailure; }