From 476bf8b5af6e909c31b505270fdfc1bb2deba8ce Mon Sep 17 00:00:00 2001 From: MatMoul Date: Tue, 1 Aug 2017 22:51:20 +0200 Subject: [PATCH] Add G413 support --- src/classes/Keyboard.cpp | 5 +++++ src/classes/Keyboard.h | 2 ++ src/helpers/help.cpp | 1 + src/helpers/help.h | 1 + 4 files changed, 9 insertions(+) diff --git a/src/classes/Keyboard.cpp b/src/classes/Keyboard.cpp index 0a20607..3e3bc1f 100644 --- a/src/classes/Keyboard.cpp +++ b/src/classes/Keyboard.cpp @@ -564,6 +564,9 @@ bool LedKeyboard::setAllKeys(LedKeyboard::Color color) { case KeyboardModel::g213: for (uint8_t rIndex=0x01; rIndex <= 0x05; rIndex++) if (! setRegion(rIndex, color)) return false; return true; + case KeyboardModel::g413: + setNativeEffect(NativeEffect::color, NativeEffectPart::keys, 0, color); + return true; case KeyboardModel::g410: case KeyboardModel::g610: case KeyboardModel::g810: @@ -722,6 +725,7 @@ bool LedKeyboard::setNativeEffect(NativeEffect effect, NativeEffectPart part, ui switch (currentDevice.model) { case KeyboardModel::g213: + case KeyboardModel::g413: protocolByte = 0x0c; if (part == NativeEffectPart::logo) return false; //Does not have logo component break; @@ -848,6 +852,7 @@ bool LedKeyboard::sendDataInternal(byte_buffer_t &data) { LedKeyboard::byte_buffer_t LedKeyboard::getKeyGroupAddress(LedKeyboard::KeyAddressGroup keyAddressGroup) { switch (currentDevice.model) { case KeyboardModel::g213: + case KeyboardModel::g413: return {}; // Device doesn't support per-key setting case KeyboardModel::g410: case KeyboardModel::g610: diff --git a/src/classes/Keyboard.h b/src/classes/Keyboard.h index 9fd7bd3..5e6dca8 100644 --- a/src/classes/Keyboard.h +++ b/src/classes/Keyboard.h @@ -30,6 +30,7 @@ class LedKeyboard { std::vector> SupportedKeyboards = { { 0x46d, 0xc336, (u_int16_t)KeyboardModel::g213 }, { 0x46d, 0xc330, (u_int16_t)KeyboardModel::g410 }, + { 0x46d, 0xc33a, (u_int16_t)KeyboardModel::g413 }, { 0x46d, 0xc333, (u_int16_t)KeyboardModel::g610 }, { 0x46d, 0xc338, (u_int16_t)KeyboardModel::g610 }, { 0x46d, 0xc331, (u_int16_t)KeyboardModel::g810 }, @@ -43,6 +44,7 @@ class LedKeyboard { unknown = 0x00, g213, g410, + g413, g610, g810, g910, diff --git a/src/helpers/help.cpp b/src/helpers/help.cpp index b7987af..eb95f87 100644 --- a/src/helpers/help.cpp +++ b/src/helpers/help.cpp @@ -15,6 +15,7 @@ namespace help { KeyboardFeatures getKeyboardFeatures(string cmdName) { if(cmdName == "g213-led") return KeyboardFeatures::g213; else if(cmdName == "g410-led") return KeyboardFeatures::g410; + else if(cmdName == "g413-led") return KeyboardFeatures::g413; else if(cmdName == "g610-led") return KeyboardFeatures::g610; else if(cmdName == "g810-led") return KeyboardFeatures::g810; else if(cmdName == "g910-led") return KeyboardFeatures::g910; diff --git a/src/helpers/help.h b/src/helpers/help.h index b07dc9f..f014638 100644 --- a/src/helpers/help.h +++ b/src/helpers/help.h @@ -28,6 +28,7 @@ namespace help { g213 = rgb | logo1 | numpad | multimedia | setall | setregion | setindicators | poweronfx, g410 = rgb | commit | setall | setgroup | setkey | poweronfx, + g413 = intensity | setall, g610 = intensity | commit | logo1 | numpad | multimedia | setall | setgroup | setkey | setindicators | poweronfx, g810 = rgb | commit | logo1 | numpad | multimedia | setall | setgroup | setkey | setindicators | poweronfx, g910 = rgb | commit | logo1 | logo2 | numpad | multimedia | gkeys | setall | setgroup | setkey | setindicators | poweronfx,