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

@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
- Support for ftdi chip based LED-devices with ws2812, sk6812 apa102 LED types (Many thanks to @nurikk) (#1746) - 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) - 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. - 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_expl": "Service Port [1-65535]",
"edt_dev_spec_port_title": "Port", "edt_dev_spec_port_title": "Port",
"edt_dev_spec_printTimeStamp_title": "Add timestamp", "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_stream_protocol_title": "Streaming protocol",
"edt_dev_spec_pwmChannel_title": "PWM channel", "edt_dev_spec_pwmChannel_title": "PWM channel",
"edt_dev_spec_razer_device_title": "Razer Chroma Device", "edt_dev_spec_razer_device_title": "Razer Chroma Device",

View File

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

View File

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

View File

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