mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Fix some LGTM warnings (#949)
This commit is contained in:
parent
1df0e9ce17
commit
5758b19cbc
@ -270,7 +270,7 @@ $(document).ready( function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#btn_submit_v4l2').off().on('click',function() {
|
$('#btn_submit_v4l2').off().on('click',function() {
|
||||||
var v4l2Options = conf_editor_v4l2.getValue()
|
var v4l2Options = conf_editor_v4l2.getValue();
|
||||||
|
|
||||||
if (v4l2Options.grabberV4L2.available_devices != 'custom' && v4l2Options.grabberV4L2.available_devices != 'auto')
|
if (v4l2Options.grabberV4L2.available_devices != 'custom' && v4l2Options.grabberV4L2.available_devices != 'auto')
|
||||||
v4l2Options.grabberV4L2.device = v4l2Options.grabberV4L2.available_devices;
|
v4l2Options.grabberV4L2.device = v4l2Options.grabberV4L2.available_devices;
|
||||||
|
@ -198,7 +198,7 @@ function initLanguageSelection()
|
|||||||
var langText = 'Please Select';
|
var langText = 'Please Select';
|
||||||
|
|
||||||
//Test, if language is supported by hyperion
|
//Test, if language is supported by hyperion
|
||||||
langIdx = availLang.indexOf(langLocale)
|
var langIdx = availLang.indexOf(langLocale);
|
||||||
if ( langIdx > -1 )
|
if ( langIdx > -1 )
|
||||||
{
|
{
|
||||||
langText = availLangText[langIdx];
|
langText = availLangText[langIdx];
|
||||||
|
@ -762,7 +762,7 @@ async function discover_hue_bridges(){
|
|||||||
// TODO: error case unhandled
|
// TODO: error case unhandled
|
||||||
// res can be: false (timeout) or res.error (not found)
|
// res can be: false (timeout) or res.error (not found)
|
||||||
if(res && !res.error){
|
if(res && !res.error){
|
||||||
const r = res.info
|
const r = res.info;
|
||||||
|
|
||||||
// Process devices returned by discovery
|
// Process devices returned by discovery
|
||||||
console.log(r);
|
console.log(r);
|
||||||
@ -1462,7 +1462,7 @@ async function discover_yeelight_lights(){
|
|||||||
// TODO: error case unhandled
|
// TODO: error case unhandled
|
||||||
// res can be: false (timeout) or res.error (not found)
|
// res can be: false (timeout) or res.error (not found)
|
||||||
if(res && !res.error){
|
if(res && !res.error){
|
||||||
const r = res.info
|
const r = res.info;
|
||||||
|
|
||||||
// Process devices returned by discovery
|
// Process devices returned by discovery
|
||||||
for(const device of r.devices)
|
for(const device of r.devices)
|
||||||
@ -1554,7 +1554,7 @@ function assign_yeelight_lights(){
|
|||||||
|
|
||||||
if (! models.includes (lights[lightid].model) )
|
if (! models.includes (lights[lightid].model) )
|
||||||
{
|
{
|
||||||
var enabled = 'disabled'
|
var enabled = 'disabled';
|
||||||
options = '<option value=disabled>'+$.i18n('wiz_yeelight_unsupported')+'</option>';
|
options = '<option value=disabled>'+$.i18n('wiz_yeelight_unsupported')+'</option>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1611,7 +1611,7 @@ function identify_yeelight_device(hostname, port){
|
|||||||
// TODO: error case unhandled
|
// TODO: error case unhandled
|
||||||
// res can be: false (timeout) or res.error (not found)
|
// res can be: false (timeout) or res.error (not found)
|
||||||
if(res && !res.error){
|
if(res && !res.error){
|
||||||
const r = res.info
|
//const r = res.info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ void XcbGrabber::setupResources()
|
|||||||
if(_XcbShmAvailable)
|
if(_XcbShmAvailable)
|
||||||
{
|
{
|
||||||
_shminfo = xcb_generate_id(_connection);
|
_shminfo = xcb_generate_id(_connection);
|
||||||
int id = shmget(IPC_PRIVATE, _width * _height * 4, IPC_CREAT | 0777);
|
int id = shmget(IPC_PRIVATE, size_t(_width) * size_t(_height) * 4, IPC_CREAT | 0777);
|
||||||
_shmData = static_cast<uint8_t*>(shmat(id, nullptr, 0));
|
_shmData = static_cast<uint8_t*>(shmat(id, nullptr, 0));
|
||||||
xcb_shm_attach(_connection, _shminfo, id, 0);
|
xcb_shm_attach(_connection, _shminfo, id, 0);
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,6 @@ GrabberWrapper::GrabberWrapper(QString grabberName, Grabber * ggrabber, unsigned
|
|||||||
|
|
||||||
GrabberWrapper::~GrabberWrapper()
|
GrabberWrapper::~GrabberWrapper()
|
||||||
{
|
{
|
||||||
stop();
|
|
||||||
Debug(_log,"Close grabber: %s", QSTRING_CSTR(_grabberName));
|
Debug(_log,"Close grabber: %s", QSTRING_CSTR(_grabberName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,12 +237,12 @@ int YeelightLight::writeCommand( const QJsonDocument &command, QJsonArray &resul
|
|||||||
if ( ! _tcpSocket->waitForBytesWritten(WRITE_TIMEOUT.count()) )
|
if ( ! _tcpSocket->waitForBytesWritten(WRITE_TIMEOUT.count()) )
|
||||||
{
|
{
|
||||||
QString errorReason = QString ("(%1) %2").arg(_tcpSocket->error()).arg( _tcpSocket->errorString());
|
QString errorReason = QString ("(%1) %2").arg(_tcpSocket->error()).arg( _tcpSocket->errorString());
|
||||||
log ( 2, "Error:", "bytesWritten: [%d], %s", bytesWritten, QSTRING_CSTR(errorReason));
|
log ( 2, "Error:", "bytesWritten: [%ll], %s", bytesWritten, QSTRING_CSTR(errorReason));
|
||||||
this->setInError ( errorReason );
|
this->setInError ( errorReason );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log ( 3, "Success:", "Bytes written [%d]", bytesWritten );
|
log ( 3, "Success:", "Bytes written [%ll]", bytesWritten );
|
||||||
|
|
||||||
// Avoid to overrun the Yeelight Command Quota
|
// Avoid to overrun the Yeelight Command Quota
|
||||||
qint64 elapsedTime = QDateTime::currentMSecsSinceEpoch() - _lastWriteTime;
|
qint64 elapsedTime = QDateTime::currentMSecsSinceEpoch() - _lastWriteTime;
|
||||||
@ -250,7 +250,7 @@ int YeelightLight::writeCommand( const QJsonDocument &command, QJsonArray &resul
|
|||||||
if ( elapsedTime < _waitTimeQuota )
|
if ( elapsedTime < _waitTimeQuota )
|
||||||
{
|
{
|
||||||
int waitTime = _waitTimeQuota;
|
int waitTime = _waitTimeQuota;
|
||||||
log ( 1, "writeCommand():", "Wait %dms, elapsedTime: %dms < quotaTime: %dms", waitTime, elapsedTime, _waitTimeQuota);
|
log ( 1, "writeCommand():", "Wait %dms, elapsedTime: %llms < quotaTime: %dms", waitTime, elapsedTime, _waitTimeQuota);
|
||||||
|
|
||||||
// Wait time (in ms) before doing next write to not overrun Yeelight command quota
|
// Wait time (in ms) before doing next write to not overrun Yeelight command quota
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(_waitTimeQuota));
|
std::this_thread::sleep_for(std::chrono::milliseconds(_waitTimeQuota));
|
||||||
@ -261,7 +261,7 @@ int YeelightLight::writeCommand( const QJsonDocument &command, QJsonArray &resul
|
|||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
log ( 3, "Reading:", "Bytes available [%d]", _tcpSocket->bytesAvailable() );
|
log ( 3, "Reading:", "Bytes available [%ll]", _tcpSocket->bytesAvailable() );
|
||||||
while ( _tcpSocket->canReadLine() )
|
while ( _tcpSocket->canReadLine() )
|
||||||
{
|
{
|
||||||
QByteArray response = _tcpSocket->readLine();
|
QByteArray response = _tcpSocket->readLine();
|
||||||
@ -341,7 +341,7 @@ bool YeelightLight::streamCommand( const QJsonDocument &command )
|
|||||||
{
|
{
|
||||||
int error = _tcpStreamSocket->error();
|
int error = _tcpStreamSocket->error();
|
||||||
QString errorReason = QString ("(%1) %2").arg(error).arg( _tcpStreamSocket->errorString());
|
QString errorReason = QString ("(%1) %2").arg(error).arg( _tcpStreamSocket->errorString());
|
||||||
log ( 1, "Error:", "bytesWritten: [%d], %s", bytesWritten, QSTRING_CSTR(errorReason));
|
log ( 1, "Error:", "bytesWritten: [%ll], %s", bytesWritten, QSTRING_CSTR(errorReason));
|
||||||
|
|
||||||
if ( error == QAbstractSocket::RemoteHostClosedError )
|
if ( error == QAbstractSocket::RemoteHostClosedError )
|
||||||
{
|
{
|
||||||
@ -356,7 +356,7 @@ bool YeelightLight::streamCommand( const QJsonDocument &command )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log ( 3, "Success:", "Bytes written [%d]", bytesWritten );
|
log ( 3, "Success:", "Bytes written [%ll]", bytesWritten );
|
||||||
rc = true;
|
rc = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
// QT includes
|
// QT includes
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user