mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Allow to disable switching LEDs on during startup (#1443)
This commit is contained in:
parent
c75c98e252
commit
62829d9bf8
@ -504,6 +504,8 @@
|
|||||||
"edt_dev_enum_sub_min_warm_adjust": "Subtract warm white",
|
"edt_dev_enum_sub_min_warm_adjust": "Subtract warm white",
|
||||||
"edt_dev_enum_subtract_minimum": "Subtract minimum",
|
"edt_dev_enum_subtract_minimum": "Subtract minimum",
|
||||||
"edt_dev_enum_white_off": "White off",
|
"edt_dev_enum_white_off": "White off",
|
||||||
|
"edt_dev_general_autostart_title": "Autostart",
|
||||||
|
"edt_dev_general_autostart_title_info": "The LED device is switched-on during startup or not",
|
||||||
"edt_dev_general_colorOrder_title": "RGB byte order",
|
"edt_dev_general_colorOrder_title": "RGB byte order",
|
||||||
"edt_dev_general_colorOrder_title_info": "The device's color order",
|
"edt_dev_general_colorOrder_title_info": "The device's color order",
|
||||||
"edt_dev_general_hardwareLedCount_title": "Hardware LED count",
|
"edt_dev_general_hardwareLedCount_title": "Hardware LED count",
|
||||||
|
@ -820,7 +820,7 @@ $(document).ready(function () {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "philipshue":
|
case "philipshue":
|
||||||
conf_editor.getEditor("root.generalOptions").disable();
|
disableAutoResolvedGeneralOptions();
|
||||||
|
|
||||||
var lights = conf_editor.getEditor("root.specificOptions.lightIds").getValue();
|
var lights = conf_editor.getEditor("root.specificOptions.lightIds").getValue();
|
||||||
hwLedCountDefault = lights.length;
|
hwLedCountDefault = lights.length;
|
||||||
@ -828,7 +828,7 @@ $(document).ready(function () {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "yeelight":
|
case "yeelight":
|
||||||
conf_editor.getEditor("root.generalOptions").disable();
|
disableAutoResolvedGeneralOptions();
|
||||||
|
|
||||||
var lights = conf_editor.getEditor("root.specificOptions.lights").getValue();
|
var lights = conf_editor.getEditor("root.specificOptions.lights").getValue();
|
||||||
hwLedCountDefault = lights.length;
|
hwLedCountDefault = lights.length;
|
||||||
@ -836,7 +836,7 @@ $(document).ready(function () {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "atmoorb":
|
case "atmoorb":
|
||||||
conf_editor.getEditor("root.generalOptions").disable();
|
disableAutoResolvedGeneralOptions();
|
||||||
|
|
||||||
var configruedOrbIds = conf_editor.getEditor("root.specificOptions.orbIds").getValue().trim();
|
var configruedOrbIds = conf_editor.getEditor("root.specificOptions.orbIds").getValue().trim();
|
||||||
if (configruedOrbIds.length !== 0) {
|
if (configruedOrbIds.length !== 0) {
|
||||||
@ -848,7 +848,7 @@ $(document).ready(function () {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "razer":
|
case "razer":
|
||||||
conf_editor.getEditor("root.generalOptions").disable();
|
disableAutoResolvedGeneralOptions();
|
||||||
hwLedCountDefault = 1;
|
hwLedCountDefault = 1;
|
||||||
colorOrderDefault = "bgr";
|
colorOrderDefault = "bgr";
|
||||||
|
|
||||||
@ -963,7 +963,7 @@ $(document).ready(function () {
|
|||||||
var specOptPath = 'root.specificOptions.';
|
var specOptPath = 'root.specificOptions.';
|
||||||
|
|
||||||
//Disable General Options, as LED count will be resolved from device itself
|
//Disable General Options, as LED count will be resolved from device itself
|
||||||
conf_editor.getEditor("root.generalOptions").disable();
|
disableAutoResolvedGeneralOptions();
|
||||||
|
|
||||||
var hostList = conf_editor.getEditor("root.specificOptions.hostList");
|
var hostList = conf_editor.getEditor("root.specificOptions.hostList");
|
||||||
if (hostList) {
|
if (hostList) {
|
||||||
@ -1130,7 +1130,7 @@ $(document).ready(function () {
|
|||||||
//Yeelight
|
//Yeelight
|
||||||
conf_editor.watch('root.specificOptions.lights', () => {
|
conf_editor.watch('root.specificOptions.lights', () => {
|
||||||
//Disable General Options, as LED count will be resolved from number of lights configured
|
//Disable General Options, as LED count will be resolved from number of lights configured
|
||||||
conf_editor.getEditor("root.generalOptions").disable();
|
disableAutoResolvedGeneralOptions();
|
||||||
|
|
||||||
var hwLedCount = conf_editor.getEditor("root.generalOptions.hardwareLedCount")
|
var hwLedCount = conf_editor.getEditor("root.generalOptions.hardwareLedCount")
|
||||||
if (hwLedCount) {
|
if (hwLedCount) {
|
||||||
@ -1142,7 +1142,7 @@ $(document).ready(function () {
|
|||||||
//Philips Hue
|
//Philips Hue
|
||||||
conf_editor.watch('root.specificOptions.lightIds', () => {
|
conf_editor.watch('root.specificOptions.lightIds', () => {
|
||||||
//Disable General Options, as LED count will be resolved from number of lights configured
|
//Disable General Options, as LED count will be resolved from number of lights configured
|
||||||
conf_editor.getEditor("root.generalOptions").disable();
|
disableAutoResolvedGeneralOptions();
|
||||||
|
|
||||||
var hwLedCount = conf_editor.getEditor("root.generalOptions.hardwareLedCount")
|
var hwLedCount = conf_editor.getEditor("root.generalOptions.hardwareLedCount")
|
||||||
if (hwLedCount) {
|
if (hwLedCount) {
|
||||||
@ -1154,7 +1154,7 @@ $(document).ready(function () {
|
|||||||
//Atmo Orb
|
//Atmo Orb
|
||||||
conf_editor.watch('root.specificOptions.orbIds', () => {
|
conf_editor.watch('root.specificOptions.orbIds', () => {
|
||||||
//Disable General Options, as LED count will be resolved from number of lights configured
|
//Disable General Options, as LED count will be resolved from number of lights configured
|
||||||
conf_editor.getEditor("root.generalOptions").disable();
|
disableAutoResolvedGeneralOptions();
|
||||||
|
|
||||||
var hwLedCount = conf_editor.getEditor("root.generalOptions.hardwareLedCount")
|
var hwLedCount = conf_editor.getEditor("root.generalOptions.hardwareLedCount")
|
||||||
if (hwLedCount) {
|
if (hwLedCount) {
|
||||||
@ -1780,3 +1780,7 @@ function showAllDeviceInputOptions(showForKey, state) {
|
|||||||
showInputOptionsForKey(conf_editor, "specificOptions", showForKey, state);
|
showInputOptionsForKey(conf_editor, "specificOptions", showForKey, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function disableAutoResolvedGeneralOptions() {
|
||||||
|
conf_editor.getEditor("root.generalOptions.hardwareLedCount").disable();
|
||||||
|
conf_editor.getEditor("root.generalOptions.colorOrder").disable();
|
||||||
|
}
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
{
|
{
|
||||||
"type" : "file",
|
"type" : "file",
|
||||||
"hardwareLedCount" : 1,
|
"hardwareLedCount" : 1,
|
||||||
|
"autoStart" : true,
|
||||||
"output" : "/dev/null",
|
"output" : "/dev/null",
|
||||||
"colorOrder" : "rgb",
|
"colorOrder" : "rgb",
|
||||||
"latchTime" : 0,
|
"latchTime" : 0,
|
||||||
|
@ -460,7 +460,10 @@ private:
|
|||||||
void stopRefreshTimer();
|
void stopRefreshTimer();
|
||||||
|
|
||||||
/// Is last write refreshing enabled?
|
/// Is last write refreshing enabled?
|
||||||
bool _isRefreshEnabled;
|
bool _isRefreshEnabled;
|
||||||
|
|
||||||
|
/// Is device to be enabled during start
|
||||||
|
bool _isAutoStart;
|
||||||
|
|
||||||
/// Order of Colors supported by the device
|
/// Order of Colors supported by the device
|
||||||
/// "RGB", "BGR", "RBG", "BRG", "GBR", "GRB"
|
/// "RGB", "BGR", "RBG", "BRG", "GBR", "GRB"
|
||||||
|
@ -29,6 +29,18 @@
|
|||||||
},
|
},
|
||||||
"access": "expert",
|
"access": "expert",
|
||||||
"propertyOrder": 3
|
"propertyOrder": 3
|
||||||
|
},
|
||||||
|
"autoStart": {
|
||||||
|
"type": "boolean",
|
||||||
|
"format": "checkbox",
|
||||||
|
"title": "edt_dev_general_autostart_title",
|
||||||
|
"default": true,
|
||||||
|
"required": true,
|
||||||
|
"options": {
|
||||||
|
"infoText": "edt_dev_general_autostart_title_info"
|
||||||
|
},
|
||||||
|
"access": "advanced",
|
||||||
|
"propertyOrder": 4
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -16,6 +16,22 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
|
||||||
|
// Constants
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
// Configuration settings
|
||||||
|
const char CONFIG_CURRENT_LED_COUNT[] = "currentLedCount";
|
||||||
|
const char CONFIG_COLOR_ORDER[] = "colorOrder";
|
||||||
|
const char CONFIG_AUTOSTART[] = "autoStart";
|
||||||
|
const char CONFIG_LATCH_TIME[] = "latchTime";
|
||||||
|
const char CONFIG_REWRITE_TIME[] = "rewriteTime";
|
||||||
|
|
||||||
|
int DEFAULT_LED_COUNT = 1;
|
||||||
|
const char DEFAULT_COLOR_ORDER[] = "RGB";
|
||||||
|
const bool DEFAULT_IS_AUTOSTART = true;
|
||||||
|
|
||||||
|
} //End of constants
|
||||||
|
|
||||||
LedDevice::LedDevice(const QJsonObject& deviceConfig, QObject* parent)
|
LedDevice::LedDevice(const QJsonObject& deviceConfig, QObject* parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, _devConfig(deviceConfig)
|
, _devConfig(deviceConfig)
|
||||||
@ -34,6 +50,7 @@ LedDevice::LedDevice(const QJsonObject& deviceConfig, QObject* parent)
|
|||||||
, _isInSwitchOff (false)
|
, _isInSwitchOff (false)
|
||||||
, _lastWriteTime(QDateTime::currentDateTime())
|
, _lastWriteTime(QDateTime::currentDateTime())
|
||||||
, _isRefreshEnabled (false)
|
, _isRefreshEnabled (false)
|
||||||
|
, _isAutoStart(true)
|
||||||
{
|
{
|
||||||
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
_activeDeviceType = deviceConfig["type"].toString("UNSPECIFIED").toLower();
|
||||||
}
|
}
|
||||||
@ -64,7 +81,10 @@ void LedDevice::start()
|
|||||||
{
|
{
|
||||||
// Everything is OK -> enable device
|
// Everything is OK -> enable device
|
||||||
_isDeviceInitialised = true;
|
_isDeviceInitialised = true;
|
||||||
this->enable();
|
if (_isAutoStart)
|
||||||
|
{
|
||||||
|
this->enable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,11 +167,12 @@ bool LedDevice::init(const QJsonObject &deviceConfig)
|
|||||||
{
|
{
|
||||||
Debug(_log, "deviceConfig: [%s]", QString(QJsonDocument(_devConfig).toJson(QJsonDocument::Compact)).toUtf8().constData() );
|
Debug(_log, "deviceConfig: [%s]", QString(QJsonDocument(_devConfig).toJson(QJsonDocument::Compact)).toUtf8().constData() );
|
||||||
|
|
||||||
_colorOrder = deviceConfig["colorOrder"].toString("RGB");
|
_colorOrder = deviceConfig[CONFIG_COLOR_ORDER].toString(DEFAULT_COLOR_ORDER);
|
||||||
|
_isAutoStart = deviceConfig[CONFIG_AUTOSTART].toBool(DEFAULT_IS_AUTOSTART);
|
||||||
|
|
||||||
setLedCount( deviceConfig["currentLedCount"].toInt(1) ); // property injected to reflect real led count
|
setLedCount( deviceConfig[CONFIG_CURRENT_LED_COUNT].toInt(DEFAULT_LED_COUNT) ); // property injected to reflect real led count
|
||||||
setLatchTime( deviceConfig["latchTime"].toInt( _latchTime_ms ) );
|
setLatchTime( deviceConfig[CONFIG_LATCH_TIME].toInt( _latchTime_ms ) );
|
||||||
setRewriteTime ( deviceConfig["rewriteTime"].toInt( _refreshTimerInterval_ms) );
|
setRewriteTime ( deviceConfig[CONFIG_REWRITE_TIME].toInt( _refreshTimerInterval_ms) );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user