Skip to content

Commit 6c3fc85

Browse files
authored
Skydimo LedDevice support (#1765)
* Support Skydimo devices * Temporarily downgrade CMake to 3.28.3 (CodeQL)
1 parent 5d1d84e commit 6c3fc85

File tree

6 files changed

+40
-29
lines changed

6 files changed

+40
-29
lines changed

.github/workflows/codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ jobs:
4141
- name: Temporarily downgrade CMake to 3.28.3 # Please remove if GitHub has updated Cmake (greater than 3.30.0)
4242
uses: jwlawson/actions-setup-cmake@v2
4343
with:
44-
cmake-version: '3.28.3'
44+
cmake-version: '3.28.3'
4545

4646
- name: 🔁 Initialize CodeQL
4747
uses: github/codeql-action/init@v3
4848
with:
4949
languages: ${{ matrix.language }}
5050
queries: +security-and-quality
5151
config-file: ./.github/config/codeql.yml
52-
52+
5353
- name: 👷 Autobuild
5454
uses: github/codeql-action/autobuild@v3
5555

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
### Added
1515

1616
- Support for ftdi chip based LED-devices with ws2812, sk6812 apa102 LED types (Many thanks to @nurikk) (#1746)
17+
- Support for Skydimo devices (being an Adalight variant)
1718
- Support gaps on Matrix Layout (#1696)
1819
- Windows: Added a new grabber that uses the DXGI DDA (Desktop Duplication API). This has much better performance than the DX grabber as it does more of its work on the GPU.
1920

assets/webconfig/i18n/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,7 @@
706706
"edt_dev_spec_port_expl": "Service Port [1-65535]",
707707
"edt_dev_spec_port_title": "Port",
708708
"edt_dev_spec_printTimeStamp_title": "Add timestamp",
709+
"edt_dev_spec_skydimo_mode_title": "Skydimo Mode",
709710
"edt_dev_spec_stream_protocol_title": "Streaming protocol",
710711
"edt_dev_spec_pwmChannel_title": "PWM channel",
711712
"edt_dev_spec_razer_device_title": "Razer Chroma Device",

libsrc/leddevice/dev_serial/LedDeviceAdalight.cpp

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ bool LedDeviceAdalight::init(const QJsonObject &deviceConfig)
5858
case Adalight::ADA:
5959
Debug( _log, "Adalight driver uses standard Adalight protocol");
6060
break;
61+
62+
case Adalight::SKYDIMO:
63+
Debug( _log, "Adalight driver uses Skydimo protocol");
64+
break;
65+
6166
default:
6267
Error( _log, "Adalight driver - unsupported protocol");
6368
return false;
@@ -71,18 +76,13 @@ bool LedDeviceAdalight::init(const QJsonObject &deviceConfig)
7176

7277
void LedDeviceAdalight::prepareHeader()
7378
{
74-
// create ledBuffer
75-
uint totalLedCount = _ledCount;
76-
_bufferLength = static_cast<qint64>(HEADER_SIZE + _ledRGBCount);
77-
7879
switch (_streamProtocol) {
7980
case Adalight::LBAPA:
8081
{
8182
const unsigned int startFrameSize = 4;
8283
const unsigned int bytesPerRGBLed = 4;
8384
const unsigned int endFrameSize = qMax<unsigned int>(((_ledCount + 15) / 16), bytesPerRGBLed);
8485
_bufferLength = HEADER_SIZE + (_ledCount * bytesPerRGBLed) + startFrameSize + endFrameSize;
85-
8686
_ledBuffer.resize(static_cast<size_t>(_bufferLength), 0x00);
8787

8888
// init constant data values
@@ -91,39 +91,47 @@ void LedDeviceAdalight::prepareHeader()
9191
_ledBuffer[iLed*4+HEADER_SIZE] = 0xFF;
9292
}
9393
}
94-
break;
95-
96-
case Adalight::AWA:
97-
_bufferLength += 8;
98-
[[fallthrough]];
99-
case Adalight::ADA:
100-
[[fallthrough]];
101-
default:
102-
totalLedCount -= 1;
94+
break;
95+
case Adalight::SKYDIMO:
96+
{
97+
_bufferLength = static_cast<qint64>(HEADER_SIZE + _ledRGBCount);
10398
_ledBuffer.resize(static_cast<size_t>(_bufferLength), 0x00);
104-
break;
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);
105105
}
106-
107-
_ledBuffer[0] = 'A';
108-
if (_streamProtocol == Adalight::AWA )
106+
break;
107+
case Adalight::AWA:
109108
{
109+
_bufferLength = static_cast<qint64>(HEADER_SIZE + _ledRGBCount + 8);
110+
_ledBuffer.resize(static_cast<size_t>(_bufferLength), 0x00);
111+
_ledBuffer[0] = 'A';
110112
_ledBuffer[1] = 'w';
111113
_ledBuffer[2] = _white_channel_calibration ? 'A' : 'a';
114+
qToBigEndian<quint16>(static_cast<quint16>(_ledCount-1), &_ledBuffer[3]);
115+
_ledBuffer[5] = _ledBuffer[3] ^ _ledBuffer[4] ^ 0x55; // Checksum
112116
}
113-
else
114-
{
117+
break;
118+
case Adalight::ADA:
119+
[[fallthrough]];
120+
default:
121+
_bufferLength = static_cast<qint64>(HEADER_SIZE + _ledRGBCount);
122+
_ledBuffer.resize(static_cast<size_t>(_bufferLength), 0x00);
123+
_ledBuffer[0] = 'A';
115124
_ledBuffer[1] = 'd';
116125
_ledBuffer[2] = 'a';
126+
qToBigEndian<quint16>(static_cast<quint16>(_ledCount-1), &_ledBuffer[3]);
127+
_ledBuffer[5] = _ledBuffer[3] ^ _ledBuffer[4] ^ 0x55; // Checksum
128+
break;
117129
}
118130

119-
qToBigEndian<quint16>(static_cast<quint16>(totalLedCount), &_ledBuffer[3]);
120-
_ledBuffer[5] = _ledBuffer[3] ^ _ledBuffer[4] ^ 0x55; // Checksum
121-
122131
Debug( _log, "Adalight header for %d leds (size: %d): %c%c%c 0x%02x 0x%02x 0x%02x", _ledCount, _ledBuffer.size(),
123132
_ledBuffer[0], _ledBuffer[1], _ledBuffer[2], _ledBuffer[3], _ledBuffer[4], _ledBuffer[5] );
124133
}
125134

126-
127135
int LedDeviceAdalight::write(const std::vector<ColorRgb> & ledValues)
128136
{
129137
if (_ledCount != ledValues.size())

libsrc/leddevice/dev_serial/LedDeviceAdalight.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ typedef enum ProtocolType
1010
{
1111
ADA = 0,
1212
LBAPA,
13-
AWA
13+
AWA,
14+
SKYDIMO
1415
} PROTOCOLTYPE;
1516
}
1617

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" ],
14+
"enum": [ "0", "1", "2", "3" ],
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" ]
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" ]
1818
},
1919
"propertyOrder": 2
2020
},

0 commit comments

Comments
 (0)