From c31fd6eb05ea070ed544e0720c27c54769c97c65 Mon Sep 17 00:00:00 2001 From: LordGrey <48840279+Lord-Grey@users.noreply.github.com> Date: Sat, 13 Jul 2024 20:26:19 +0200 Subject: [PATCH 1/2] Support Skydimo devices --- CHANGELOG.md | 1 + assets/webconfig/i18n/en.json | 1 + .../dev_serial/LedDeviceAdalight.cpp | 56 +++++++++++-------- .../leddevice/dev_serial/LedDeviceAdalight.h | 3 +- libsrc/leddevice/schemas/schema-adalight.json | 4 +- 5 files changed, 38 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bef62d68..c892f259c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/assets/webconfig/i18n/en.json b/assets/webconfig/i18n/en.json index c8e52eeab..186262492 100644 --- a/assets/webconfig/i18n/en.json +++ b/assets/webconfig/i18n/en.json @@ -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", diff --git a/libsrc/leddevice/dev_serial/LedDeviceAdalight.cpp b/libsrc/leddevice/dev_serial/LedDeviceAdalight.cpp index 8c45e2338..f13b86779 100644 --- a/libsrc/leddevice/dev_serial/LedDeviceAdalight.cpp +++ b/libsrc/leddevice/dev_serial/LedDeviceAdalight.cpp @@ -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(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(((_ledCount + 15) / 16), bytesPerRGBLed); _bufferLength = HEADER_SIZE + (_ledCount * bytesPerRGBLed) + startFrameSize + endFrameSize; - _ledBuffer.resize(static_cast(_bufferLength), 0x00); // init constant data values @@ -91,39 +91,47 @@ void LedDeviceAdalight::prepareHeader() _ledBuffer[iLed*4+HEADER_SIZE] = 0xFF; } } - break; - - case Adalight::AWA: - _bufferLength += 8; - [[fallthrough]]; - case Adalight::ADA: - [[fallthrough]]; - default: - totalLedCount -= 1; + break; + case Adalight::SKYDIMO: + { + _bufferLength = static_cast(HEADER_SIZE + _ledRGBCount); _ledBuffer.resize(static_cast(_bufferLength), 0x00); - break; + _ledBuffer[0] = 'A'; + _ledBuffer[1] = 'd'; + _ledBuffer[2] = 'a'; + _ledBuffer[3] = 0; + _ledBuffer[4] = 0; + _ledBuffer[5] = static_cast(_ledCount); } - - _ledBuffer[0] = 'A'; - if (_streamProtocol == Adalight::AWA ) + break; + case Adalight::AWA: { + _bufferLength = static_cast(HEADER_SIZE + _ledRGBCount + 8); + _ledBuffer.resize(static_cast(_bufferLength), 0x00); + _ledBuffer[0] = 'A'; _ledBuffer[1] = 'w'; _ledBuffer[2] = _white_channel_calibration ? 'A' : 'a'; + qToBigEndian(static_cast(_ledCount-1), &_ledBuffer[3]); + _ledBuffer[5] = _ledBuffer[3] ^ _ledBuffer[4] ^ 0x55; // Checksum } - else - { + break; + case Adalight::ADA: + [[fallthrough]]; + default: + _bufferLength = static_cast(HEADER_SIZE + _ledRGBCount); + _ledBuffer.resize(static_cast(_bufferLength), 0x00); + _ledBuffer[0] = 'A'; _ledBuffer[1] = 'd'; _ledBuffer[2] = 'a'; + qToBigEndian(static_cast(_ledCount-1), &_ledBuffer[3]); + _ledBuffer[5] = _ledBuffer[3] ^ _ledBuffer[4] ^ 0x55; // Checksum + break; } - qToBigEndian(static_cast(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 & ledValues) { if (_ledCount != ledValues.size()) diff --git a/libsrc/leddevice/dev_serial/LedDeviceAdalight.h b/libsrc/leddevice/dev_serial/LedDeviceAdalight.h index 560651278..d0752dffc 100644 --- a/libsrc/leddevice/dev_serial/LedDeviceAdalight.h +++ b/libsrc/leddevice/dev_serial/LedDeviceAdalight.h @@ -10,7 +10,8 @@ typedef enum ProtocolType { ADA = 0, LBAPA, - AWA + AWA, + SKYDIMO } PROTOCOLTYPE; } diff --git a/libsrc/leddevice/schemas/schema-adalight.json b/libsrc/leddevice/schemas/schema-adalight.json index ac9575d40..699852a37 100644 --- a/libsrc/leddevice/schemas/schema-adalight.json +++ b/libsrc/leddevice/schemas/schema-adalight.json @@ -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 }, From b4de42a7e1771a9c554548cce0f9cc878895649a Mon Sep 17 00:00:00 2001 From: LordGrey <48840279+Lord-Grey@users.noreply.github.com> Date: Sat, 13 Jul 2024 20:33:45 +0200 Subject: [PATCH 2/2] Temporarily downgrade CMake to 3.28.3 (CodeQL) --- .github/workflows/codeql.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 73c530b62..e31f065ea 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -36,7 +36,12 @@ jobs: if: ${{ matrix.language == 'cpp' }} run: | sudo apt-get update - sudo apt-get install --yes git cmake build-essential qtbase5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5x11extras5-dev libusb-1.0-0-dev python3-dev libcec-dev libxcb-image0-dev libxcb-util0-dev libxcb-shm0-dev libxcb-render0-dev libxcb-randr0-dev libxrandr-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev libasound2-dev libturbojpeg0-dev libjpeg-dev libssl-dev libftdi1-dev + sudo apt-get install --yes git build-essential qtbase5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5x11extras5-dev libusb-1.0-0-dev python3-dev libcec-dev libxcb-image0-dev libxcb-util0-dev libxcb-shm0-dev libxcb-render0-dev libxcb-randr0-dev libxrandr-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev libasound2-dev libturbojpeg0-dev libjpeg-dev libssl-dev libftdi1-dev + + - 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' - name: 🔁 Initialize CodeQL uses: github/codeql-action/init@v3 @@ -44,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