diff --git a/HyperionConfig.h.in b/HyperionConfig.h.in index 2d090991..5197643b 100644 --- a/HyperionConfig.h.in +++ b/HyperionConfig.h.in @@ -39,3 +39,5 @@ #define HYPERION_VERSION "${HYPERION_VERSION_MAJOR}.${HYPERION_VERSION_MINOR}.${HYPERION_VERSION_PATCH}" #define HYPERION_JSON_VERSION "1.0.0" + +#define CURRENT_CONFIG_VERSION 2 diff --git a/assets/webconfig/i18n/de.json b/assets/webconfig/i18n/de.json index 66face1a..b73a9191 100644 --- a/assets/webconfig/i18n/de.json +++ b/assets/webconfig/i18n/de.json @@ -428,6 +428,10 @@ "edt_eff_enableshutdown_title" : "Echtes herunterfahren", "edt_eff_length_title" : "Länge", "edt_eff_frequency_title" : "Frequenz", + "edt_eff_tails_header_title" : "Trails", + "edt_eff_min_len_title" : "Minimale Länge", + "edt_eff_max_len_title" : "Maximale Länge", + "edt_eff_height_title" : "Höhe", "edt_append_ns" : "ns", "edt_append_ms" : "ms", "edt_append_s" : "s", diff --git a/assets/webconfig/i18n/en.json b/assets/webconfig/i18n/en.json index a8bbd8ad..4085157d 100644 --- a/assets/webconfig/i18n/en.json +++ b/assets/webconfig/i18n/en.json @@ -429,6 +429,10 @@ "edt_eff_enableshutdown_title" : "Real shutdown", "edt_eff_length_title" : "Length", "edt_eff_frequency_title" : "Frequency", + "edt_eff_tails_header_title" : "Trails", + "edt_eff_min_len_title" : "Minimal length", + "edt_eff_max_len_title" : "Maximal length", + "edt_eff_height_title" : "Height", "edt_append_ns" : "ns", "edt_append_ms" : "ms", "edt_append_s" : "s", diff --git a/effects/schema/trails.json b/effects/schema/trails.json new file mode 100644 index 00000000..728e8bdf --- /dev/null +++ b/effects/schema/trails.json @@ -0,0 +1,65 @@ +{ + "type":"object", + "script" : "trails.py", + "title":"edt_eff_trails_header_title", + "required":true, + "properties":{ + "min_len": { + "type": "integer", + "title":"edt_eff_min_len_title", + "default": 2, + "minimum" : 1, + "propertyOrder" : 1 + }, + "max_len": { + "type": "integer", + "title":"edt_eff_max_len_title", + "default": 7, + "minimum" : 1, + "propertyOrder" : 2 + }, + "height": { + "type": "integer", + "title":"edt_eff_height_title", + "default": 8, + "minimum" : 1, + "propertyOrder" : 3 + }, + "trails": { + "type": "integer", + "title":"edt_eff_trails_title", + "default": 3, + "minimum" : 1, + "propertyOrder" : 4 + }, + "speed": { + "type": "number", + "title":"edt_eff_speed_title", + "default": 1.0, + "minimum" : 0.1, + "propertyOrder" : 5 + }, + "random": { + "type": "boolean", + "title":"edt_eff_random_header_title", + "default": false, + "propertyOrder" : 6 + }, + "color": { + "type": "array", + "title":"edt_eff_color_title", + "format":"colorpicker", + "default": [255,0,0], + "items" : { + "type": "integer", + "minimum": 0, + "maximum": 255 + }, + "minItems": 3, + "maxItems": 3, + "propertyOrder" : 7 + } + }, + "additionalProperties": false +} + diff --git a/effects/trails.json b/effects/trails.json index d2c14a21..710a4be2 100644 --- a/effects/trails.json +++ b/effects/trails.json @@ -3,10 +3,10 @@ "script" : "trails.py", "args" : { - "min_len" : 2, - "max_len" : 7, - "height" : 8, - "trails": 3, + "min_len" : 2, + "max_len" : 7, + "height" : 8, + "trails": 3, "speed" : 1.0, "random" : false, "color" : [255, 255, 255] diff --git a/effects/trails_color.json b/effects/trails_color.json index 33d27475..4d1d2449 100644 --- a/effects/trails_color.json +++ b/effects/trails_color.json @@ -3,10 +3,10 @@ "script" : "trails.py", "args" : { - "min_len" : 2, - "max_len" : 6, - "height" : 8, - "trails": 16, + "min_len" : 2, + "max_len" : 6, + "height" : 8, + "trails": 16, "speed" : 8.0, "random" : true, "color" : [255, 255, 255] diff --git a/libsrc/grabber/amlogic/AmlogicWrapper.cpp b/libsrc/grabber/amlogic/AmlogicWrapper.cpp index bea3cd57..ef21bced 100644 --- a/libsrc/grabber/amlogic/AmlogicWrapper.cpp +++ b/libsrc/grabber/amlogic/AmlogicWrapper.cpp @@ -39,12 +39,9 @@ void AmlogicWrapper::action() return; } - if ( _forward ) - { - Image image_rgb; - _image.toRgb(image_rgb); - emit emitImage(_priority, image_rgb, _timeout_ms); - } + Image image_rgb; + _image.toRgb(image_rgb); + emit emitImage(_priority, image_rgb, _timeout_ms); _processor->process(_image, _ledColors); setColors(_ledColors, _timeout_ms); diff --git a/libsrc/grabber/dispmanx/DispmanxWrapper.cpp b/libsrc/grabber/dispmanx/DispmanxWrapper.cpp index 419c0a89..0207edc1 100644 --- a/libsrc/grabber/dispmanx/DispmanxWrapper.cpp +++ b/libsrc/grabber/dispmanx/DispmanxWrapper.cpp @@ -35,12 +35,9 @@ void DispmanxWrapper::action() // Grab frame into the allocated image _grabber->grabFrame(_image); - if ( _forward ) - { - Image image_rgb; - _image.toRgb(image_rgb); - emit emitImage(_priority, image_rgb, _timeout_ms); - } + Image image_rgb; + _image.toRgb(image_rgb); + emit emitImage(_priority, image_rgb, _timeout_ms); _processor->process(_image, _ledColors); setColors(_ledColors, _timeout_ms); diff --git a/libsrc/grabber/framebuffer/FramebufferWrapper.cpp b/libsrc/grabber/framebuffer/FramebufferWrapper.cpp index 180eeaf8..3c60607b 100644 --- a/libsrc/grabber/framebuffer/FramebufferWrapper.cpp +++ b/libsrc/grabber/framebuffer/FramebufferWrapper.cpp @@ -31,10 +31,7 @@ void FramebufferWrapper::action() // Grab frame into the allocated image _grabber->grabFrame(_image); - if ( _forward ) - { - emit emitImage(_priority, _image, _timeout_ms); - } + emit emitImage(_priority, _image, _timeout_ms); _processor->process(_image, _ledColors); setColors(_ledColors, _timeout_ms); diff --git a/libsrc/grabber/osx/OsxWrapper.cpp b/libsrc/grabber/osx/OsxWrapper.cpp index f919cfe4..da190b15 100644 --- a/libsrc/grabber/osx/OsxWrapper.cpp +++ b/libsrc/grabber/osx/OsxWrapper.cpp @@ -31,10 +31,7 @@ void OsxWrapper::action() // Grab frame into the allocated image _grabber->grabFrame(_image); - if ( _forward ) - { - emit emitImage(_priority, _image, _timeout_ms); - } + emit emitImage(_priority, _image, _timeout_ms); _processor->process(_image, _ledColors); setColors(_ledColors, _timeout_ms); diff --git a/libsrc/grabber/v4l2/V4L2Wrapper.cpp b/libsrc/grabber/v4l2/V4L2Wrapper.cpp index 0eb013bc..ae1fcc2d 100644 --- a/libsrc/grabber/v4l2/V4L2Wrapper.cpp +++ b/libsrc/grabber/v4l2/V4L2Wrapper.cpp @@ -87,11 +87,7 @@ void V4L2Wrapper::set3D(VideoMode mode) void V4L2Wrapper::newFrame(const Image &image) { - // forward to other hyperions - //if ( _forward ) - //{ - emit emitImage(_priority, image, _timeout_ms); - //} + emit emitImage(_priority, image, _timeout_ms); // process the new image _processor->process(image, _ledColors); diff --git a/libsrc/grabber/x11/X11Wrapper.cpp b/libsrc/grabber/x11/X11Wrapper.cpp index 31a2cb8b..7fa2cf75 100644 --- a/libsrc/grabber/x11/X11Wrapper.cpp +++ b/libsrc/grabber/x11/X11Wrapper.cpp @@ -64,10 +64,7 @@ void X11Wrapper::action() // Grab frame into the allocated image _grabber->grabFrame(_image); - //if ( _forward ) - //{ - emit emitImage(_priority, _image, _timeout_ms); - //} + emit emitImage(_priority, _image, _timeout_ms); _processor->process(_image, _ledColors); setColors(_ledColors, _timeout_ms); diff --git a/src/hyperiond/CMakeLists.txt b/src/hyperiond/CMakeLists.txt index fa1c0abd..820a23ef 100644 --- a/src/hyperiond/CMakeLists.txt +++ b/src/hyperiond/CMakeLists.txt @@ -1,5 +1,7 @@ add_executable(hyperiond + configMigratorBase.cpp + configMigratorBase.h configMigrator.cpp configMigrator.h hyperiond.cpp diff --git a/src/hyperiond/configMigrator.cpp b/src/hyperiond/configMigrator.cpp index d282b3ed..633998f5 100644 --- a/src/hyperiond/configMigrator.cpp +++ b/src/hyperiond/configMigrator.cpp @@ -2,7 +2,6 @@ ConfigMigrator::ConfigMigrator() - : _log(Logger::getInstance("ConfigMigrator")) { } @@ -13,7 +12,23 @@ ConfigMigrator::~ConfigMigrator() bool ConfigMigrator::migrate(QString configFile, int fromVersion,int toVersion) { Debug(_log, "migrate config %s from version %d to %d.", configFile.toLocal8Bit().constData(), fromVersion, toVersion); - throw std::runtime_error("ERROR: config migration not implemented"); + + for (int v=fromVersion; v - +#include "configMigratorBase.h" #include -class ConfigMigrator +/// +/// class that contains migration code +/// helper code goeas to base class +class ConfigMigrator : public ConfigMigratorBase + { public: @@ -12,6 +15,7 @@ public: ~ConfigMigrator(); bool migrate(QString configFile, int fromVersion,int toVersion); + private: - Logger * _log; + void migrateFrom1(); }; \ No newline at end of file diff --git a/src/hyperiond/configMigratorBase.cpp b/src/hyperiond/configMigratorBase.cpp new file mode 100644 index 00000000..90db5075 --- /dev/null +++ b/src/hyperiond/configMigratorBase.cpp @@ -0,0 +1,11 @@ +#include "configMigratorBase.h" + +ConfigMigratorBase::ConfigMigratorBase() + : _log(Logger::getInstance("ConfigMigrator")) +{ +} + +ConfigMigratorBase::~ConfigMigratorBase() +{ +} + diff --git a/src/hyperiond/configMigratorBase.h b/src/hyperiond/configMigratorBase.h new file mode 100644 index 00000000..457b6a21 --- /dev/null +++ b/src/hyperiond/configMigratorBase.h @@ -0,0 +1,16 @@ +#pragma once + +#include + +#include + +class ConfigMigratorBase +{ + +public: + ConfigMigratorBase(); + ~ConfigMigratorBase(); + +protected: + Logger * _log; +}; \ No newline at end of file diff --git a/src/hyperiond/hyperiond.cpp b/src/hyperiond/hyperiond.cpp index 5810af95..695ec3aa 100644 --- a/src/hyperiond/hyperiond.cpp +++ b/src/hyperiond/hyperiond.cpp @@ -414,7 +414,7 @@ void HyperionDaemon::createSystemFrameGrabber() if (_qconfig.contains("framegrabber")) { const QJsonObject & grabberConfig = _qconfig["framegrabber"].toObject(); - if (grabberConfig["enable"].toBool(true)) +// if (grabberConfig["enable"].toBool(true)) { _grabber_width = grabberConfig["width"].toInt(96); _grabber_height = grabberConfig["height"].toInt(96); @@ -464,7 +464,7 @@ void HyperionDaemon::createSystemFrameGrabber() Info( _log, "set screen capture device to '%s'", type.toUtf8().constData()); } - bool grabberCompState = true; + bool grabberCompState = grabberConfig["enable"].toBool(true); if (type == "") { Info( _log, "screen capture device disabled"); grabberCompState = false; } else if (type == "framebuffer") createGrabberFramebuffer(grabberConfig); else if (type == "dispmanx") createGrabberDispmanx(); @@ -474,6 +474,7 @@ void HyperionDaemon::createSystemFrameGrabber() else { Warning( _log, "unknown framegrabber type '%s'", type.toUtf8().constData()); grabberCompState = false; } _hyperion->getComponentRegister().componentStateChanged(hyperion::COMP_GRABBER, grabberCompState); + _hyperion->setComponentState(hyperion::COMP_GRABBER, grabberCompState ); } } } diff --git a/src/hyperiond/hyperiond.h b/src/hyperiond/hyperiond.h index 7c7fd36f..f5dce843 100644 --- a/src/hyperiond/hyperiond.h +++ b/src/hyperiond/hyperiond.h @@ -1,7 +1,5 @@ #pragma once -const int CURRENT_CONFIG_VERSION = 2; - #include #ifdef ENABLE_DISPMANX diff --git a/test/TestConfigFile.cpp b/test/TestConfigFile.cpp index d4ecca5e..9c8d31c3 100644 --- a/test/TestConfigFile.cpp +++ b/test/TestConfigFile.cpp @@ -10,6 +10,7 @@ // hyperion includes #include +#include "HyperionConfig.h" bool loadConfig(const QString & configFile) { @@ -21,7 +22,7 @@ bool loadConfig(const QString & configFile) // read and set the json schema from the resource //////////////////////////////////////////////////////////// - QFile schemaData(":/hyperion-schema"); + QFile schemaData(":/hyperion-schema-"+QString::number(CURRENT_CONFIG_VERSION)); if (!schemaData.open(QIODevice::ReadOnly)) {