Skip to content

Commit 2e8014b

Browse files
Conditions with priority 255 removed in Boblight
Signal/Slot connection finished/deleteLater removed between HyperionDeamon/HyperionIManager Signed-off-by: Paulchen-Panther <Paulchen-Panter@protonmail.com>
1 parent 1960f76 commit 2e8014b

File tree

3 files changed

+11
-32
lines changed

3 files changed

+11
-32
lines changed

libsrc/boblightserver/BoblightClientConnection.cpp

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,8 @@ BoblightClientConnection::BoblightClientConnection(Hyperion* hyperion, QTcpSocke
4444

4545
BoblightClientConnection::~BoblightClientConnection()
4646
{
47-
if (_priority < 255)
48-
{
49-
// clear the current channel
50-
_hyperion->clear(_priority);
51-
_priority = 255;
52-
}
47+
// clear the current channel
48+
_hyperion->clear(_priority);
5349

5450
delete _socket;
5551
}
@@ -83,12 +79,8 @@ void BoblightClientConnection::readData()
8379

8480
void BoblightClientConnection::socketClosed()
8581
{
86-
if (_priority < 255)
87-
{
88-
// clear the current channel
89-
_hyperion->clear(_priority);
90-
_priority = 255;
91-
}
82+
// clear the current channel
83+
_hyperion->clear(_priority);
9284

9385
emit connectionClosed(this);
9486
}
@@ -164,7 +156,7 @@ void BoblightClientConnection::handleMessage(const QString & message)
164156
rgb.blue = blue;
165157

166158
// send current color values to hyperion if this is the last led assuming leds values are send in order of id
167-
if ((ledIndex == _ledColors.size() -1) && _priority < 255)
159+
if (ledIndex == _ledColors.size() -1)
168160
{
169161
_hyperion->setInput(_priority, _ledColors);
170162
}
@@ -188,14 +180,11 @@ void BoblightClientConnection::handleMessage(const QString & message)
188180
int prio = messageParts[2].toInt(&rc);
189181
if (rc && prio != _priority)
190182
{
191-
if (_priority < 255)
192-
{
193-
// clear the current channel
194-
_hyperion->clear(_priority);
183+
// clear the current channel
184+
_hyperion->clear(_priority);
195185

196-
// register new priority
197-
_hyperion->registerInput(prio, hyperion::COMP_BOBLIGHTSERVER, QString("Boblight@%1").arg(_socket->peerAddress().toString()));
198-
}
186+
// register new priority
187+
_hyperion->registerInput(prio, hyperion::COMP_BOBLIGHTSERVER, QString("Boblight@%1").arg(_socket->peerAddress().toString()));
199188

200189
_priority = prio;
201190
return;
@@ -205,23 +194,14 @@ void BoblightClientConnection::handleMessage(const QString & message)
205194
else if (messageParts[0] == "sync")
206195
{
207196
// send current color values to hyperion
208-
if (_priority < 255)
209-
{
210-
_hyperion->setInput(_priority, _ledColors);
211-
}
197+
_hyperion->setInput(_priority, _ledColors);
212198
return;
213199
}
214200
}
215201

216202
Debug(_log, "unknown boblight message: %s", QSTRING_CSTR(message));
217203
}
218204

219-
void BoblightClientConnection::sendMessage(const QByteArray & message)
220-
{
221-
//std::cout << "send boblight message: " << message;
222-
_socket->write(message);
223-
}
224-
225205
void BoblightClientConnection::sendLightMessage()
226206
{
227207
char buffer[256];

libsrc/boblightserver/BoblightClientConnection.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ private slots:
6363
///
6464
/// @param message The boblight message to send
6565
///
66-
void sendMessage(const QByteArray &message);
66+
void sendMessage(const QByteArray &message) { _socket->write(message); };
6767

6868
///
6969
/// Send a lights message the to connected client

libsrc/hyperion/HyperionIManager.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ bool HyperionIManager::startInstance(const quint8& inst, const bool& block)
6868
hyperion->moveToThread(hyperionThread);
6969
// setup thread management
7070
connect(hyperionThread, &QThread::started, hyperion, &Hyperion::start);
71-
connect(hyperionThread, &QThread::finished, hyperionThread, &QObject::deleteLater);
7271
connect(hyperion, &Hyperion::started, this, &HyperionIManager::handleStarted);
7372
connect(hyperion, &Hyperion::finished, this, &HyperionIManager::handleFinished);
7473
connect(hyperion, &Hyperion::finished, hyperionThread, &QThread::quit, Qt::DirectConnection);

0 commit comments

Comments
 (0)