Clean up Linux LED controller

master
Adam Honse 7 months ago
parent c1781bc4cb
commit d4e802f3b3

@ -75,10 +75,12 @@ void LinuxLEDController::SetRGB(unsigned char red, unsigned char grn, unsigned c
{
std::string brightness_str;
if (led_rgb_path.empty()) {
/*-------------------------------------------------------------*\
| My phone LED that I tested this on shuts down if you set zero |
\*-------------------------------------------------------------*/
if(led_rgb_path.empty())
{
/*-------------------------------------------------*\
| My phone LED that I tested this on shuts down if |
| you set zero |
\*-------------------------------------------------*/
if(red == 0) red = 1;
if(grn == 0) grn = 1;
if(blu == 0) blu = 1;
@ -98,19 +100,19 @@ void LinuxLEDController::SetRGB(unsigned char red, unsigned char grn, unsigned c
led_b_brightness.write(brightness_str.c_str(), brightness_str.length());
led_b_brightness.flush();
}
else {
/*
* For the led_classdev_mc brightness just aplies a coefficient to the
* multi_intensity. Set brightness to maximum and use the RGB values
* directly instead.
*/
else
{
/*-------------------------------------------------*\
| For the led_classdev_mc brightness just applies a |
| coefficient to the multi_intensity. Set brightness|
| to maximum and use the RGB values directly |
| instead. |
\*-------------------------------------------------*/
brightness_str = std::to_string((unsigned int)255);
led_rgb_brightness.write(brightness_str.c_str(), brightness_str.length());
led_rgb_brightness.flush();
brightness_str = std::to_string((unsigned int)red) + " " \
+ std::to_string((unsigned int)grn) + " " \
+ std::to_string((unsigned int)blu);
brightness_str = std::to_string((unsigned int)red) + " " + std::to_string((unsigned int)grn) + " " + std::to_string((unsigned int)blu);
led_rgb_color.write(brightness_str.c_str(), brightness_str.length());
led_rgb_color.flush();
}

@ -30,10 +30,17 @@ RGBController_LinuxLED::RGBController_LinuxLED(LinuxLEDController* controller_pt
type = DEVICE_TYPE_LEDSTRIP;
description = "Linux Sysfs LED Device";
if(controller->GetRgbPath().empty())
{
location = "R: " + controller->GetRedPath() + "\r\n" +
"G: " + controller->GetGreenPath() + "\r\n" +
"B: " + controller->GetBluePath() + "\r\n" +
"M: " + controller->GetRgbPath();
"B: " + controller->GetBluePath();
}
else
{
location = controller->GetRgbPath();
}
mode Direct;
Direct.name = "Direct";
Direct.value = 0;

Loading…
Cancel
Save