Skip to content

Commit 3a5ac53

Browse files
committed
Merge remote-tracking branch 'origin/master' into python
2 parents f808b43 + bc1bfbc commit 3a5ac53

File tree

10 files changed

+202
-24
lines changed

10 files changed

+202
-24
lines changed

assets/webconfig/i18n/en.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,6 @@
710710
"edt_dev_spec_port_expl": "Service Port [1-65535]",
711711
"edt_dev_spec_port_title": "Port",
712712
"edt_dev_spec_printTimeStamp_title": "Add timestamp",
713-
"edt_dev_spec_skydimo_mode_title": "Skydimo Mode",
714713
"edt_dev_spec_stream_protocol_title": "Streaming protocol",
715714
"edt_dev_spec_pwmChannel_title": "PWM channel",
716715
"edt_dev_spec_razer_device_title": "Razer Chroma Device",

assets/webconfig/js/content_leds.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var devFTDI = ['apa102_ftdi', 'sk6812_ftdi', 'ws2812_ftdi'];
2323
var devRPiPWM = ['ws281x'];
2424
var devRPiGPIO = ['piblaster'];
2525
var devNET = ['atmoorb', 'cololight', 'fadecandy', 'homeassistant', 'philipshue', 'nanoleaf', 'razer', 'tinkerforge', 'tpm2net', 'udpe131', 'udpartnet', 'udpddp', 'udph801', 'udpraw', 'wled', 'yeelight'];
26-
var devSerial = ['adalight', 'dmx', 'atmo', 'sedu', 'tpm2', 'karate'];
26+
var devSerial = ['adalight', 'dmx', 'atmo', 'sedu', 'skydimo', 'tpm2', 'karate'];
2727
var devHID = ['hyperionusbasp', 'lightpack', 'paintpack', 'rawhid'];
2828

2929
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 () {
11221122
case "dmx":
11231123
case "karate":
11241124
case "sedu":
1125+
case "skydimo":
11251126
case "tpm2":
11261127

11271128
//FTDI devices
@@ -1231,6 +1232,7 @@ $(document).ready(function () {
12311232
case "karate":
12321233
case "dmx":
12331234
case "sedu":
1235+
case "skydimo":
12341236
case "tpm2": {
12351237
let currentDeviceType = window.serverConfig.device.type;
12361238
if ($.inArray(currentDeviceType, devSerial) === -1) {
@@ -1462,6 +1464,7 @@ $(document).ready(function () {
14621464
case "adalight":
14631465
case "dmx":
14641466
case "sedu":
1467+
case "skydimo":
14651468
case "tpm2":
14661469
case "apa102":
14671470
case "apa104":
@@ -1801,6 +1804,7 @@ $(document).ready(function () {
18011804
break;
18021805

18031806
case "adalight":
1807+
case "skydimo":
18041808
var currentLedCount = conf_editor.getEditor("root.generalOptions.hardwareLedCount").getValue();
18051809
params = Object.assign(conf_editor.getEditor("root.generalOptions").getValue(),
18061810
conf_editor.getEditor("root.specificOptions").getValue(),
@@ -1942,6 +1946,7 @@ function saveLedConfig(genDefLayout = false) {
19421946
case "dmx":
19431947
case "karate":
19441948
case "sedu":
1949+
case "skydimo":
19451950
case "tpm2":
19461951
case "apa102":
19471952
case "apa104":
@@ -1976,7 +1981,7 @@ function saveLedConfig(genDefLayout = false) {
19761981
break;
19771982
}
19781983

1979-
//Rewrite whole LED & Layout configuration, in case changes were done accross tabs and no default layout
1984+
//Rewrite whole LED & Layout configuration, in case changes were done across tabs and no default layout
19801985
if (genDefLayout !== true) {
19811986
result.ledConfig = getLedConfig();
19821987
result.leds = JSON.parse(aceEdt.getText());
@@ -2105,6 +2110,7 @@ var updateOutputSelectList = function (ledType, discoveryInfo) {
21052110
case "dmx":
21062111
case "karate":
21072112
case "sedu":
2113+
case "skydimo":
21082114
case "tpm2":
21092115
for (const device of discoveryInfo.devices) {
21102116
if (device.udev) {

libsrc/hyperion/schema/schema-device.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"rewriteTime": {
7575
"properties": {
7676
"type": {
77-
"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" ]
77+
"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" ]
7878
}
7979
},
8080
"additionalProperties": true

libsrc/leddevice/LedDeviceSchemas.qrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,6 @@
4242
<file alias="schema-ws2812_ftdi">schemas/schema-ws2812_ftdi.json</file>
4343
<file alias="schema-apa102_ftdi">schemas/schema-apa102_ftdi.json</file>
4444
<file alias="schema-sk6812_ftdi">schemas/schema-sk6812_ftdi.json</file>
45+
<file alias="schema-skydimo">schemas/schema-skydimo.json</file>
4546
</qresource>
4647
</RCC>

libsrc/leddevice/dev_serial/LedDeviceAdalight.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ bool LedDeviceAdalight::init(const QJsonObject &deviceConfig)
5959
Debug( _log, "Adalight driver uses standard Adalight protocol");
6060
break;
6161

62-
case Adalight::SKYDIMO:
63-
Debug( _log, "Adalight driver uses Skydimo protocol");
64-
break;
65-
6662
default:
6763
Error( _log, "Adalight driver - unsupported protocol");
6864
return false;
@@ -92,18 +88,6 @@ void LedDeviceAdalight::prepareHeader()
9288
}
9389
}
9490
break;
95-
case Adalight::SKYDIMO:
96-
{
97-
_bufferLength = static_cast<qint64>(HEADER_SIZE + _ledRGBCount);
98-
_ledBuffer.resize(static_cast<size_t>(_bufferLength), 0x00);
99-
_ledBuffer[0] = 'A';
100-
_ledBuffer[1] = 'd';
101-
_ledBuffer[2] = 'a';
102-
_ledBuffer[3] = 0;
103-
_ledBuffer[4] = 0;
104-
_ledBuffer[5] = static_cast<quint8>(_ledCount);
105-
}
106-
break;
10791
case Adalight::AWA:
10892
{
10993
_bufferLength = static_cast<qint64>(HEADER_SIZE + _ledRGBCount + 8);

libsrc/leddevice/dev_serial/LedDeviceAdalight.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ typedef enum ProtocolType
1010
{
1111
ADA = 0,
1212
LBAPA,
13-
AWA,
14-
SKYDIMO
13+
AWA
1514
} PROTOCOLTYPE;
1615
}
1716

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#include "LedDeviceSkydimo.h"
2+
#include "utils/Logger.h"
3+
4+
#include <QtEndian>
5+
6+
// Constants
7+
namespace {
8+
9+
constexpr int HEADER_SIZE {6};
10+
11+
} //End of constants
12+
13+
LedDeviceSkydimo::LedDeviceSkydimo(const QJsonObject &deviceConfig)
14+
: ProviderRs232(deviceConfig)
15+
{
16+
}
17+
18+
LedDevice* LedDeviceSkydimo::construct(const QJsonObject &deviceConfig)
19+
{
20+
return new LedDeviceSkydimo(deviceConfig);
21+
}
22+
23+
bool LedDeviceSkydimo::init(const QJsonObject &deviceConfig)
24+
{
25+
bool isInitOK = false;
26+
27+
// Initialise sub-class
28+
if ( ProviderRs232::init(deviceConfig) )
29+
{
30+
prepareHeader();
31+
isInitOK = true;
32+
}
33+
return isInitOK;
34+
}
35+
36+
void LedDeviceSkydimo::prepareHeader()
37+
{
38+
_bufferLength = static_cast<qint64>(HEADER_SIZE + _ledRGBCount);
39+
_ledBuffer.resize(static_cast<size_t>(_bufferLength), 0x00);
40+
_ledBuffer[0] = 'A';
41+
_ledBuffer[1] = 'd';
42+
_ledBuffer[2] = 'a';
43+
_ledBuffer[3] = 0;
44+
_ledBuffer[4] = 0;
45+
_ledBuffer[5] = static_cast<quint8>(_ledCount);
46+
47+
Debug( _log, "Skydimo header for %d leds (size: %d): %c%c%c 0x%02x 0x%02x 0x%02x", _ledCount, _ledBuffer.size(),
48+
_ledBuffer[0], _ledBuffer[1], _ledBuffer[2], _ledBuffer[3], _ledBuffer[4], _ledBuffer[5] );
49+
}
50+
51+
int LedDeviceSkydimo::write(const std::vector<ColorRgb> & ledValues)
52+
{
53+
if (_ledCount != ledValues.size())
54+
{
55+
Warning(_log, "Skydimo LED count has changed (old: %d, new: %d). Rebuilding header.", _ledCount, ledValues.size());
56+
_ledCount = static_cast<uint>(ledValues.size());
57+
_ledRGBCount = _ledCount * 3;
58+
prepareHeader();
59+
}
60+
61+
if (_bufferLength > static_cast<qint64>(_ledBuffer.size()))
62+
{
63+
Warning(_log, "Skydimo buffer's size has changed. Skipping refresh.");
64+
return 0;
65+
}
66+
67+
assert(HEADER_SIZE + ledValues.size() * sizeof(ColorRgb) <= _ledBuffer.size());
68+
69+
memcpy(HEADER_SIZE + _ledBuffer.data(), ledValues.data(), ledValues.size() * sizeof(ColorRgb));
70+
71+
return writeBytes(_bufferLength, _ledBuffer.data());
72+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#ifndef LEDEVICESKYDIMO_H
2+
#define LEDEVICESKYDIMO_H
3+
4+
// hyperion includes
5+
#include "ProviderRs232.h"
6+
7+
///
8+
/// Implementation of the LedDevice interface for writing to a Skydimo LED-device.
9+
///
10+
class LedDeviceSkydimo : public ProviderRs232
11+
{
12+
Q_OBJECT
13+
14+
public:
15+
16+
///
17+
/// @brief Constructs a Skydimo LED-device
18+
///
19+
/// @param deviceConfig Device's configuration as JSON-Object
20+
///
21+
explicit LedDeviceSkydimo(const QJsonObject &deviceConfig);
22+
23+
///
24+
/// @brief Constructs the LED-device
25+
///
26+
/// @param[in] deviceConfig Device's configuration as JSON-Object
27+
/// @return LedDevice constructed
28+
static LedDevice* construct(const QJsonObject &deviceConfig);
29+
30+
private:
31+
32+
///
33+
/// @brief Initialise the device's configuration
34+
///
35+
/// @param[in] deviceConfig the JSON device configuration
36+
/// @return True, if success
37+
///
38+
bool init(const QJsonObject &deviceConfig) override;
39+
40+
///
41+
/// @brief Prepare the protocol's header
42+
///
43+
void prepareHeader();
44+
45+
///
46+
/// @brief Writes the RGB-Color values to the LEDs.
47+
///
48+
/// @param[in] ledValues The RGB-color per LED
49+
/// @return Zero on success, else negative
50+
///
51+
int write(const std::vector<ColorRgb> & ledValues) override;
52+
53+
qint64 _bufferLength;
54+
};
55+
56+
#endif // LEDEVICESKYDIMO_H

libsrc/leddevice/schemas/schema-adalight.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
"streamProtocol": {
1212
"type": "string",
1313
"title": "edt_dev_spec_stream_protocol_title",
14-
"enum": [ "0", "1", "2", "3" ],
14+
"enum": [ "0", "1", "2" ],
1515
"default": "0",
1616
"options": {
17-
"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" ]
17+
"enum_titles": [ "edt_dev_spec_ada_mode_title", "edt_dev_spec_LBap102Mode_title","edt_dev_spec_awa_mode_title"]
1818
},
1919
"propertyOrder": 2
2020
},
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"type":"object",
3+
"required":true,
4+
"properties":{
5+
"output": {
6+
"type": "string",
7+
"title":"edt_dev_spec_outputPath_title",
8+
"default":"auto",
9+
"propertyOrder" : 1
10+
},
11+
"rateList": {
12+
"type": "string",
13+
"title":"edt_dev_spec_baudrate_title",
14+
"enum": [ "CUSTOM","9600","14400","19200","28800","33600","38400","56000","57600","76800","115200","128000","153600","230400","256000","307200","460800","921600","1000000","1500000","2000000","3000000","4000000" ],
15+
"options": {
16+
"enum_titles": [ "edt_conf_enum_custom" ]
17+
},
18+
"default": "115200",
19+
"access": "advanced",
20+
"propertyOrder" : 3
21+
},
22+
"rate": {
23+
"type": "integer",
24+
"title":"",
25+
"default": 115200,
26+
"access": "advanced",
27+
"propertyOrder" : 4
28+
},
29+
"delayAfterConnect": {
30+
"type": "integer",
31+
"title":"edt_dev_spec_delayAfterConnect_title",
32+
"default": 0,
33+
"append" : "ms",
34+
"access" : "expert",
35+
"propertyOrder" : 5
36+
},
37+
"latchTime": {
38+
"type": "integer",
39+
"title": "edt_dev_spec_latchtime_title",
40+
"default": 30,
41+
"append": "edt_append_ms",
42+
"minimum": 0,
43+
"maximum": 1000,
44+
"access": "expert",
45+
"options": {
46+
"infoText": "edt_dev_spec_latchtime_title_info"
47+
},
48+
"propertyOrder": 6
49+
},
50+
"rewriteTime": {
51+
"type": "integer",
52+
"title":"edt_dev_general_rewriteTime_title",
53+
"default": 1000,
54+
"append" : "edt_append_ms",
55+
"minimum": 0,
56+
"access" : "expert",
57+
"propertyOrder" : 7
58+
}
59+
},
60+
"additionalProperties": true
61+
}

0 commit comments

Comments
 (0)