mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Merge pull request #428 from guddimon-/master
make hyperion more robust Former-commit-id: 3d00e9be63ccd7904362d6c60702d27c282047de
This commit is contained in:
commit
8775b3f273
@ -64,8 +64,8 @@ void BoblightClientConnection::readData()
|
||||
// remove message data from buffer
|
||||
_receiveBuffer = _receiveBuffer.mid(bytes);
|
||||
|
||||
// handle message
|
||||
handleMessage(message);
|
||||
// handle trimmed message
|
||||
handleMessage(message.trimmed());
|
||||
|
||||
// drop messages if the buffer is too full
|
||||
if (_receiveBuffer.size() > 100*1024)
|
||||
@ -132,9 +132,15 @@ void BoblightClientConnection::handleMessage(const QString & message)
|
||||
{
|
||||
if (messageParts[3] == "rgb" && messageParts.size() == 7)
|
||||
{
|
||||
// replace decimal comma with decimal point
|
||||
messageParts[4].replace(',', '.');
|
||||
messageParts[5].replace(',', '.');
|
||||
messageParts[6].replace(',', '.');
|
||||
|
||||
bool rc1, rc2, rc3;
|
||||
uint8_t red = qMax(0, qMin(255, int(255 * messageParts[4].toFloat(&rc1))));
|
||||
|
||||
// check for correct locale should not be needed anymore - please check!
|
||||
if (!rc1)
|
||||
{
|
||||
// maybe a locale issue. switch to a locale with a comma instead of a dot as decimal seperator (or vice versa)
|
||||
|
Loading…
Reference in New Issue
Block a user