Store name in LinuxLEDController to avoid setting it in detector

This commit is contained in:
Adam Honse 2025-08-12 18:44:35 -05:00
parent 2967ccb1cb
commit b136e7739a
4 changed files with 24 additions and 16 deletions

View file

@ -63,13 +63,12 @@ void DetectLinuxLEDControllers()
blue_path = linux_led_settings["devices"][device_idx]["blue_path"];
}
LinuxLEDController* controller = new LinuxLEDController();
LinuxLEDController* controller = new LinuxLEDController(name);
controller->OpenRedPath(red_path);
controller->OpenGreenPath(green_path);
controller->OpenBluePath(blue_path);
RGBController_LinuxLED* rgb_controller = new RGBController_LinuxLED(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller);
}

View file

@ -11,9 +11,9 @@
#include "LinuxLEDController_Linux.h"
LinuxLEDController::LinuxLEDController()
LinuxLEDController::LinuxLEDController(std::string dev_name)
{
name = dev_name;
}
LinuxLEDController::~LinuxLEDController()
@ -21,6 +21,11 @@ LinuxLEDController::~LinuxLEDController()
}
std::string LinuxLEDController::GetName()
{
return(name);
}
std::string LinuxLEDController::GetRedPath()
{
return(led_r_path);

View file

@ -16,9 +16,11 @@
class LinuxLEDController
{
public:
LinuxLEDController();
LinuxLEDController(std::string dev_name);
~LinuxLEDController();
std::string GetName();
std::string GetRedPath();
std::string GetBluePath();
std::string GetGreenPath();
@ -28,6 +30,7 @@ public:
void OpenBluePath(std::string blue_path);
void SetRGB(unsigned char red, unsigned char grn, unsigned char blu);
private:
std::string led_r_path;
std::string led_g_path;
@ -35,4 +38,5 @@ private:
std::ofstream led_r_brightness;
std::ofstream led_g_brightness;
std::ofstream led_b_brightness;
std::string name;
};

View file

@ -26,7 +26,7 @@ RGBController_LinuxLED::RGBController_LinuxLED(LinuxLEDController* controller_pt
{
controller = controller_ptr;
name = "Linux LED";
name = controller->GetName();
type = DEVICE_TYPE_LEDSTRIP;
description = "Linux Sysfs LED Device";