Fix multiply defined warning in CM Small ARGB Controller

This commit is contained in:
Adam Honse 2022-09-16 11:24:48 -05:00
parent de1d62cef2
commit c177016801
3 changed files with 13 additions and 11 deletions

View file

@ -12,6 +12,11 @@
#include "CMSmallARGBController.h"
#include <cstring>
cm_small_argb_headers cm_small_argb_header_data[1] =
{
{ "CM Small ARGB", 0x01, true, 12 }
};
CMSmallARGBController::CMSmallARGBController(hid_device* dev_handle, char *_path, unsigned char _zone_idx)
{
const int szTemp = 256;
@ -215,7 +220,7 @@ void CMSmallARGBController::SendUpdate()
buffer[CM_SMALL_ARGB_COMMAND_BYTE] = 0x0b;
buffer[CM_SMALL_ARGB_FUNCTION_BYTE] = (false) ? 0x01 : 0x02; //This controls custom mode TODO
buffer[CM_SMALL_ARGB_ZONE_BYTE] = small_argb_header_data[zone_index].header;
buffer[CM_SMALL_ARGB_ZONE_BYTE] = cm_small_argb_header_data[zone_index].header;
buffer[CM_SMALL_ARGB_MODE_BYTE] = current_mode;
buffer[CM_SMALL_ARGB_SPEED_BYTE] = current_speed;
buffer[CM_SMALL_ARGB_COLOUR_INDEX_BYTE] = (bool_random) ? 0x00 : 0x10; //This looks to still be the colour index and controls random colours

View file

@ -34,7 +34,7 @@ enum
CM_SMALL_ARGB_BLUE_BYTE = 11,
};
struct _argb_headers
struct cm_small_argb_headers
{
const char* name;
unsigned char header;
@ -42,10 +42,7 @@ struct _argb_headers
unsigned int count;
};
static _argb_headers small_argb_header_data[1] =
{
{ "CM Small ARGB", 0x01, true, 12 }
};
extern cm_small_argb_headers cm_small_argb_header_data[1];
enum
{

View file

@ -27,7 +27,7 @@ RGBController_CMSmallARGBController::RGBController_CMSmallARGBController(CMSmall
controller = controller_ptr;
unsigned char speed = controller->GetLedSpeed();
name = small_argb_header_data[controller->GetZoneIndex()].name;
name = cm_small_argb_header_data[controller->GetZoneIndex()].name;
vendor = "Cooler Master";
type = DEVICE_TYPE_LEDSTRIP;
description = controller->GetDeviceName();
@ -185,7 +185,7 @@ RGBController_CMSmallARGBController::~RGBController_CMSmallARGBController()
void RGBController_CMSmallARGBController::Init_Controller()
{
int zone_idx = controller->GetZoneIndex();
int zone_led_count = small_argb_header_data[zone_idx].count;
int zone_led_count = cm_small_argb_header_data[zone_idx].count;
bool boolSingleLED = ( zone_led_count == 1 ); //If argb_header_data[zone_idx].count == 1 then the zone is ZONE_TYPE_SINGLE
zone ARGB_zone;
@ -215,7 +215,7 @@ void RGBController_CMSmallARGBController::SetupZones()
if (!boolSingleLED)
{
controller->SetLedCount(small_argb_header_data[zone_idx].header, zones[zone_idx].leds_count);
controller->SetLedCount(cm_small_argb_header_data[zone_idx].header, zones[zone_idx].leds_count);
}
for(unsigned int lp_idx = 0; lp_idx < zones[zone_idx].leds_count; lp_idx++)
@ -226,13 +226,13 @@ void RGBController_CMSmallARGBController::SetupZones()
if(boolSingleLED)
{
new_led.name = i;
new_led.value = small_argb_header_data[i].header;
new_led.value = cm_small_argb_header_data[i].header;
}
else
{
new_led.name = i;
new_led.name.append(" LED " + std::to_string(lp_idx));
new_led.value = small_argb_header_data[i].header;
new_led.value = cm_small_argb_header_data[i].header;
}
leds.push_back(new_led);