Store name in LinuxLEDController to avoid setting it in detector
This commit is contained in:
parent
2967ccb1cb
commit
b136e7739a
4 changed files with 24 additions and 16 deletions
|
|
@ -63,13 +63,12 @@ void DetectLinuxLEDControllers()
|
||||||
blue_path = linux_led_settings["devices"][device_idx]["blue_path"];
|
blue_path = linux_led_settings["devices"][device_idx]["blue_path"];
|
||||||
}
|
}
|
||||||
|
|
||||||
LinuxLEDController* controller = new LinuxLEDController();
|
LinuxLEDController* controller = new LinuxLEDController(name);
|
||||||
controller->OpenRedPath(red_path);
|
controller->OpenRedPath(red_path);
|
||||||
controller->OpenGreenPath(green_path);
|
controller->OpenGreenPath(green_path);
|
||||||
controller->OpenBluePath(blue_path);
|
controller->OpenBluePath(blue_path);
|
||||||
|
|
||||||
RGBController_LinuxLED* rgb_controller = new RGBController_LinuxLED(controller);
|
RGBController_LinuxLED* rgb_controller = new RGBController_LinuxLED(controller);
|
||||||
rgb_controller->name = name;
|
|
||||||
|
|
||||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,9 @@
|
||||||
|
|
||||||
#include "LinuxLEDController_Linux.h"
|
#include "LinuxLEDController_Linux.h"
|
||||||
|
|
||||||
LinuxLEDController::LinuxLEDController()
|
LinuxLEDController::LinuxLEDController(std::string dev_name)
|
||||||
{
|
{
|
||||||
|
name = dev_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
LinuxLEDController::~LinuxLEDController()
|
LinuxLEDController::~LinuxLEDController()
|
||||||
|
|
@ -21,6 +21,11 @@ LinuxLEDController::~LinuxLEDController()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string LinuxLEDController::GetName()
|
||||||
|
{
|
||||||
|
return(name);
|
||||||
|
}
|
||||||
|
|
||||||
std::string LinuxLEDController::GetRedPath()
|
std::string LinuxLEDController::GetRedPath()
|
||||||
{
|
{
|
||||||
return(led_r_path);
|
return(led_r_path);
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,11 @@
|
||||||
class LinuxLEDController
|
class LinuxLEDController
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LinuxLEDController();
|
LinuxLEDController(std::string dev_name);
|
||||||
~LinuxLEDController();
|
~LinuxLEDController();
|
||||||
|
|
||||||
|
std::string GetName();
|
||||||
|
|
||||||
std::string GetRedPath();
|
std::string GetRedPath();
|
||||||
std::string GetBluePath();
|
std::string GetBluePath();
|
||||||
std::string GetGreenPath();
|
std::string GetGreenPath();
|
||||||
|
|
@ -28,6 +30,7 @@ public:
|
||||||
void OpenBluePath(std::string blue_path);
|
void OpenBluePath(std::string blue_path);
|
||||||
|
|
||||||
void SetRGB(unsigned char red, unsigned char grn, unsigned char blu);
|
void SetRGB(unsigned char red, unsigned char grn, unsigned char blu);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string led_r_path;
|
std::string led_r_path;
|
||||||
std::string led_g_path;
|
std::string led_g_path;
|
||||||
|
|
@ -35,4 +38,5 @@ private:
|
||||||
std::ofstream led_r_brightness;
|
std::ofstream led_r_brightness;
|
||||||
std::ofstream led_g_brightness;
|
std::ofstream led_g_brightness;
|
||||||
std::ofstream led_b_brightness;
|
std::ofstream led_b_brightness;
|
||||||
|
std::string name;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -24,21 +24,21 @@
|
||||||
|
|
||||||
RGBController_LinuxLED::RGBController_LinuxLED(LinuxLEDController* controller_ptr)
|
RGBController_LinuxLED::RGBController_LinuxLED(LinuxLEDController* controller_ptr)
|
||||||
{
|
{
|
||||||
controller = controller_ptr;
|
controller = controller_ptr;
|
||||||
|
|
||||||
name = "Linux LED";
|
name = controller->GetName();
|
||||||
type = DEVICE_TYPE_LEDSTRIP;
|
type = DEVICE_TYPE_LEDSTRIP;
|
||||||
description = "Linux Sysfs LED Device";
|
description = "Linux Sysfs LED Device";
|
||||||
|
|
||||||
location = "R: " + controller->GetRedPath() + "\r\n" +
|
location = "R: " + controller->GetRedPath() + "\r\n" +
|
||||||
"G: " + controller->GetGreenPath() + "\r\n" +
|
"G: " + controller->GetGreenPath() + "\r\n" +
|
||||||
"B: " + controller->GetBluePath();
|
"B: " + controller->GetBluePath();
|
||||||
|
|
||||||
mode Direct;
|
mode Direct;
|
||||||
Direct.name = "Direct";
|
Direct.name = "Direct";
|
||||||
Direct.value = 0;
|
Direct.value = 0;
|
||||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||||
modes.push_back(Direct);
|
modes.push_back(Direct);
|
||||||
|
|
||||||
SetupZones();
|
SetupZones();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue