Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1007 - LED's retain last state after clearing a source #1008

Merged
merged 6 commits into from
Sep 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
232 changes: 0 additions & 232 deletions assets/webconfig/i18n/ru.json

This file was deleted.

237 changes: 0 additions & 237 deletions assets/webconfig/i18n/zh-CN.json

This file was deleted.

4 changes: 2 additions & 2 deletions assets/webconfig/js/settings.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var storedAccess;
var storedLang;
var availLang = ['cs','de','en','es','fr','it','nl','pl','ro','sv','vi','ru','tr','zh-CN'];
var availLangText = ['Čeština', 'Deutsch', 'English', 'Español', 'Français', 'Italiano', 'Nederlands', 'Polski', 'Română', 'Svenska', 'Tiếng Việt', 'русский', 'Türkçe', '汉语'];
var availLang = ['cs','de','en','es','fr','it','nl','pl','ro','sv','vi','tr'];
var availLangText = ['Čeština', 'Deutsch', 'English', 'Español', 'Français', 'Italiano', 'Nederlands', 'Polski', 'Română', 'Svenska', 'Tiếng Việt', 'Türkçe'];
var availAccess = ['default','advanced','expert'];
//$.i18n.debug = true;

Expand Down
12 changes: 6 additions & 6 deletions include/utils/ColorRgb.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ static_assert(sizeof(ColorRgb) == 3, "Incorrect size of ColorRgb");
inline std::ostream& operator<<(std::ostream& os, const ColorRgb& color)
{
os << "{"
<< color.red << ","
<< color.green << ","
<< color.blue
<< static_cast<unsigned>(color.red) << ","
<< static_cast<unsigned>(color.green) << ","
<< static_cast<unsigned>(color.blue)
<< "}";

return os;
Expand All @@ -64,9 +64,9 @@ inline std::ostream& operator<<(std::ostream& os, const ColorRgb& color)
inline QTextStream& operator<<(QTextStream &os, const ColorRgb& color)
{
os << "{"
<< color.red << ","
<< color.green << ","
<< color.blue
<< static_cast<unsigned>(color.red) << ","
<< static_cast<unsigned>(color.green) << ","
<< static_cast<unsigned>(color.blue)
<< "}";

return os;
Expand Down
3 changes: 2 additions & 1 deletion libsrc/leddevice/LedDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ int LedDevice::writeBlack(int numberOfBlack)
QTimer::singleShot(_latchTime_ms, &loop, &QEventLoop::quit);
loop.exec();
}
rc = write(std::vector<ColorRgb>(static_cast<unsigned long>(_ledCount), ColorRgb::BLACK ));
_lastLedValues = std::vector<ColorRgb>(static_cast<unsigned long>(_ledCount), ColorRgb::BLACK );
rc = write(_lastLedValues);
}
return rc;
}
Expand Down
19 changes: 12 additions & 7 deletions libsrc/leddevice/dev_net/LedDeviceYeelight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -983,10 +983,7 @@ LedDeviceYeelight::LedDeviceYeelight(const QJsonObject &deviceConfig)

LedDeviceYeelight::~LedDeviceYeelight()
{
if ( _tcpMusicModeServer != nullptr )
{
delete _tcpMusicModeServer;
}
}

LedDevice* LedDeviceYeelight::construct(const QJsonObject &deviceConfig)
Expand Down Expand Up @@ -1448,10 +1445,18 @@ int LedDeviceYeelight::write(const std::vector<ColorRgb> & ledValues)
}
else
{
QString errorReason = QString ("(%1) %2").arg(_tcpMusicModeServer->serverError()).arg( _tcpMusicModeServer->errorString());
Warning( _log, "write Error [%s]: _tcpMusicModeServer: %s", QSTRING_CSTR(light.getName()), QSTRING_CSTR(errorReason));
light.setInError("Failed to get stream socket");
}
QString errorReason = QString("(%1) %2").arg(_tcpMusicModeServer->serverError()).arg(_tcpMusicModeServer->errorString());
if (_tcpMusicModeServer->serverError() == QAbstractSocket::TemporaryError)
{
Info(_log, "Ignore write Error [%s]: _tcpMusicModeServer: %s", QSTRING_CSTR(light.getName()), QSTRING_CSTR(errorReason));
skipWrite = true;
}
else
{
Warning(_log, "write Error [%s]: _tcpMusicModeServer: %s", QSTRING_CSTR(light.getName()), QSTRING_CSTR(errorReason));
light.setInError("Failed to get stream socket");
}
}
}
else
{
Expand Down
11 changes: 0 additions & 11 deletions libsrc/leddevice/dev_serial/ProviderRs232.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,6 @@ void ProviderRs232::setInError(const QString& errorMsg)

int ProviderRs232::writeBytes(const qint64 size, const uint8_t *data)
{
DebugIf(_isInSwitchOff, _log, "_inClosing [%d], enabled [%d], _deviceReady [%d], _frameDropCounter [%d]", _isInSwitchOff, _isEnabled, _isDeviceReady, _frameDropCounter);

int rc = 0;
if (!_rs232Port.isOpen())
{
Expand All @@ -205,9 +203,6 @@ int ProviderRs232::writeBytes(const qint64 size, const uint8_t *data)
return -1;
}
}

DebugIf( _isInSwitchOff, _log, "[%s]", QSTRING_CSTR(uint8_t_to_hex_string(data, size, 32)) );

qint64 bytesWritten = _rs232Port.write(reinterpret_cast<const char*>(data), size);
if (bytesWritten == -1 || bytesWritten != size)
{
Expand Down Expand Up @@ -243,13 +238,7 @@ int ProviderRs232::writeBytes(const qint64 size, const uint8_t *data)
rc = -1;
}
}
else
{
DebugIf(_isInSwitchOff,_log, "In Closing: bytesWritten [%d], _rs232Port.error() [%d], %s", bytesWritten, _rs232Port.error(), _rs232Port.error() == QSerialPort::NoError ? "No Error" : QSTRING_CSTR(_rs232Port.errorString()) );
}
}

DebugIf(_isInSwitchOff, _log, "[%d], _inClosing[%d], enabled [%d], _deviceReady [%d]", rc, _isInSwitchOff, _isEnabled, _isDeviceReady);
return rc;
}

Expand Down