mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Skydimo as own device (#1800)
* Skydimo as own device type * Skydimo updates
This commit is contained in:
parent
5cb3076698
commit
27f74af4e3
@ -710,7 +710,6 @@
|
||||
"edt_dev_spec_port_expl": "Service Port [1-65535]",
|
||||
"edt_dev_spec_port_title": "Port",
|
||||
"edt_dev_spec_printTimeStamp_title": "Add timestamp",
|
||||
"edt_dev_spec_skydimo_mode_title": "Skydimo Mode",
|
||||
"edt_dev_spec_stream_protocol_title": "Streaming protocol",
|
||||
"edt_dev_spec_pwmChannel_title": "PWM channel",
|
||||
"edt_dev_spec_razer_device_title": "Razer Chroma Device",
|
||||
|
@ -23,7 +23,7 @@ var devFTDI = ['apa102_ftdi', 'sk6812_ftdi', 'ws2812_ftdi'];
|
||||
var devRPiPWM = ['ws281x'];
|
||||
var devRPiGPIO = ['piblaster'];
|
||||
var devNET = ['atmoorb', 'cololight', 'fadecandy', 'homeassistant', 'philipshue', 'nanoleaf', 'razer', 'tinkerforge', 'tpm2net', 'udpe131', 'udpartnet', 'udpddp', 'udph801', 'udpraw', 'wled', 'yeelight'];
|
||||
var devSerial = ['adalight', 'dmx', 'atmo', 'sedu', 'tpm2', 'karate'];
|
||||
var devSerial = ['adalight', 'dmx', 'atmo', 'sedu', 'skydimo', 'tpm2', 'karate'];
|
||||
var devHID = ['hyperionusbasp', 'lightpack', 'paintpack', 'rawhid'];
|
||||
|
||||
var infoTextDefault = '<span>' + $.i18n("conf_leds_device_info_log") + ' </span><a href="" onclick="SwitchToMenuItem(\'MenuItemLogging\')" style="cursor:pointer">' + $.i18n("main_menu_logging_token") + '</a>';
|
||||
@ -1122,6 +1122,7 @@ $(document).ready(function () {
|
||||
case "dmx":
|
||||
case "karate":
|
||||
case "sedu":
|
||||
case "skydimo":
|
||||
case "tpm2":
|
||||
|
||||
//FTDI devices
|
||||
@ -1231,6 +1232,7 @@ $(document).ready(function () {
|
||||
case "karate":
|
||||
case "dmx":
|
||||
case "sedu":
|
||||
case "skydimo":
|
||||
case "tpm2": {
|
||||
let currentDeviceType = window.serverConfig.device.type;
|
||||
if ($.inArray(currentDeviceType, devSerial) === -1) {
|
||||
@ -1462,6 +1464,7 @@ $(document).ready(function () {
|
||||
case "adalight":
|
||||
case "dmx":
|
||||
case "sedu":
|
||||
case "skydimo":
|
||||
case "tpm2":
|
||||
case "apa102":
|
||||
case "apa104":
|
||||
@ -1801,6 +1804,7 @@ $(document).ready(function () {
|
||||
break;
|
||||
|
||||
case "adalight":
|
||||
case "skydimo":
|
||||
var currentLedCount = conf_editor.getEditor("root.generalOptions.hardwareLedCount").getValue();
|
||||
params = Object.assign(conf_editor.getEditor("root.generalOptions").getValue(),
|
||||
conf_editor.getEditor("root.specificOptions").getValue(),
|
||||
@ -1942,6 +1946,7 @@ function saveLedConfig(genDefLayout = false) {
|
||||
case "dmx":
|
||||
case "karate":
|
||||
case "sedu":
|
||||
case "skydimo":
|
||||
case "tpm2":
|
||||
case "apa102":
|
||||
case "apa104":
|
||||
@ -1976,7 +1981,7 @@ function saveLedConfig(genDefLayout = false) {
|
||||
break;
|
||||
}
|
||||
|
||||
//Rewrite whole LED & Layout configuration, in case changes were done accross tabs and no default layout
|
||||
//Rewrite whole LED & Layout configuration, in case changes were done across tabs and no default layout
|
||||
if (genDefLayout !== true) {
|
||||
result.ledConfig = getLedConfig();
|
||||
result.leds = JSON.parse(aceEdt.getText());
|
||||
@ -2105,6 +2110,7 @@ var updateOutputSelectList = function (ledType, discoveryInfo) {
|
||||
case "dmx":
|
||||
case "karate":
|
||||
case "sedu":
|
||||
case "skydimo":
|
||||
case "tpm2":
|
||||
for (const device of discoveryInfo.devices) {
|
||||
if (device.udev) {
|
||||
|
@ -74,7 +74,7 @@
|
||||
"rewriteTime": {
|
||||
"properties": {
|
||||
"type": {
|
||||
"enum": [ "file", "apa102", "apa104", "ws2801", "lpd6803", "lpd8806", "p9813", "sk6812spi", "sk6822spi", "sk9822", "ws2812spi", "ws281x", "piblaster", "adalight", "dmx", "atmo", "hyperionusbasp", "lightpack", "multilightpack", "paintpack", "rawhid", "sedu", "tpm2", "karate" ]
|
||||
"enum": [ "file", "apa102", "apa104", "ws2801", "lpd6803", "lpd8806", "p9813", "sk6812spi", "sk6822spi", "sk9822", "ws2812spi", "ws281x", "piblaster", "adalight", "dmx", "atmo", "hyperionusbasp", "lightpack", "multilightpack", "paintpack", "rawhid", "sedu", "tpm2", "karate", "skydimo" ]
|
||||
}
|
||||
},
|
||||
"additionalProperties": true
|
||||
|
@ -42,5 +42,6 @@
|
||||
<file alias="schema-ws2812_ftdi">schemas/schema-ws2812_ftdi.json</file>
|
||||
<file alias="schema-apa102_ftdi">schemas/schema-apa102_ftdi.json</file>
|
||||
<file alias="schema-sk6812_ftdi">schemas/schema-sk6812_ftdi.json</file>
|
||||
<file alias="schema-skydimo">schemas/schema-skydimo.json</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -59,10 +59,6 @@ bool LedDeviceAdalight::init(const QJsonObject &deviceConfig)
|
||||
Debug( _log, "Adalight driver uses standard Adalight protocol");
|
||||
break;
|
||||
|
||||
case Adalight::SKYDIMO:
|
||||
Debug( _log, "Adalight driver uses Skydimo protocol");
|
||||
break;
|
||||
|
||||
default:
|
||||
Error( _log, "Adalight driver - unsupported protocol");
|
||||
return false;
|
||||
@ -92,18 +88,6 @@ void LedDeviceAdalight::prepareHeader()
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Adalight::SKYDIMO:
|
||||
{
|
||||
_bufferLength = static_cast<qint64>(HEADER_SIZE + _ledRGBCount);
|
||||
_ledBuffer.resize(static_cast<size_t>(_bufferLength), 0x00);
|
||||
_ledBuffer[0] = 'A';
|
||||
_ledBuffer[1] = 'd';
|
||||
_ledBuffer[2] = 'a';
|
||||
_ledBuffer[3] = 0;
|
||||
_ledBuffer[4] = 0;
|
||||
_ledBuffer[5] = static_cast<quint8>(_ledCount);
|
||||
}
|
||||
break;
|
||||
case Adalight::AWA:
|
||||
{
|
||||
_bufferLength = static_cast<qint64>(HEADER_SIZE + _ledRGBCount + 8);
|
||||
|
@ -10,8 +10,7 @@ typedef enum ProtocolType
|
||||
{
|
||||
ADA = 0,
|
||||
LBAPA,
|
||||
AWA,
|
||||
SKYDIMO
|
||||
AWA
|
||||
} PROTOCOLTYPE;
|
||||
}
|
||||
|
||||
|
68
libsrc/leddevice/dev_serial/LedDeviceSkydimo.cpp
Normal file
68
libsrc/leddevice/dev_serial/LedDeviceSkydimo.cpp
Normal file
@ -0,0 +1,68 @@
|
||||
#include "LedDeviceSkydimo.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include <QtEndian>
|
||||
|
||||
// Constants
|
||||
namespace {
|
||||
|
||||
constexpr int HEADER_SIZE {6};
|
||||
|
||||
} //End of constants
|
||||
|
||||
LedDeviceSkydimo::LedDeviceSkydimo(const QJsonObject &deviceConfig)
|
||||
: ProviderRs232(deviceConfig)
|
||||
{
|
||||
}
|
||||
|
||||
LedDevice* LedDeviceSkydimo::construct(const QJsonObject &deviceConfig)
|
||||
{
|
||||
return new LedDeviceSkydimo(deviceConfig);
|
||||
}
|
||||
|
||||
bool LedDeviceSkydimo::init(const QJsonObject &deviceConfig)
|
||||
{
|
||||
bool isInitOK = false;
|
||||
|
||||
// Initialise sub-class
|
||||
if ( ProviderRs232::init(deviceConfig) )
|
||||
{
|
||||
prepareHeader();
|
||||
isInitOK = true;
|
||||
}
|
||||
return isInitOK;
|
||||
}
|
||||
|
||||
void LedDeviceSkydimo::prepareHeader()
|
||||
{
|
||||
_bufferLength = static_cast<qint64>(HEADER_SIZE + _ledRGBCount);
|
||||
_ledBuffer.resize(static_cast<size_t>(_bufferLength), 0x00);
|
||||
_ledBuffer[0] = 'A';
|
||||
_ledBuffer[1] = 'd';
|
||||
_ledBuffer[2] = 'a';
|
||||
_ledBuffer[3] = 0;
|
||||
_ledBuffer[4] = 0;
|
||||
_ledBuffer[5] = static_cast<quint8>(_ledCount);
|
||||
|
||||
Debug( _log, "Skydimo header for %d leds (size: %d): %c%c%c 0x%02x 0x%02x 0x%02x", _ledCount, _ledBuffer.size(),
|
||||
_ledBuffer[0], _ledBuffer[1], _ledBuffer[2], _ledBuffer[3], _ledBuffer[4], _ledBuffer[5] );
|
||||
}
|
||||
|
||||
int LedDeviceSkydimo::write(const std::vector<ColorRgb> & ledValues)
|
||||
{
|
||||
if (_ledCount != ledValues.size())
|
||||
{
|
||||
Warning(_log, "Skydimo LED count has changed (old: %d, new: %d). Rebuilding header.", _ledCount, ledValues.size());
|
||||
_ledCount = static_cast<uint>(ledValues.size());
|
||||
_ledRGBCount = _ledCount * 3;
|
||||
prepareHeader();
|
||||
}
|
||||
|
||||
if (_bufferLength > static_cast<qint64>(_ledBuffer.size()))
|
||||
{
|
||||
Warning(_log, "Skydimo buffer's size has changed. Skipping refresh.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return writeBytes(_bufferLength, _ledBuffer.data());
|
||||
}
|
56
libsrc/leddevice/dev_serial/LedDeviceSkydimo.h
Normal file
56
libsrc/leddevice/dev_serial/LedDeviceSkydimo.h
Normal file
@ -0,0 +1,56 @@
|
||||
#ifndef LEDEVICESKYDIMO_H
|
||||
#define LEDEVICESKYDIMO_H
|
||||
|
||||
// hyperion includes
|
||||
#include "ProviderRs232.h"
|
||||
|
||||
///
|
||||
/// Implementation of the LedDevice interface for writing to a Skydimo LED-device.
|
||||
///
|
||||
class LedDeviceSkydimo : public ProviderRs232
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
///
|
||||
/// @brief Constructs a Skydimo LED-device
|
||||
///
|
||||
/// @param deviceConfig Device's configuration as JSON-Object
|
||||
///
|
||||
explicit LedDeviceSkydimo(const QJsonObject &deviceConfig);
|
||||
|
||||
///
|
||||
/// @brief Constructs the LED-device
|
||||
///
|
||||
/// @param[in] deviceConfig Device's configuration as JSON-Object
|
||||
/// @return LedDevice constructed
|
||||
static LedDevice* construct(const QJsonObject &deviceConfig);
|
||||
|
||||
private:
|
||||
|
||||
///
|
||||
/// @brief Initialise the device's configuration
|
||||
///
|
||||
/// @param[in] deviceConfig the JSON device configuration
|
||||
/// @return True, if success
|
||||
///
|
||||
bool init(const QJsonObject &deviceConfig) override;
|
||||
|
||||
///
|
||||
/// @brief Prepare the protocol's header
|
||||
///
|
||||
void prepareHeader();
|
||||
|
||||
///
|
||||
/// @brief Writes the RGB-Color values to the LEDs.
|
||||
///
|
||||
/// @param[in] ledValues The RGB-color per LED
|
||||
/// @return Zero on success, else negative
|
||||
///
|
||||
int write(const std::vector<ColorRgb> & ledValues) override;
|
||||
|
||||
qint64 _bufferLength;
|
||||
};
|
||||
|
||||
#endif // LEDEVICESKYDIMO_H
|
@ -11,10 +11,10 @@
|
||||
"streamProtocol": {
|
||||
"type": "string",
|
||||
"title": "edt_dev_spec_stream_protocol_title",
|
||||
"enum": [ "0", "1", "2", "3" ],
|
||||
"enum": [ "0", "1", "2" ],
|
||||
"default": "0",
|
||||
"options": {
|
||||
"enum_titles": [ "edt_dev_spec_ada_mode_title", "edt_dev_spec_LBap102Mode_title","edt_dev_spec_awa_mode_title", "edt_dev_spec_skydimo_mode_title" ]
|
||||
"enum_titles": [ "edt_dev_spec_ada_mode_title", "edt_dev_spec_LBap102Mode_title","edt_dev_spec_awa_mode_title"]
|
||||
},
|
||||
"propertyOrder": 2
|
||||
},
|
||||
|
61
libsrc/leddevice/schemas/schema-skydimo.json
Normal file
61
libsrc/leddevice/schemas/schema-skydimo.json
Normal file
@ -0,0 +1,61 @@
|
||||
{
|
||||
"type":"object",
|
||||
"required":true,
|
||||
"properties":{
|
||||
"output": {
|
||||
"type": "string",
|
||||
"title":"edt_dev_spec_outputPath_title",
|
||||
"default":"auto",
|
||||
"propertyOrder" : 1
|
||||
},
|
||||
"rateList": {
|
||||
"type": "string",
|
||||
"title":"edt_dev_spec_baudrate_title",
|
||||
"enum": [ "CUSTOM","9600","14400","19200","28800","33600","38400","56000","57600","76800","115200","128000","153600","230400","256000","307200","460800","921600","1000000","1500000","2000000","3000000","4000000" ],
|
||||
"options": {
|
||||
"enum_titles": [ "edt_conf_enum_custom" ]
|
||||
},
|
||||
"default": "115200",
|
||||
"access": "advanced",
|
||||
"propertyOrder" : 3
|
||||
},
|
||||
"rate": {
|
||||
"type": "integer",
|
||||
"title":"",
|
||||
"default": 115200,
|
||||
"access": "advanced",
|
||||
"propertyOrder" : 4
|
||||
},
|
||||
"delayAfterConnect": {
|
||||
"type": "integer",
|
||||
"title":"edt_dev_spec_delayAfterConnect_title",
|
||||
"default": 0,
|
||||
"append" : "ms",
|
||||
"access" : "expert",
|
||||
"propertyOrder" : 5
|
||||
},
|
||||
"latchTime": {
|
||||
"type": "integer",
|
||||
"title": "edt_dev_spec_latchtime_title",
|
||||
"default": 30,
|
||||
"append": "edt_append_ms",
|
||||
"minimum": 0,
|
||||
"maximum": 1000,
|
||||
"access": "expert",
|
||||
"options": {
|
||||
"infoText": "edt_dev_spec_latchtime_title_info"
|
||||
},
|
||||
"propertyOrder": 6
|
||||
},
|
||||
"rewriteTime": {
|
||||
"type": "integer",
|
||||
"title":"edt_dev_general_rewriteTime_title",
|
||||
"default": 1000,
|
||||
"append" : "edt_append_ms",
|
||||
"minimum": 0,
|
||||
"access" : "expert",
|
||||
"propertyOrder" : 7
|
||||
}
|
||||
},
|
||||
"additionalProperties": true
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user