mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
fix: small collection of bugfixed debugger hints and warnings (#801)
* small collection of bugfixed debugger hints / warnings * 'toStdVector' has been explicitly marked deprecated * fixed double zip naming in artifacts * V4L2 WebUI Fix * Some code fixes based on alerts from lgtm.com * only execute dynamic v4l2 enum code, if V4L2_AVAIL * very high critical bugfix ;) * merge fix * some lgtm.com fixes * lgtm fixes * undo localtime_r fix Co-authored-by: Paulchen Panther <16664240+Paulchen-Panther@users.noreply.github.com>
This commit is contained in:
parent
e1288a2649
commit
3ff7fe483f
7
.github/workflows/pull-request.yml
vendored
7
.github/workflows/pull-request.yml
vendored
@ -64,7 +64,7 @@ jobs:
|
|||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v1
|
uses: actions/upload-artifact@v1
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.dockerTag }}.zip
|
name: ${{ matrix.dockerTag }}
|
||||||
path: ${{ matrix.dockerTag }}
|
path: ${{ matrix.dockerTag }}
|
||||||
if: matrix.dockerTag != 'aarch64'
|
if: matrix.dockerTag != 'aarch64'
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ jobs:
|
|||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v1
|
uses: actions/upload-artifact@v1
|
||||||
with:
|
with:
|
||||||
name: macOS.zip
|
name: macOS
|
||||||
path: macOS
|
path: macOS
|
||||||
|
|
||||||
######################
|
######################
|
||||||
@ -169,11 +169,12 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
mkdir -p windows
|
mkdir -p windows
|
||||||
mv build/*.zip windows
|
mv build/*.zip windows
|
||||||
|
|
||||||
# Upload artifacts
|
# Upload artifacts
|
||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v1
|
uses: actions/upload-artifact@v1
|
||||||
with:
|
with:
|
||||||
name: windows.zip
|
name: windows
|
||||||
path: windows
|
path: windows
|
||||||
|
|
||||||
######################
|
######################
|
||||||
|
@ -41,7 +41,7 @@ We provide a macOS Build but we can not support this.
|
|||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
Covers these topics (WorkInProgress)
|
Covers these topics (WorkInProgress)
|
||||||
- Installtion
|
- Installation
|
||||||
- Configuration
|
- Configuration
|
||||||
- Effect development
|
- Effect development
|
||||||
- JSON API
|
- JSON API
|
||||||
|
@ -118,6 +118,7 @@ $(document).ready( function() {
|
|||||||
buildSchemaPart(item, v4l2_dynamic_enum_schema, val);
|
buildSchemaPart(item, v4l2_dynamic_enum_schema, val);
|
||||||
grabberV4L2.original_schema.properties[item] = window.schema.grabberV4L2.properties[item];
|
grabberV4L2.original_schema.properties[item] = window.schema.grabberV4L2.properties[item];
|
||||||
grabberV4L2.schema.properties[item] = window.schema.grabberV4L2.properties[item];
|
grabberV4L2.schema.properties[item] = window.schema.grabberV4L2.properties[item];
|
||||||
|
conf_editor_v4l2.validator.schema.properties.grabberV4L2.properties[item] = window.schema.grabberV4L2.properties[item];
|
||||||
|
|
||||||
grabberV4L2.removeObjectProperty(item);
|
grabberV4L2.removeObjectProperty(item);
|
||||||
delete grabberV4L2.cached_editors[item];
|
delete grabberV4L2.cached_editors[item];
|
||||||
|
@ -89,13 +89,6 @@ function createClassicLeds(){
|
|||||||
|
|
||||||
//helper
|
//helper
|
||||||
var edgeHGap = edgeVGap/(16/9);
|
var edgeHGap = edgeVGap/(16/9);
|
||||||
//var cornerHGap = cornerVGap/(16/9);
|
|
||||||
var Vmin = 0.0 + edgeVGap;
|
|
||||||
var Vmax = 1.0 - edgeVGap;
|
|
||||||
var Hmin = 0.0 + edgeHGap;
|
|
||||||
var Hmax = 1.0 - edgeHGap;
|
|
||||||
var Hdiff = Hmax-Hmin;
|
|
||||||
var Vdiff = Vmax-Vmin;
|
|
||||||
var ledArray = [];
|
var ledArray = [];
|
||||||
|
|
||||||
function createFinalArray(array){
|
function createFinalArray(array){
|
||||||
@ -378,7 +371,7 @@ $(document).ready(function() {
|
|||||||
var slConfig = window.serverConfig.ledConfig;
|
var slConfig = window.serverConfig.ledConfig;
|
||||||
|
|
||||||
//Check, if structure is not aligned to expected -> migrate structure
|
//Check, if structure is not aligned to expected -> migrate structure
|
||||||
var newConfig = {};
|
|
||||||
if ( isEmpty(slConfig.classic) )
|
if ( isEmpty(slConfig.classic) )
|
||||||
{
|
{
|
||||||
slConfig = migrateLedConfig( slConfig );
|
slConfig = migrateLedConfig( slConfig );
|
||||||
@ -530,7 +523,7 @@ $(document).ready(function() {
|
|||||||
conf_editor.validate().length ? $('#btn_submit_controller').attr('disabled', true) : $('#btn_submit_controller').attr('disabled', false);
|
conf_editor.validate().length ? $('#btn_submit_controller').attr('disabled', true) : $('#btn_submit_controller').attr('disabled', false);
|
||||||
|
|
||||||
// led controller sepecific wizards
|
// led controller sepecific wizards
|
||||||
$('#btn_wiz_holder').html("")
|
$('#btn_wiz_holder').html("");
|
||||||
$('#btn_led_device_wiz').off();
|
$('#btn_led_device_wiz').off();
|
||||||
|
|
||||||
if(ledType == "philipshue") {
|
if(ledType == "philipshue") {
|
||||||
|
@ -210,7 +210,7 @@ $(document).ready(function() {
|
|||||||
components.forEach( function(obj) {
|
components.forEach( function(obj) {
|
||||||
if (obj.name == "ALL")
|
if (obj.name == "ALL")
|
||||||
{
|
{
|
||||||
hyperionEnabled = obj.enabled
|
hyperionEnabled = obj.enabled;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -232,9 +232,9 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
$('#componentsbutton').append(d);
|
$('#componentsbutton').append(d);
|
||||||
$(`#${comp_btn_id}`).bootstrapToggle();
|
$(`#${comp_btn_id}`).bootstrapToggle();
|
||||||
$(`#${comp_btn_id}`).bootstrapToggle(hyperionEnabled ? "enable" : "disable")
|
$(`#${comp_btn_id}`).bootstrapToggle((hyperionEnabled ? "enable" : "disable"));
|
||||||
$(`#${comp_btn_id}`).change(e => {
|
$(`#${comp_btn_id}`).change(e => {
|
||||||
requestSetComponentState(e.currentTarget.id.split('_').pop(), e.currentTarget.checked)
|
requestSetComponentState(e.currentTarget.id.split('_').pop(), e.currentTarget.checked);
|
||||||
//console.log(e.currentTarget.checked)
|
//console.log(e.currentTarget.checked)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -246,8 +246,7 @@ $(document).ready(function() {
|
|||||||
if (component.name == "ALL")
|
if (component.name == "ALL")
|
||||||
{
|
{
|
||||||
var components = window.comps;
|
var components = window.comps;
|
||||||
|
var hyperionEnabled = component.enabled;
|
||||||
hyperionEnabled = component.enabled
|
|
||||||
for (const comp of components)
|
for (const comp of components)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ function connectionLostDetection(type)
|
|||||||
{
|
{
|
||||||
if ( window.watchdog > 2 )
|
if ( window.watchdog > 2 )
|
||||||
{
|
{
|
||||||
var interval_id = window.setInterval("", 9999); // Get a reference to the last
|
var interval_id = window.setInterval(function(){clearInterval(interval_id);}, 9999); // Get a reference to the last
|
||||||
for (var i = 1; i < interval_id; i++)
|
for (var i = 1; i < interval_id; i++)
|
||||||
window.clearInterval(i);
|
window.clearInterval(i);
|
||||||
if(type == 'restart')
|
if(type == 'restart')
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Two projectiles are sent from random positions and collide with each other
|
# Two projectiles are sent from random positions and collide with each other
|
||||||
# Template from https://github.com/nickpesce/lit/blob/master/lit/effects/collision.py
|
# Template from https://github.com/nickpesce/lit/blob/master/lit/effects/collision.py
|
||||||
import hyperion, time, colorsys, random, math
|
import hyperion, time, colorsys, random
|
||||||
|
|
||||||
# Get parameters
|
# Get parameters
|
||||||
sleepTime = max(0.02, float(hyperion.args.get('speed', 100))/1000.0)
|
sleepTime = max(0.02, float(hyperion.args.get('speed', 100))/1000.0)
|
||||||
|
@ -24,7 +24,7 @@ public slots:
|
|||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
void setSignalThreshold(double redSignalThreshold, double greenSignalThreshold, double blueSignalThreshold);
|
void setSignalThreshold(double redSignalThreshold, double greenSignalThreshold, double blueSignalThreshold);
|
||||||
void setCropping(int cropLeft, int cropRight, int cropTop, int cropBottom);
|
void setCropping(unsigned cropLeft, unsigned cropRight, unsigned cropTop, unsigned cropBottom);
|
||||||
void setSignalDetectionOffset(double verticalMin, double horizontalMin, double verticalMax, double horizontalMax);
|
void setSignalDetectionOffset(double verticalMin, double horizontalMin, double verticalMax, double horizontalMax);
|
||||||
void setSignalDetectionEnable(bool enable);
|
void setSignalDetectionEnable(bool enable);
|
||||||
void setDeviceVideoStandard(QString device, VideoStandard videoStandard);
|
void setDeviceVideoStandard(QString device, VideoStandard videoStandard);
|
||||||
|
@ -52,7 +52,7 @@ private slots:
|
|||||||
///
|
///
|
||||||
/// @brief Handle COMP_ALL changes from Hyperion->compStateChangeRequest
|
/// @brief Handle COMP_ALL changes from Hyperion->compStateChangeRequest
|
||||||
///
|
///
|
||||||
void handleCompStateChangeRequest(const hyperion::Components comp, const bool activated);
|
void handleCompStateChangeRequest(const hyperion::Components comps, const bool activated);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Hyperion instance
|
/// Hyperion instance
|
||||||
|
@ -86,4 +86,4 @@ inline Components stringToComponent(QString component)
|
|||||||
return COMP_INVALID;
|
return COMP_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
}; // end of namespace
|
} // end of namespace
|
||||||
|
@ -61,4 +61,4 @@ QString getDirName( QString sourceFile);
|
|||||||
/// @param[in] log The logger of the caller
|
/// @param[in] log The logger of the caller
|
||||||
///
|
///
|
||||||
void resolveFileError(const QFile& file, Logger* log);
|
void resolveFileError(const QFile& file, Logger* log);
|
||||||
};
|
}
|
||||||
|
@ -258,7 +258,7 @@ public:
|
|||||||
_height = 1;
|
_height = 1;
|
||||||
_pixels = new Pixel_T[2];
|
_pixels = new Pixel_T[2];
|
||||||
_endOfPixels = _pixels + 1;
|
_endOfPixels = _pixels + 1;
|
||||||
memset(_pixels, 0, _width * _height * sizeof(Pixel_T));
|
memset(_pixels, 0, (unsigned long) _width * _height * sizeof(Pixel_T));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -92,4 +92,4 @@ namespace JsonUtils{
|
|||||||
/// @return true on success else false
|
/// @return true on success else false
|
||||||
///
|
///
|
||||||
bool resolveRefs(const QJsonObject& schema, QJsonObject& obj, Logger* log);
|
bool resolveRefs(const QJsonObject& schema, QJsonObject& obj, Logger* log);
|
||||||
};
|
}
|
||||||
|
@ -103,4 +103,4 @@ protected:
|
|||||||
const int _loggerMaxMsgBufferSize;
|
const int _loggerMaxMsgBufferSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(Logger::T_LOG_MESSAGE);
|
Q_DECLARE_METATYPE(Logger::T_LOG_MESSAGE)
|
||||||
|
@ -8,4 +8,4 @@ namespace Process {
|
|||||||
void restartHyperion(bool asNewProcess=false);
|
void restartHyperion(bool asNewProcess=false);
|
||||||
QByteArray command_exec(QString cmd, QByteArray data="");
|
QByteArray command_exec(QString cmd, QByteArray data="");
|
||||||
|
|
||||||
};
|
}
|
||||||
|
@ -17,4 +17,4 @@ namespace RGBW {
|
|||||||
WhiteAlgorithm stringToWhiteAlgorithm(QString str);
|
WhiteAlgorithm stringToWhiteAlgorithm(QString str);
|
||||||
void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, const WhiteAlgorithm algorithm);
|
void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, const WhiteAlgorithm algorithm);
|
||||||
|
|
||||||
};
|
}
|
||||||
|
@ -96,4 +96,4 @@ inline type stringToType(const QString& type)
|
|||||||
else if (type == "protoServer") return PROTOSERVER;
|
else if (type == "protoServer") return PROTOSERVER;
|
||||||
else return INVALID;
|
else return INVALID;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
@ -143,7 +143,8 @@ PyObject* EffectModule::wrapSetColor(PyObject *self, PyObject *args)
|
|||||||
if (PyArg_ParseTuple(args, "bbb", &color.red, &color.green, &color.blue))
|
if (PyArg_ParseTuple(args, "bbb", &color.red, &color.green, &color.blue))
|
||||||
{
|
{
|
||||||
getEffect()->_colors.fill(color);
|
getEffect()->_colors.fill(color);
|
||||||
getEffect()->setInput(getEffect()->_priority, getEffect()->_colors.toStdVector(), timeout, false);
|
QVector<ColorRgb> _cQV = getEffect()->_colors;
|
||||||
|
getEffect()->setInput(getEffect()->_priority, std::vector<ColorRgb>( _cQV.begin(), _cQV.end() ), timeout, false);
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -161,7 +162,8 @@ PyObject* EffectModule::wrapSetColor(PyObject *self, PyObject *args)
|
|||||||
{
|
{
|
||||||
char * data = PyByteArray_AS_STRING(bytearray);
|
char * data = PyByteArray_AS_STRING(bytearray);
|
||||||
memcpy(getEffect()->_colors.data(), data, length);
|
memcpy(getEffect()->_colors.data(), data, length);
|
||||||
getEffect()->setInput(getEffect()->_priority, getEffect()->_colors.toStdVector(), timeout, false);
|
QVector<ColorRgb> _cQV = getEffect()->_colors;
|
||||||
|
getEffect()->setInput(getEffect()->_priority, std::vector<ColorRgb>( _cQV.begin(), _cQV.end() ), timeout, false);
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -47,7 +47,7 @@ void V4L2Wrapper::setSignalThreshold(double redSignalThreshold, double greenSign
|
|||||||
_grabber.setSignalThreshold( redSignalThreshold, greenSignalThreshold, blueSignalThreshold, 50);
|
_grabber.setSignalThreshold( redSignalThreshold, greenSignalThreshold, blueSignalThreshold, 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
void V4L2Wrapper::setCropping(int cropLeft, int cropRight, int cropTop, int cropBottom)
|
void V4L2Wrapper::setCropping(unsigned cropLeft, unsigned cropRight, unsigned cropTop, unsigned cropBottom)
|
||||||
{
|
{
|
||||||
_grabber.setCropping(cropLeft, cropRight, cropTop, cropBottom);
|
_grabber.setCropping(cropLeft, cropRight, cropTop, cropBottom);
|
||||||
}
|
}
|
||||||
|
@ -40,9 +40,9 @@ void ComponentRegister::setNewComponentState(const hyperion::Components comp, co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComponentRegister::handleCompStateChangeRequest(const hyperion::Components comp, const bool activated)
|
void ComponentRegister::handleCompStateChangeRequest(const hyperion::Components comps, const bool activated)
|
||||||
{
|
{
|
||||||
if(comp == COMP_ALL && !_inProgress)
|
if(comps == COMP_ALL && !_inProgress)
|
||||||
{
|
{
|
||||||
_inProgress = true;
|
_inProgress = true;
|
||||||
if(!activated && _prevComponentStates.empty())
|
if(!activated && _prevComponentStates.empty())
|
||||||
|
@ -87,7 +87,7 @@ private:
|
|||||||
///
|
///
|
||||||
/// @return Zero on success else negative
|
/// @return Zero on success else negative
|
||||||
///
|
///
|
||||||
virtual int write(const std::vector<ColorRgb>& ledValues);
|
virtual int write(const std::vector<ColorRgb>& ledValues) override;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Test if the device is a (or the) lightpack we are looking for
|
/// Test if the device is a (or the) lightpack we are looking for
|
||||||
|
@ -87,8 +87,7 @@ int LedDeviceFile::write(const std::vector<ColorRgb> & ledValues)
|
|||||||
// get a precise timestamp as a string
|
// get a precise timestamp as a string
|
||||||
const auto now = std::chrono::system_clock::now();
|
const auto now = std::chrono::system_clock::now();
|
||||||
const auto nowAsTimeT = std::chrono::system_clock::to_time_t(now);
|
const auto nowAsTimeT = std::chrono::system_clock::to_time_t(now);
|
||||||
const auto nowMs = std::chrono::duration_cast<std::chrono::milliseconds>(
|
const auto nowMs = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()) % 1000;
|
||||||
now.time_since_epoch()) % 1000;
|
|
||||||
|
|
||||||
const auto elapsedTimeMs = std::chrono::duration_cast<std::chrono::milliseconds>(now - lastWriteTime);
|
const auto elapsedTimeMs = std::chrono::duration_cast<std::chrono::milliseconds>(now - lastWriteTime);
|
||||||
|
|
||||||
|
@ -32,9 +32,12 @@ LedDevicePiBlaster::LedDevicePiBlaster(const QJsonObject &deviceConfig)
|
|||||||
|
|
||||||
LedDevicePiBlaster::~LedDevicePiBlaster()
|
LedDevicePiBlaster::~LedDevicePiBlaster()
|
||||||
{
|
{
|
||||||
|
if (_fid != nullptr)
|
||||||
|
{
|
||||||
|
fclose(_fid);
|
||||||
|
_fid = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LedDevicePiBlaster::init(const QJsonObject &deviceConfig)
|
bool LedDevicePiBlaster::init(const QJsonObject &deviceConfig)
|
||||||
{
|
{
|
||||||
@ -95,7 +98,6 @@ int LedDevicePiBlaster::open()
|
|||||||
if (!QFile::exists(_deviceName))
|
if (!QFile::exists(_deviceName))
|
||||||
{
|
{
|
||||||
errortext = QString ("The device (%1) does not yet exist.").arg(_deviceName);
|
errortext = QString ("The device (%1) does not yet exist.").arg(_deviceName);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -116,7 +118,6 @@ int LedDevicePiBlaster::open()
|
|||||||
if ( retval < 0 )
|
if ( retval < 0 )
|
||||||
{
|
{
|
||||||
this->setInError( errortext );
|
this->setInError( errortext );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
@ -132,8 +133,8 @@ void LedDevicePiBlaster::close()
|
|||||||
{
|
{
|
||||||
fclose(_fid);
|
fclose(_fid);
|
||||||
_fid = nullptr;
|
_fid = nullptr;
|
||||||
}}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int LedDevicePiBlaster::write(const std::vector<ColorRgb> & ledValues)
|
int LedDevicePiBlaster::write(const std::vector<ColorRgb> & ledValues)
|
||||||
{
|
{
|
||||||
@ -172,8 +173,8 @@ int LedDevicePiBlaster::write(const std::vector<ColorRgb> & ledValues)
|
|||||||
|
|
||||||
// fprintf(_fid, "%i=%f\n", iPins[iPin], pwmDutyCycle);
|
// fprintf(_fid, "%i=%f\n", iPins[iPin], pwmDutyCycle);
|
||||||
|
|
||||||
if ( (fprintf(_fid, "%i=%f\n", i, pwmDutyCycle) < 0)
|
if ( (fprintf(_fid, "%i=%f\n", i, pwmDutyCycle) < 0) || (fflush(_fid) < 0))
|
||||||
|| (fflush(_fid) < 0)) {
|
{
|
||||||
if (_fid != nullptr)
|
if (_fid != nullptr)
|
||||||
{
|
{
|
||||||
fclose(_fid);
|
fclose(_fid);
|
||||||
|
@ -208,7 +208,8 @@ int main(int argc, char * argv[])
|
|||||||
if (parser.isSet(argColor))
|
if (parser.isSet(argColor))
|
||||||
{
|
{
|
||||||
// TODO: make sure setColor accepts a QList<QColor>
|
// TODO: make sure setColor accepts a QList<QColor>
|
||||||
connection.setColor(argColor.getColors(parser).toVector().toStdVector(), argPriority.getInt(parser), argDuration.getInt(parser));
|
QVector<QColor> _cQV = argColor.getColors(parser).toVector();
|
||||||
|
connection.setColor(std::vector<QColor>( _cQV.begin(), _cQV.end() ), argPriority.getInt(parser), argDuration.getInt(parser));
|
||||||
}
|
}
|
||||||
else if (parser.isSet(argImage))
|
else if (parser.isSet(argImage))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user