Skydimo LedDevice support (#1765)

* Support Skydimo devices

* Temporarily downgrade CMake to 3.28.3 (CodeQL)
This commit is contained in:
LordGrey 2024-07-16 19:46:43 +02:00 committed by GitHub
parent 5d1d84ee9b
commit 6c3fc8521a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 41 additions and 30 deletions

View File

@ -41,7 +41,7 @@ jobs:
- name: Temporarily downgrade CMake to 3.28.3 # Please remove if GitHub has updated Cmake (greater than 3.30.0)
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.28.3'
cmake-version: '3.28.3'
- name: 🔁 Initialize CodeQL
uses: github/codeql-action/init@v3
@ -49,7 +49,7 @@ jobs:
languages: ${{ matrix.language }}
queries: +security-and-quality
config-file: ./.github/config/codeql.yml
- name: 👷 Autobuild
uses: github/codeql-action/autobuild@v3

View File

@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Support for ftdi chip based LED-devices with ws2812, sk6812 apa102 LED types (Many thanks to @nurikk) (#1746)
- Support for Skydimo devices (being an Adalight variant)
- Support gaps on Matrix Layout (#1696)
- 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.

View File

@ -706,6 +706,7 @@
"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",

View File

@ -58,6 +58,11 @@ bool LedDeviceAdalight::init(const QJsonObject &deviceConfig)
case Adalight::ADA:
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;
@ -71,10 +76,6 @@ bool LedDeviceAdalight::init(const QJsonObject &deviceConfig)
void LedDeviceAdalight::prepareHeader()
{
// create ledBuffer
uint totalLedCount = _ledCount;
_bufferLength = static_cast<qint64>(HEADER_SIZE + _ledRGBCount);
switch (_streamProtocol) {
case Adalight::LBAPA:
{
@ -82,7 +83,6 @@ void LedDeviceAdalight::prepareHeader()
const unsigned int bytesPerRGBLed = 4;
const unsigned int endFrameSize = qMax<unsigned int>(((_ledCount + 15) / 16), bytesPerRGBLed);
_bufferLength = HEADER_SIZE + (_ledCount * bytesPerRGBLed) + startFrameSize + endFrameSize;
_ledBuffer.resize(static_cast<size_t>(_bufferLength), 0x00);
// init constant data values
@ -91,39 +91,47 @@ void LedDeviceAdalight::prepareHeader()
_ledBuffer[iLed*4+HEADER_SIZE] = 0xFF;
}
}
break;
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 += 8;
[[fallthrough]];
{
_bufferLength = static_cast<qint64>(HEADER_SIZE + _ledRGBCount + 8);
_ledBuffer.resize(static_cast<size_t>(_bufferLength), 0x00);
_ledBuffer[0] = 'A';
_ledBuffer[1] = 'w';
_ledBuffer[2] = _white_channel_calibration ? 'A' : 'a';
qToBigEndian<quint16>(static_cast<quint16>(_ledCount-1), &_ledBuffer[3]);
_ledBuffer[5] = _ledBuffer[3] ^ _ledBuffer[4] ^ 0x55; // Checksum
}
break;
case Adalight::ADA:
[[fallthrough]];
default:
totalLedCount -= 1;
_bufferLength = static_cast<qint64>(HEADER_SIZE + _ledRGBCount);
_ledBuffer.resize(static_cast<size_t>(_bufferLength), 0x00);
break;
}
_ledBuffer[0] = 'A';
if (_streamProtocol == Adalight::AWA )
{
_ledBuffer[1] = 'w';
_ledBuffer[2] = _white_channel_calibration ? 'A' : 'a';
}
else
{
_ledBuffer[0] = 'A';
_ledBuffer[1] = 'd';
_ledBuffer[2] = 'a';
qToBigEndian<quint16>(static_cast<quint16>(_ledCount-1), &_ledBuffer[3]);
_ledBuffer[5] = _ledBuffer[3] ^ _ledBuffer[4] ^ 0x55; // Checksum
break;
}
qToBigEndian<quint16>(static_cast<quint16>(totalLedCount), &_ledBuffer[3]);
_ledBuffer[5] = _ledBuffer[3] ^ _ledBuffer[4] ^ 0x55; // Checksum
Debug( _log, "Adalight 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 LedDeviceAdalight::write(const std::vector<ColorRgb> & ledValues)
{
if (_ledCount != ledValues.size())

View File

@ -10,7 +10,8 @@ typedef enum ProtocolType
{
ADA = 0,
LBAPA,
AWA
AWA,
SKYDIMO
} PROTOCOLTYPE;
}

View File

@ -11,10 +11,10 @@
"streamProtocol": {
"type": "string",
"title": "edt_dev_spec_stream_protocol_title",
"enum": [ "0", "1", "2" ],
"enum": [ "0", "1", "2", "3" ],
"default": "0",
"options": {
"enum_titles": [ "edt_dev_spec_ada_mode_title", "edt_dev_spec_LBap102Mode_title","edt_dev_spec_awa_mode_title" ]
"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" ]
},
"propertyOrder": 2
},