|
| 1 | +/*-----------------------------------------*\ |
| 2 | +| RGBController_SteelSeriesApexTZone.cpp | |
| 3 | +| | |
| 4 | +| Edbgon 06.10.21 | |
| 5 | +\*-----------------------------------------*/ |
| 6 | + |
| 7 | +#include "RGBController_SteelSeriesApex3.h" |
| 8 | + |
| 9 | +/**------------------------------------------------------------------*\ |
| 10 | + @name Steel Series Apex Tri Zone Keyboards |
| 11 | + @category Keyboard |
| 12 | + @type USB |
| 13 | + @save :x: |
| 14 | + @direct :white_check_mark: |
| 15 | + @effects :white_check_mark: |
| 16 | + @detectors DetectSteelSeriesApexTZone |
| 17 | + @comment |
| 18 | +\*-------------------------------------------------------------------*/ |
| 19 | + |
| 20 | +RGBController_SteelSeriesApex3::RGBController_SteelSeriesApex3(SteelSeriesApex3Controller* controller_ptr) |
| 21 | +{ |
| 22 | + controller = controller_ptr; |
| 23 | + |
| 24 | + name = "SteelSeries Apex 3 device"; |
| 25 | + vendor = "SteelSeries"; |
| 26 | + type = DEVICE_TYPE_KEYBOARD; |
| 27 | + description = name; |
| 28 | + location = controller->GetDeviceLocation(); |
| 29 | + serial = controller->GetSerialString(); |
| 30 | + |
| 31 | + mode direct; |
| 32 | + direct.name = "Direct"; |
| 33 | + direct.value = static_cast<int>(APEX3_MODES::DIRECT); |
| 34 | + direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS; |
| 35 | + if(controller->SupportsSave()) |
| 36 | + { |
| 37 | + direct.flags |= MODE_FLAG_MANUAL_SAVE; |
| 38 | + } |
| 39 | + direct.color_mode = MODE_COLORS_PER_LED; |
| 40 | + direct.brightness_min = STEELSERIES_APEX3_BRIGHTNESS_MIN; |
| 41 | + direct.brightness_max = controller->GetMaxBrightness(); |
| 42 | + direct.brightness = direct.brightness_max; |
| 43 | + modes.push_back(direct); |
| 44 | + |
| 45 | + if(controller->SupportsRainbowWave()) |
| 46 | + { |
| 47 | + mode rainbow; |
| 48 | + rainbow.name = "Rainbow Wave"; |
| 49 | + rainbow.value = static_cast<int>(APEX3_MODES::RAINBOW_WAVE); |
| 50 | + rainbow.flags = MODE_FLAG_HAS_BRIGHTNESS; |
| 51 | + rainbow.color_mode = MODE_COLORS_NONE; |
| 52 | + rainbow.brightness_min = STEELSERIES_APEX3_BRIGHTNESS_MIN; |
| 53 | + rainbow.brightness_max = controller->GetMaxBrightness(); |
| 54 | + rainbow.brightness = rainbow.brightness_max; |
| 55 | + modes.push_back(rainbow); |
| 56 | + } |
| 57 | + |
| 58 | + SetupZones(); |
| 59 | +} |
| 60 | + |
| 61 | +RGBController_SteelSeriesApex3::~RGBController_SteelSeriesApex3() |
| 62 | +{ |
| 63 | + delete controller; |
| 64 | +} |
| 65 | + |
| 66 | +void RGBController_SteelSeriesApex3::DeviceSaveMode() |
| 67 | +{ |
| 68 | + controller->Save(); |
| 69 | +} |
| 70 | + |
| 71 | +void RGBController_SteelSeriesApex3::SetupZones() |
| 72 | +{ |
| 73 | + uint8_t led_count = controller->GetLedCount(); |
| 74 | + |
| 75 | + zone curr_zone; |
| 76 | + curr_zone.name = "Keyboard"; |
| 77 | + curr_zone.type = ZONE_TYPE_LINEAR; |
| 78 | + curr_zone.leds_min = led_count; |
| 79 | + curr_zone.leds_max = led_count; |
| 80 | + curr_zone.leds_count = led_count; |
| 81 | + curr_zone.matrix_map = NULL; |
| 82 | + zones.push_back(curr_zone); |
| 83 | + |
| 84 | + for(size_t i = 0; i < curr_zone.leds_count; i++) |
| 85 | + { |
| 86 | + led zone_led; |
| 87 | + zone_led.name = "LED " + std::to_string(i); |
| 88 | + leds.push_back(zone_led); |
| 89 | + } |
| 90 | + |
| 91 | + SetupColors(); |
| 92 | +} |
| 93 | + |
| 94 | +void RGBController_SteelSeriesApex3::ResizeZone(int /*zone*/, int /*new_size*/) |
| 95 | +{ |
| 96 | + /*---------------------------------------------------------*\ |
| 97 | + | This device does not support resizing zones | |
| 98 | + \*---------------------------------------------------------*/ |
| 99 | +} |
| 100 | + |
| 101 | +void RGBController_SteelSeriesApex3::DeviceUpdateLEDs() |
| 102 | +{ |
| 103 | + controller->SetColor(colors, modes[active_mode].value, modes[active_mode].brightness); |
| 104 | +} |
| 105 | + |
| 106 | +void RGBController_SteelSeriesApex3::UpdateZoneLEDs(int /*zone*/) |
| 107 | +{ |
| 108 | + DeviceUpdateLEDs(); |
| 109 | +} |
| 110 | + |
| 111 | +void RGBController_SteelSeriesApex3::UpdateSingleLED(int /*led*/) |
| 112 | +{ |
| 113 | + DeviceUpdateLEDs(); |
| 114 | +} |
| 115 | + |
| 116 | +void RGBController_SteelSeriesApex3::DeviceUpdateMode() |
| 117 | +{ |
| 118 | + if(modes[active_mode].color_mode == MODE_FLAG_HAS_PER_LED_COLOR) |
| 119 | + { |
| 120 | + DeviceUpdateLEDs(); |
| 121 | + } |
| 122 | + else |
| 123 | + { |
| 124 | + controller->SetColor(modes[active_mode].colors, modes[active_mode].value, modes[active_mode].brightness); |
| 125 | + } |
| 126 | +} |
0 commit comments