From 6a6b29dfa970ff1c0b1b4d46192d27deaedab70c Mon Sep 17 00:00:00 2001 From: Awawa <69086569+awawa-dev@users.noreply.github.com> Date: Fri, 24 Mar 2023 01:09:37 +0000 Subject: [PATCH] New JSON API method to update smoothing parameters (#352) * JSON API method that updates smoothing parameters * Update lang resources * Set smoothing on the same thread --- assets/webconfig/content/json_api.html | 60 ++++++++++++++++++- assets/webconfig/i18n/cs.json | 4 ++ assets/webconfig/i18n/de.json | 4 ++ assets/webconfig/i18n/en.json | 4 ++ assets/webconfig/i18n/es.json | 4 ++ assets/webconfig/i18n/fr.json | 4 ++ assets/webconfig/i18n/it.json | 4 ++ assets/webconfig/i18n/nl.json | 4 ++ assets/webconfig/i18n/pl.json | 4 ++ assets/webconfig/i18n/ro.json | 4 ++ assets/webconfig/i18n/ru.json | 4 ++ assets/webconfig/i18n/sv.json | 4 ++ assets/webconfig/i18n/tr.json | 4 ++ assets/webconfig/i18n/vi.json | 4 ++ assets/webconfig/i18n/zh-CN.json | 4 ++ assets/webconfig/js/json_api.js | 39 +++++++++++- include/api/JsonAPI.h | 2 + include/base/HyperHdrIManager.h | 2 + include/base/HyperHdrInstance.h | 1 + include/base/LinearSmoothing.h | 2 + .../api/JSONRPC_schema/schema-smoothing.json | 28 +++++++++ sources/api/JSONRPC_schema/schema.json | 2 +- sources/api/JSONRPC_schemas.qrc | 7 ++- sources/api/JsonAPI.cpp | 15 +++++ sources/base/HyperHdrIManager.cpp | 8 +++ sources/base/HyperHdrInstance.cpp | 5 ++ sources/base/LinearSmoothing.cpp | 9 +++ 27 files changed, 229 insertions(+), 7 deletions(-) create mode 100644 sources/api/JSONRPC_schema/schema-smoothing.json diff --git a/assets/webconfig/content/json_api.html b/assets/webconfig/content/json_api.html index b8c663497..20bb7e4d4 100644 --- a/assets/webconfig/content/json_api.html +++ b/assets/webconfig/content/json_api.html @@ -602,7 +602,65 @@

Explanation

+ +
+
+
+
+
+
+
+
+
+

Explanation

+ +
+
+
+
+
+
+ + +
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ +
+
+
+
+
+ +
\ No newline at end of file + diff --git a/assets/webconfig/i18n/cs.json b/assets/webconfig/i18n/cs.json index 07570130f..45deba4ee 100644 --- a/assets/webconfig/i18n/cs.json +++ b/assets/webconfig/i18n/cs.json @@ -1127,6 +1127,10 @@ "json_api_clear_expl": "Jasná priorita z efektů a přednastavených barev.", "json_api_hdr": "Režim HDR", "json_api_hdr_expl": "Zapnutí/vypnutí mapování tónu HDR pro USB grabber. „Border mode“ funguje pouze pro stream MJPEG.", + "json_api_smoothing": "Vyhlazující ovládání", + "json_api_smoothing_expl": "Metoda umožňuje volatilní modifikaci vyhlazovacích parametrů pro všechny nebo jednotlivé instance.", + "json_api_all_instances": "Všechny případy", + "json_api_single_instance": "Jediná instance", "led_editor_context_move": "Přestěhovat se", "led_editor_context_properties": "Vlastnosti", "led_editor_context_delete": "Vymazat", diff --git a/assets/webconfig/i18n/de.json b/assets/webconfig/i18n/de.json index 990bb74cf..0575ab9bb 100644 --- a/assets/webconfig/i18n/de.json +++ b/assets/webconfig/i18n/de.json @@ -1127,6 +1127,10 @@ "json_api_clear_expl": "Klare Priorität von Effekten und voreingestellten Farben.", "json_api_hdr": "HDR-Modus", "json_api_hdr_expl": "Schalten Sie das HDR-Tone-Mapping für den USB-Grabber ein/aus. Der 'Grenzmodus' funktioniert nur für MJPEG-Streams.", + "json_api_smoothing": "Glättungssteuerung", + "json_api_smoothing_expl": "Das Verfahren ermöglicht eine flüchtige Modifikation von Glättungsparametern für alle oder einzelne Instanzen.", + "json_api_all_instances": "Alle Instanzen", + "json_api_single_instance": "Einzelne Instanz", "led_editor_context_move": "Bewegen", "led_editor_context_properties": "Eigenschaften", "led_editor_context_delete": "Löschen", diff --git a/assets/webconfig/i18n/en.json b/assets/webconfig/i18n/en.json index e79d2e937..10f48b76a 100644 --- a/assets/webconfig/i18n/en.json +++ b/assets/webconfig/i18n/en.json @@ -1183,6 +1183,10 @@ "edt_conf_mqtt_ssl_ignore_errors_expl" : "Ignore all SSL errors such as self-signed certificates etc. Use with caution.", "json_api_flatbuffers_user_lut" : "Flatbuffers LUT filename", "json_api_hdr_expl" : "Turn on/off HDR tone mapping. You can also pass the name of the user LUT file in the user HyperHDR home folder to be used for Flatbuffers tone mapping.", + "json_api_smoothing" : "Smoothing control", + "json_api_smoothing_expl" : "The method allows for volatile modification of smoothing parameters for all or single instances.", + "json_api_all_instances" : "All instances", + "json_api_single_instance" : "Single instance", "led_editor_context_move": "Move", "led_editor_context_properties": "Properties", "led_editor_context_delete": "Delete", diff --git a/assets/webconfig/i18n/es.json b/assets/webconfig/i18n/es.json index 858651820..35a310a21 100644 --- a/assets/webconfig/i18n/es.json +++ b/assets/webconfig/i18n/es.json @@ -1127,6 +1127,10 @@ "json_api_clear_expl": "Prioridad clara de efectos y colores preestablecidos.", "json_api_hdr": "Modo HDR", "json_api_hdr_expl": "Activa / desactiva el mapeo de tonos HDR para capturador USB. El 'modo de borde' funciona solo para la transmisión MJPEG.", + "json_api_smoothing": "Control de suavizado", + "json_api_smoothing_expl": "El método permite la modificación volátil de los parámetros de suavizado para todos los casos o para uno solo.", + "json_api_all_instances": "Todas las instancias", + "json_api_single_instance": "Única instancia", "led_editor_context_move": "Muevete", "led_editor_context_properties": "Propiedades", "led_editor_context_delete": "Borrar", diff --git a/assets/webconfig/i18n/fr.json b/assets/webconfig/i18n/fr.json index 4e0a8079a..dad311b88 100644 --- a/assets/webconfig/i18n/fr.json +++ b/assets/webconfig/i18n/fr.json @@ -1127,6 +1127,10 @@ "json_api_clear_expl": "Effacer la priorité des effets et des couleurs prédéfinies.", "json_api_hdr": "Mode HDR", "json_api_hdr_expl": "Activez/désactivez le mappage de tonalité HDR pour la capture USB. Le « mode frontière » ne fonctionne que pour le flux MJPEG.", + "json_api_smoothing": "Contrôle du lissage", + "json_api_smoothing_expl": "Le procédé permet une modification volatile des paramètres de lissage pour toutes les instances ou une seule.", + "json_api_all_instances": "Toutes les occurrences", + "json_api_single_instance": "Seule instance", "led_editor_context_move": "Déplacer", "led_editor_context_properties": "Propriétés", "led_editor_context_delete": "Effacer", diff --git a/assets/webconfig/i18n/it.json b/assets/webconfig/i18n/it.json index 32d8bbb81..f7be82dc4 100644 --- a/assets/webconfig/i18n/it.json +++ b/assets/webconfig/i18n/it.json @@ -1127,6 +1127,10 @@ "json_api_clear_expl": "Cancella priorità dagli effetti e dai colori preimpostati.", "json_api_hdr": "Modalità HDR", "json_api_hdr_expl": "Attiva/disattiva la mappatura dei toni HDR per USB grabber. La 'Modalità bordo' funziona solo per il flusso MJPEG.", + "json_api_smoothing": "Controllo del livellamento", + "json_api_smoothing_expl": "Il metodo consente la modifica volatile dei parametri di livellamento per tutte o singole istanze.", + "json_api_all_instances": "Tutte le istanze", + "json_api_single_instance": "Singola istanza", "led_editor_context_move": "Spostare", "led_editor_context_properties": "Proprietà", "led_editor_context_delete": "Elimina", diff --git a/assets/webconfig/i18n/nl.json b/assets/webconfig/i18n/nl.json index 6e935facd..a287ea811 100644 --- a/assets/webconfig/i18n/nl.json +++ b/assets/webconfig/i18n/nl.json @@ -1127,6 +1127,10 @@ "json_api_clear_expl": "Duidelijke prioriteit van effecten en vooraf ingestelde kleuren.", "json_api_hdr": "HDR-modus", "json_api_hdr_expl": "Schakel HDR-toontoewijzing voor USB-grabber in/uit. 'Border-modus' werkt alleen voor MJPEG-stream.", + "json_api_smoothing": "Vloeiende controle", + "json_api_smoothing_expl": "De methode maakt een vluchtige wijziging van afvlakkingsparameters voor alle of enkele instanties mogelijk.", + "json_api_all_instances": "Alle instanties", + "json_api_single_instance": "Enkele instantie", "led_editor_context_move": "Beweging", "led_editor_context_properties": "Eigendommen", "led_editor_context_delete": "Verwijderen", diff --git a/assets/webconfig/i18n/pl.json b/assets/webconfig/i18n/pl.json index e54d65eb0..91a7e68b5 100644 --- a/assets/webconfig/i18n/pl.json +++ b/assets/webconfig/i18n/pl.json @@ -1127,6 +1127,10 @@ "json_api_clear_expl": "Wyczyść priorytet efektów i wstępnie ustawionych kolorów.", "json_api_hdr": "Tryb HDR", "json_api_hdr_expl": "Włącz/wyłącz mapowanie tonów HDR dla grabbera USB. „Tryb graniczny” działa tylko dla strumienia MJPEG.", + "json_api_smoothing": "Kontrola wygładzania", + "json_api_smoothing_expl": "Metoda pozwala na lotną modyfikację parametrów wygładzania dla wszystkich lub pojedynczych instancji.", + "json_api_all_instances": "Wszystkie instancje", + "json_api_single_instance": "Pojedyncza instancja", "led_editor_context_move": "Przenosić", "led_editor_context_properties": "Właściwości", "led_editor_context_delete": "Usuwać", diff --git a/assets/webconfig/i18n/ro.json b/assets/webconfig/i18n/ro.json index 49dde3a3c..4fd916d81 100644 --- a/assets/webconfig/i18n/ro.json +++ b/assets/webconfig/i18n/ro.json @@ -1127,6 +1127,10 @@ "json_api_clear_expl": "Ștergeți prioritatea de la efecte și culori prestabilite.", "json_api_hdr": "Mod HDR", "json_api_hdr_expl": "Activați / dezactivați maparea tonurilor HDR pentru dispozitivul de captare USB. „Modul de frontieră” funcționează numai pentru fluxul MJPEG.", + "json_api_smoothing": "Control de netezire", + "json_api_smoothing_expl": "Metoda permite modificarea volatilă a parametrilor de netezire pentru toate cazurile sau pentru o singură instanță.", + "json_api_all_instances": "Toate cazurile", + "json_api_single_instance": "O singură instanță", "led_editor_context_move": "Mutare", "led_editor_context_properties": "Proprietăți", "led_editor_context_delete": "Șterge", diff --git a/assets/webconfig/i18n/ru.json b/assets/webconfig/i18n/ru.json index b1c582d6f..653b33b11 100644 --- a/assets/webconfig/i18n/ru.json +++ b/assets/webconfig/i18n/ru.json @@ -1124,6 +1124,10 @@ "json_api_clear": "Очистить приоритет", "json_api_clear_expl": "Очистите приоритет от эффектов и предустановленных цветов.", "json_api_hdr": "Режим HDR", + "json_api_smoothing": "Сглаживание", + "json_api_smoothing_expl": "Метод допускает изменчивую модификацию параметров сглаживания для всех или отдельных экземпляров.", + "json_api_all_instances": "Все экземпляры", + "json_api_single_instance": "Один экземпляр", "json_api_components_expl_multi": "Вы можете запускать несколько команд с помощью одной ссылки. Максимальная длина - 2048 символов. Все они будут выполнены, но вы получите только один ответ (просмотрите журналы для всего вывода). Просто поместите содержимое request ваших ссылок в формат (обратите внимание на первый символ '?' И следующие символы '&'):
http://IP:PORT/json-rpc?request=request1&request=request2&request=request3...", "edt_conf_stream_autoResume_title": "Авто возобновление", "edt_conf_stream_autoResume_expl": "Попробуйте перезапустить захват видео, если видеопоток остановился. Используйте с осторожностью, так как это не лекарство от аппаратных проблем граббера.", diff --git a/assets/webconfig/i18n/sv.json b/assets/webconfig/i18n/sv.json index 22dffc4dc..764c7727c 100644 --- a/assets/webconfig/i18n/sv.json +++ b/assets/webconfig/i18n/sv.json @@ -1127,6 +1127,10 @@ "json_api_clear_expl": "Tydlig prioritet från effekter och förinställda färger.", "json_api_hdr": "HDR -läge", "json_api_hdr_expl": "Slå på/av HDR -tonmappning för USB -gripare. \"Gränsläge\" fungerar endast för MJPEG -ström.", + "json_api_smoothing": "Utjämnande kontroll", + "json_api_smoothing_expl": "Metoden möjliggör flyktig modifiering av utjämningsparametrar för alla eller enstaka instanser.", + "json_api_all_instances": "Alla instanser", + "json_api_single_instance": "Enstaka instans", "led_editor_context_move": "Flytta", "led_editor_context_properties": "Egenskaper", "led_editor_context_delete": "Radera", diff --git a/assets/webconfig/i18n/tr.json b/assets/webconfig/i18n/tr.json index 70bbdebc9..5b33af1e5 100644 --- a/assets/webconfig/i18n/tr.json +++ b/assets/webconfig/i18n/tr.json @@ -1127,6 +1127,10 @@ "json_api_clear_expl": "Efektlerden ve önceden ayarlanmış renklerden önceliği temizleyin.", "json_api_hdr": "HDR modu", "json_api_hdr_expl": "USB yakalayıcı için HDR ton eşlemesini açın/kapatın. 'Sınır modu' yalnızca MJPEG akışı için çalışır.", + "json_api_smoothing": "Yumuşatma kontrolü", + "json_api_smoothing_expl": "Yöntem, tüm veya tek örnekler için yumuşatma parametrelerinin geçici olarak değiştirilmesine izin verir.", + "json_api_all_instances": "Tüm örnekler", + "json_api_single_instance": "Tek örnek", "led_editor_context_move": "Hareket", "led_editor_context_properties": "Özellikleri", "led_editor_context_delete": "Silmek", diff --git a/assets/webconfig/i18n/vi.json b/assets/webconfig/i18n/vi.json index dc0cafea7..e531be0d1 100644 --- a/assets/webconfig/i18n/vi.json +++ b/assets/webconfig/i18n/vi.json @@ -1127,6 +1127,10 @@ "json_api_clear_expl": "Ưu tiên rõ ràng khỏi các hiệu ứng và màu đặt trước.", "json_api_hdr": "Chế độ HDR", "json_api_hdr_expl": "Bật / tắt ánh xạ giai điệu HDR cho bộ lấy USB. 'Chế độ viền' chỉ hoạt động cho luồng MJPEG.", + "json_api_smoothing": "kiểm soát làm mịn", + "json_api_smoothing_expl": "Phương pháp này cho phép sửa đổi không ổn định các tham số làm mịn cho tất cả hoặc các trường hợp đơn lẻ.", + "json_api_all_instances": "Tất cả các trường hợp", + "json_api_single_instance": "Trường hợp duy nhất", "led_editor_context_move": "Di chuyển", "led_editor_context_properties": "Đặc tính", "led_editor_context_delete": "Xóa bỏ", diff --git a/assets/webconfig/i18n/zh-CN.json b/assets/webconfig/i18n/zh-CN.json index 8e10d5992..523aa8751 100644 --- a/assets/webconfig/i18n/zh-CN.json +++ b/assets/webconfig/i18n/zh-CN.json @@ -1127,6 +1127,10 @@ "json_api_clear_expl": "清除效果和预设颜色的优先级。", "json_api_hdr": "HDR模式", "json_api_hdr_expl": "打开/关闭 USB 采集卡的 HDR 色调映射。 “边框模式”仅适用于 MJPEG 流。", + "json_api_smoothing": "平滑控制", + "json_api_smoothing_expl": "该方法允许对所有或单个实例的平滑参数进行可变修改。", + "json_api_all_instances": "所有实例", + "json_api_single_instance": "单实例", "led_editor_context_move": "移动", "led_editor_context_properties": "特性", "led_editor_context_delete": "删除", diff --git a/assets/webconfig/js/json_api.js b/assets/webconfig/js/json_api.js index 1920c8968..7f7339ca3 100644 --- a/assets/webconfig/js/json_api.js +++ b/assets/webconfig/js/json_api.js @@ -535,7 +535,8 @@ function BuildHdrJson() var state = $('input[name="hdrModeState"]:checked').val(); var flatbufferUserLut = $('#flatbuffersUserLut').val(); - var finJson = componentHdr.replace("{0}", state).replace("{1}", flatbufferUserLut); + var finJson = (flatbufferUserLut.length > 0) ? componentHdr.replace("{0}", state).replace("{1}", flatbufferUserLut) : + componentHdr.replace("{0},", state).replace('"flatbuffers_user_lut_filename":"{1}"', ""); $("#hdrMode_json").html(finJson); } @@ -591,4 +592,38 @@ function BuildVControlJson() } /////////////////////////////////////////////////////////////////////////////////////////////// -}); \ No newline at end of file + +var smoothingControl = +`{ + "command":"smoothing", + "subcommand":"{0}", + "time":{1} +}`; + +$('input[name="api_smoothing_target"], #json_api_smoothing_time').change( + function(){ + BuildSmoothingJson(); + }); + +$('#json_api_smoothing_time').keyup( + function(){ + BuildSmoothingJson(); + }); + +function BuildSmoothingJson() +{ + if ($("input[name='api_smoothing_target']:checked").val() && !isNaN($("#json_api_smoothing_time").val()) && $("#json_api_smoothing_time").val() >= 25) + { + $('button[name="smoothingControlButtons"]').each(function(i, obj) { + $(this).removeClass('disabled'); + }); + + var target = $('input[name="api_smoothing_target"]:checked').val(); + var time = $('#json_api_smoothing_time').val(); + var finJson = smoothingControl.replace("{0}", target).replace("{1}", time); + + $("#smoothingControl_json").html(finJson); + } +} + +}); diff --git a/include/api/JsonAPI.h b/include/api/JsonAPI.h index f81296fca..e04e2e90f 100644 --- a/include/api/JsonAPI.h +++ b/include/api/JsonAPI.h @@ -299,6 +299,8 @@ private slots: void handleBenchmarkCommand(const QJsonObject& message, const QString& command, int tan); + void handleSmoothingCommand(const QJsonObject& message, const QString& command, int tan); + void handleTunnel(const QJsonObject& message, const QString& command, int tan); /// diff --git a/include/base/HyperHdrIManager.h b/include/base/HyperHdrIManager.h index f25c67aee..7bc771cbb 100644 --- a/include/base/HyperHdrIManager.h +++ b/include/base/HyperHdrIManager.h @@ -40,6 +40,8 @@ class HyperHdrIManager : public QObject bool areInstancesReady(); public slots: + void setSmoothing(int time); + bool isCEC(); void setSignalStateByCEC(bool enable); diff --git a/include/base/HyperHdrInstance.h b/include/base/HyperHdrInstance.h index b5e16221a..b665dea7b 100644 --- a/include/base/HyperHdrInstance.h +++ b/include/base/HyperHdrInstance.h @@ -109,6 +109,7 @@ class HyperHdrInstance : public QObject public slots: + void setSmoothing(int time); void identifyLed(const QJsonObject& params); bool getReadOnlyMode() { return _readOnlyMode; }; diff --git a/include/base/LinearSmoothing.h b/include/base/LinearSmoothing.h index 4dcfb24c1..4850a57ac 100644 --- a/include/base/LinearSmoothing.h +++ b/include/base/LinearSmoothing.h @@ -84,6 +84,8 @@ public slots: /// @return The index of the cfg which can be passed to selectConfig() /// unsigned updateConfig(unsigned cfgID, int settlingTime_ms, double ledUpdateFrequency_hz, bool directModee); + + void updateCurrentConfig(int settlingTime_ms); private: /** diff --git a/sources/api/JSONRPC_schema/schema-smoothing.json b/sources/api/JSONRPC_schema/schema-smoothing.json new file mode 100644 index 000000000..62a3cc8ee --- /dev/null +++ b/sources/api/JSONRPC_schema/schema-smoothing.json @@ -0,0 +1,28 @@ +{ + "type":"object", + "required":true, + "properties": + { + "command": + { + "type" : "string", + "required" : true, + "enum" : ["smoothing"] + }, + "subcommand": { + "type" : "string", + "required" : true, + "enum" : ["all", "single"] + }, + "tan" : { + "type" : "integer" + }, + "time": { + "type" : "integer", + "minimum" : 25, + "maximum" : 5000, + "required": true + } + }, + "additionalProperties": false +} diff --git a/sources/api/JSONRPC_schema/schema.json b/sources/api/JSONRPC_schema/schema.json index fb3b59cdb..1a8e5b253 100644 --- a/sources/api/JSONRPC_schema/schema.json +++ b/sources/api/JSONRPC_schema/schema.json @@ -5,7 +5,7 @@ "command": { "type" : "string", "required" : true, - "enum": [ "color", "tunnel", "benchmark", "image", "effect", "create-effect", "delete-effect", "serverinfo", "clear", "clearall", "adjustment", "sourceselect", "config", "componentstate", "ledcolors", "load-db", "save-db", "logging", "performance-counters", "lut-calibration", "signal-calibration", "processing", "sysinfo", "videomodehdr", "video-crop", "videomode", "authorize", "instance", "leddevice", "transform", "correction", "temperature", "help", "video-controls" ] + "enum": [ "color", "tunnel", "smoothing", "benchmark", "image", "effect", "create-effect", "delete-effect", "serverinfo", "clear", "clearall", "adjustment", "sourceselect", "config", "componentstate", "ledcolors", "load-db", "save-db", "logging", "performance-counters", "lut-calibration", "signal-calibration", "processing", "sysinfo", "videomodehdr", "video-crop", "videomode", "authorize", "instance", "leddevice", "transform", "correction", "temperature", "help", "video-controls" ] } } } diff --git a/sources/api/JSONRPC_schemas.qrc b/sources/api/JSONRPC_schemas.qrc index af997203a..fb133cd70 100644 --- a/sources/api/JSONRPC_schemas.qrc +++ b/sources/api/JSONRPC_schemas.qrc @@ -30,9 +30,10 @@ JSONRPC_schema/schema-instance.json JSONRPC_schema/schema-leddevice.json JSONRPC_schema/schema-benchmark.json - JSONRPC_schema/schema-tunnel.json - JSONRPC_schema/schema-performance-counters.json - + JSONRPC_schema/schema-tunnel.json + JSONRPC_schema/schema-performance-counters.json + JSONRPC_schema/schema-smoothing.json + JSONRPC_schema/schema-classic.json JSONRPC_schema/schema-classic.json JSONRPC_schema/schema-classic.json diff --git a/sources/api/JsonAPI.cpp b/sources/api/JsonAPI.cpp index 6f452e528..7188f769f 100644 --- a/sources/api/JsonAPI.cpp +++ b/sources/api/JsonAPI.cpp @@ -220,6 +220,8 @@ void JsonAPI::handleMessage(const QString& messageString, const QString& httpAut handleVideoControlsCommand(message, command, tan); else if (command == "benchmark") handleBenchmarkCommand(message, command, tan); + else if (command == "smoothing") + handleSmoothingCommand(message, command, tan); else if (command == "transform" || command == "correction" || command == "temperature") sendErrorReply("The command " + command + "is deprecated, please use the HyperHDR Web Interface to configure", command, tan); // END @@ -825,6 +827,19 @@ void JsonAPI::handleBenchmarkCommand(const QJsonObject& message, const QString& sendSuccessReply(command, tan); } +void JsonAPI::handleSmoothingCommand(const QJsonObject& message, const QString& command, int tan) +{ + const QString& subc = message["subcommand"].toString().trimmed().toLower(); + int time = message["time"].toInt(); + + if (subc=="all") + QTimer::singleShot(0, _instanceManager, [=]() { _instanceManager->setSmoothing(time); }); + else + QTimer::singleShot(0, _hyperhdr, [=]() { _hyperhdr->setSmoothing(time); }); + + sendSuccessReply(command, tan); +} + void JsonAPI::handleVideoControlsCommand(const QJsonObject& message, const QString& command, int tan) { diff --git a/sources/base/HyperHdrIManager.cpp b/sources/base/HyperHdrIManager.cpp index 73fedcd66..160b24308 100644 --- a/sources/base/HyperHdrIManager.cpp +++ b/sources/base/HyperHdrIManager.cpp @@ -93,6 +93,14 @@ void HyperHdrIManager::stopAll() } } +void HyperHdrIManager::setSmoothing(int time) +{ + QMap instCopy = _runningInstances; + + for (const auto instance : instCopy) + QTimer::singleShot(0, instance, [=]() { instance->setSmoothing(time); }); +} + bool HyperHdrIManager::isCEC() { QMap instCopy = _runningInstances; diff --git a/sources/base/HyperHdrInstance.cpp b/sources/base/HyperHdrInstance.cpp index 00c8188a3..66e650b69 100644 --- a/sources/base/HyperHdrInstance.cpp +++ b/sources/base/HyperHdrInstance.cpp @@ -310,6 +310,11 @@ void HyperHdrInstance::saveCalibration(QString saveData) _settingsManager->saveSetting(settings::type::VIDEODETECTION, saveData); } +void HyperHdrInstance::setSmoothing(int time) +{ + _smoothing->updateCurrentConfig(time); +} + unsigned HyperHdrInstance::updateSmoothingConfig(unsigned id, int settlingTime_ms, double ledUpdateFrequency_hz, bool directMode) { unsigned retVal = id; diff --git a/sources/base/LinearSmoothing.cpp b/sources/base/LinearSmoothing.cpp index 48110e86a..b614af835 100644 --- a/sources/base/LinearSmoothing.cpp +++ b/sources/base/LinearSmoothing.cpp @@ -369,6 +369,15 @@ unsigned LinearSmoothing::updateConfig(unsigned cfgID, int settlingTime_ms, doub return updatedCfgID; } +void LinearSmoothing::updateCurrentConfig(int settlingTime_ms) +{ + _settlingTime = settlingTime_ms; + + Info(_log, "Updating current config (%d) => type: %s, dirMode: %s, pause: %s, settlingTime: %ims, interval: %ims (%iHz), antiFlickTres: %i, antiFlickStep: %i, antiFlickTime: %i", + _currentConfigId, QSTRING_CSTR(SmoothingCfg::EnumToString(_smoothingType)), (_directMode) ? "true" : "false", (_pause) ? "true" : "false", int(_settlingTime), + int(_updateInterval), int(1000.0 / _updateInterval), _antiFlickeringTreshold, _antiFlickeringStep, int(_antiFlickeringTimeout)); +} + bool LinearSmoothing::selectConfig(unsigned cfg, bool force) { //WATCH