diff --git a/libsrc/boblightserver/BoblightClientConnection.cpp b/libsrc/boblightserver/BoblightClientConnection.cpp index 40bd1c38..7099079e 100644 --- a/libsrc/boblightserver/BoblightClientConnection.cpp +++ b/libsrc/boblightserver/BoblightClientConnection.cpp @@ -44,12 +44,8 @@ BoblightClientConnection::BoblightClientConnection(Hyperion* hyperion, QTcpSocke BoblightClientConnection::~BoblightClientConnection() { - if (_priority < 255) - { - // clear the current channel - _hyperion->clear(_priority); - _priority = 255; - } + // clear the current channel + _hyperion->clear(_priority); delete _socket; } @@ -83,12 +79,8 @@ void BoblightClientConnection::readData() void BoblightClientConnection::socketClosed() { - if (_priority < 255) - { - // clear the current channel - _hyperion->clear(_priority); - _priority = 255; - } + // clear the current channel + _hyperion->clear(_priority); emit connectionClosed(this); } @@ -164,7 +156,7 @@ void BoblightClientConnection::handleMessage(const QString & message) rgb.blue = blue; // send current color values to hyperion if this is the last led assuming leds values are send in order of id - if ((ledIndex == _ledColors.size() -1) && _priority < 255) + if (ledIndex == _ledColors.size() -1) { _hyperion->setInput(_priority, _ledColors); } @@ -188,14 +180,11 @@ void BoblightClientConnection::handleMessage(const QString & message) int prio = messageParts[2].toInt(&rc); if (rc && prio != _priority) { - if (_priority < 255) - { - // clear the current channel - _hyperion->clear(_priority); + // clear the current channel + _hyperion->clear(_priority); - // register new priority - _hyperion->registerInput(prio, hyperion::COMP_BOBLIGHTSERVER, QString("Boblight@%1").arg(_socket->peerAddress().toString())); - } + // register new priority + _hyperion->registerInput(prio, hyperion::COMP_BOBLIGHTSERVER, QString("Boblight@%1").arg(_socket->peerAddress().toString())); _priority = prio; return; @@ -205,10 +194,7 @@ void BoblightClientConnection::handleMessage(const QString & message) else if (messageParts[0] == "sync") { // send current color values to hyperion - if (_priority < 255) - { - _hyperion->setInput(_priority, _ledColors); - } + _hyperion->setInput(_priority, _ledColors); return; } } @@ -216,12 +202,6 @@ void BoblightClientConnection::handleMessage(const QString & message) Debug(_log, "unknown boblight message: %s", QSTRING_CSTR(message)); } -void BoblightClientConnection::sendMessage(const QByteArray & message) -{ - //std::cout << "send boblight message: " << message; - _socket->write(message); -} - void BoblightClientConnection::sendLightMessage() { char buffer[256]; diff --git a/libsrc/boblightserver/BoblightClientConnection.h b/libsrc/boblightserver/BoblightClientConnection.h index f4e4d00e..a2ab4cc0 100644 --- a/libsrc/boblightserver/BoblightClientConnection.h +++ b/libsrc/boblightserver/BoblightClientConnection.h @@ -63,7 +63,7 @@ private: /// /// @param message The boblight message to send /// - void sendMessage(const QByteArray &message); + void sendMessage(const QByteArray &message) { _socket->write(message); }; /// /// Send a lights message the to connected client diff --git a/libsrc/hyperion/HyperionIManager.cpp b/libsrc/hyperion/HyperionIManager.cpp index 01514535..0b11f9a1 100644 --- a/libsrc/hyperion/HyperionIManager.cpp +++ b/libsrc/hyperion/HyperionIManager.cpp @@ -68,7 +68,6 @@ bool HyperionIManager::startInstance(const quint8& inst, const bool& block) hyperion->moveToThread(hyperionThread); // setup thread management connect(hyperionThread, &QThread::started, hyperion, &Hyperion::start); - connect(hyperionThread, &QThread::finished, hyperionThread, &QObject::deleteLater); connect(hyperion, &Hyperion::started, this, &HyperionIManager::handleStarted); connect(hyperion, &Hyperion::finished, this, &HyperionIManager::handleFinished); connect(hyperion, &Hyperion::finished, hyperionThread, &QThread::quit, Qt::DirectConnection);