Store name in NollieController to avoid setting it in detector

This commit is contained in:
Adam Honse 2025-08-14 11:31:42 -05:00
parent 85af2e1ed7
commit 520b83a226
4 changed files with 30 additions and 19 deletions

View file

@ -15,11 +15,12 @@
using namespace std::chrono_literals;
NollieController::NollieController(hid_device* dev_handle, const char* path, unsigned short pid)
NollieController::NollieController(hid_device* dev_handle, const char* path, unsigned short pid, std::string dev_name)
{
dev = dev_handle;
location = path;
usb_pid = pid;
dev = dev_handle;
location = path;
name = dev_name;
usb_pid = pid;
}
std::string NollieController::GetLocationString()
@ -27,6 +28,11 @@ std::string NollieController::GetLocationString()
return("HID: " + location);
}
std::string NollieController::GetNameString()
{
return(name);
}
std::string NollieController::GetSerialString()
{
wchar_t serial_string[128];

View file

@ -52,18 +52,24 @@
class NollieController
{
public:
NollieController(hid_device* dev_handle, const char* path, unsigned short pid);
NollieController(hid_device* dev_handle, const char* path, unsigned short pid, std::string dev_name);
std::string GetLocationString();
std::string GetNameString();
std::string GetSerialString();
unsigned short GetUSBPID();
void SetMos(bool mos);
void InitChLEDs(int *led_num_list,int ch_num);
void SendUpdate();
void SetChannelLEDs(unsigned char channel, RGBColor * colors, unsigned int num_colors);
private:
hid_device* dev;
std::string location;
std::string name;
unsigned short usb_pid;
void SendPacket(unsigned char channel,RGBColor * colors,unsigned int num_colors);
void SendPacketFS(unsigned char channel,unsigned char packet_id,RGBColor * colors,unsigned int num_colors);
};

View file

@ -25,9 +25,8 @@ void DetectNollieControllers(hid_device_info* info, const std::string& name)
std::wstring product_str(product);
NollieController* controller = new NollieController(dev, info->path,info->product_id);
NollieController* controller = new NollieController(dev, info->path,info->product_id, name);
RGBController_Nollie* rgb_controller = new RGBController_Nollie(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);

View file

@ -26,20 +26,20 @@
RGBController_Nollie::RGBController_Nollie(NollieController* controller_ptr)
{
controller = controller_ptr;
controller = controller_ptr;
name = "Nollie Device";
vendor = "Nollie";
description = "Nollie Controller Device";
type = DEVICE_TYPE_LEDSTRIP;
location = controller->GetLocationString();
serial = controller->GetSerialString();
name = controller->GetNameString();
vendor = "Nollie";
description = "Nollie Controller Device";
type = DEVICE_TYPE_LEDSTRIP;
location = controller->GetLocationString();
serial = controller->GetSerialString();
mode Direct;
Direct.name = "Direct";
Direct.value = 0xFFFF;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
Direct.name = "Direct";
Direct.value = 0xFFFF;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
SetupZones();
@ -170,7 +170,7 @@ void RGBController_Nollie::ResizeZone(int zone, int new_size)
{
controller->InitChLEDs(&new_size,NOLLIE1_CHANNELS_NUM);
}
if((size_t) zone >= zones.size())
{
return;