Remove SetCustomMode from all controllers beginning with the letter P

This commit is contained in:
Adam Honse 2022-08-21 16:24:44 -05:00
parent bc1ba87e13
commit 215183f9c5
12 changed files with 45 additions and 86 deletions

View file

@ -20,16 +20,16 @@
@comment
\*-------------------------------------------------------------------*/
RGBController_PNYGPU::RGBController_PNYGPU(PNYGPUController* pny_ptr)
RGBController_PNYGPU::RGBController_PNYGPU(PNYGPUController* controller_ptr)
{
pny = pny_ptr;
controller = controller_ptr;
name = "PNY/Palit GPU";
vendor = "PNY/Palit";
description = "PNY/Palit RGB GPU Device";
location = pny->GetDeviceLocation();
location = controller->GetDeviceLocation();
type = DEVICE_TYPE_GPU;
type = DEVICE_TYPE_GPU;
mode Off;
Off.name = "Off";
@ -126,11 +126,6 @@ void RGBController_PNYGPU::UpdateSingleLED(int /*led*/)
DeviceUpdateLEDs();
}
void RGBController_PNYGPU::SetCustomMode()
{
active_mode = 1;
}
void RGBController_PNYGPU::DeviceUpdateMode()
{
RGBColor color = colors[0];
@ -141,23 +136,23 @@ void RGBController_PNYGPU::DeviceUpdateMode()
switch(modes[active_mode].value)
{
case PNY_GPU_MODE_OFF:
pny->SetOff();
controller->SetOff();
break;
case PNY_GPU_MODE_DIRECT:
brightness = modes[active_mode].brightness;
pny->SetDirect(r, g, b, brightness);
controller->SetDirect(r, g, b, brightness);
break;
case PNY_GPU_MODE_CYCLE:
speed = modes[active_mode].speed;
pny->SetCycle(speed);
controller->SetCycle(speed);
break;
case PNY_GPU_MODE_STROBE:
speed = modes[active_mode].speed;
brightness = modes[active_mode].brightness;
pny->SetStrobe(r, g, b, speed, brightness);
controller->SetStrobe(r, g, b, speed, brightness);
break;
default:
break;

View file

@ -15,19 +15,17 @@
class RGBController_PNYGPU : public RGBController
{
public:
RGBController_PNYGPU(PNYGPUController* pny_ptr);
RGBController_PNYGPU(PNYGPUController* controller_ptr);
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
PNYGPUController* pny;
PNYGPUController* controller;
};

View file

@ -212,11 +212,6 @@ void RGBController_PatriotViper::UpdateSingleLED(int led)
}
}
void RGBController_PatriotViper::SetCustomMode()
{
active_mode = 0;
}
void RGBController_PatriotViper::DeviceUpdateMode()
{
if(modes[active_mode].value == 0xFFFF)

View file

@ -19,14 +19,12 @@ public:
~RGBController_PatriotViper();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:

View file

@ -110,10 +110,6 @@ void RGBController_PatriotViperSteel::UpdateSingleLED(int led)
controller->SetLEDColor(led, red, grn, blu);
}
void RGBController_PatriotViperSteel::SetCustomMode()
{
}
void RGBController_PatriotViperSteel::DeviceUpdateMode()
{
}

View file

@ -17,14 +17,12 @@ public:
~RGBController_PatriotViperSteel();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:

View file

@ -19,16 +19,16 @@
@comment
\*-------------------------------------------------------------------*/
RGBController_PhilipsHue::RGBController_PhilipsHue(PhilipsHueController* light_ptr)
RGBController_PhilipsHue::RGBController_PhilipsHue(PhilipsHueController* controller_ptr)
{
light = light_ptr;
controller = controller_ptr;
name = light->GetManufacturer() + " " + light->GetName();
name = controller->GetManufacturer() + " " + controller->GetName();
type = DEVICE_TYPE_LIGHT;
version = light->GetVersion();
version = controller->GetVersion();
description = "Philips Hue Device";
serial = light->GetUniqueID();
location = light->GetLocation();
serial = controller->GetUniqueID();
location = controller->GetLocation();
mode Direct;
Direct.name = "Direct";
@ -72,7 +72,7 @@ void RGBController_PhilipsHue::DeviceUpdateLEDs()
unsigned char grn = RGBGetGValue(colors[0]);
unsigned char blu = RGBGetBValue(colors[0]);
light->SetColor(red, grn, blu);
controller->SetColor(red, grn, blu);
}
void RGBController_PhilipsHue::UpdateZoneLEDs(int /*zone*/)
@ -85,11 +85,6 @@ void RGBController_PhilipsHue::UpdateSingleLED(int /*led*/)
DeviceUpdateLEDs();
}
void RGBController_PhilipsHue::SetCustomMode()
{
}
void RGBController_PhilipsHue::DeviceUpdateMode()
{

View file

@ -13,19 +13,17 @@
class RGBController_PhilipsHue : public RGBController
{
public:
RGBController_PhilipsHue(PhilipsHueController* light_ptr);
RGBController_PhilipsHue(PhilipsHueController* controller_ptr);
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
PhilipsHueController* light;
PhilipsHueController* controller;
};

View file

@ -23,16 +23,16 @@ using namespace std::chrono_literals;
@comment
\*-------------------------------------------------------------------*/
RGBController_PhilipsHueEntertainment::RGBController_PhilipsHueEntertainment(PhilipsHueEntertainmentController* light_ptr)
RGBController_PhilipsHueEntertainment::RGBController_PhilipsHueEntertainment(PhilipsHueEntertainmentController* controller_ptr)
{
light = light_ptr;
controller = controller_ptr;
name = light->GetManufacturer() + " " + light->GetName();
name = controller->GetManufacturer() + " " + controller->GetName();
type = DEVICE_TYPE_LIGHT;
version = light->GetVersion();
version = controller->GetVersion();
description = "Philips Hue Entertainment Mode Device";
serial = light->GetUniqueID();
location = light->GetLocation();
serial = controller->GetUniqueID();
location = controller->GetLocation();
mode Direct;
Direct.name = "Direct";
@ -72,13 +72,13 @@ void RGBController_PhilipsHueEntertainment::SetupZones()
zone led_zone;
led_zone.name = "RGB Light";
led_zone.type = ZONE_TYPE_SINGLE;
led_zone.leds_min = light->GetNumLEDs();
led_zone.leds_max = light->GetNumLEDs();
led_zone.leds_count = light->GetNumLEDs();
led_zone.leds_min = controller->GetNumLEDs();
led_zone.leds_max = controller->GetNumLEDs();
led_zone.leds_count = controller->GetNumLEDs();
led_zone.matrix_map = NULL;
zones.push_back(led_zone);
for(unsigned int led_idx = 0; led_idx < light->GetNumLEDs(); led_idx++)
for(unsigned int led_idx = 0; led_idx < controller->GetNumLEDs(); led_idx++)
{
led new_led;
new_led.name = "RGB Light";
@ -102,7 +102,7 @@ void RGBController_PhilipsHueEntertainment::DeviceUpdateLEDs()
if(active_mode == 0)
{
light->SetColor(&colors[0]);
controller->SetColor(&colors[0]);
}
}
@ -116,11 +116,6 @@ void RGBController_PhilipsHueEntertainment::UpdateSingleLED(int /*led*/)
DeviceUpdateLEDs();
}
void RGBController_PhilipsHueEntertainment::SetCustomMode()
{
active_mode = 0;
}
void RGBController_PhilipsHueEntertainment::DeviceUpdateMode()
{
if(active_mode == 0)
@ -135,11 +130,11 @@ void RGBController_PhilipsHueEntertainment::DeviceUpdateMode()
}
}
light->Connect();
controller->Connect();
}
else
{
light->Disconnect();
controller->Disconnect();
}
}

View file

@ -17,23 +17,21 @@
class RGBController_PhilipsHueEntertainment : public RGBController
{
public:
RGBController_PhilipsHueEntertainment(PhilipsHueEntertainmentController* light_ptr);
RGBController_PhilipsHueEntertainment(PhilipsHueEntertainmentController* controller_ptr);
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
void KeepaliveThreadFunction();
private:
PhilipsHueEntertainmentController* light;
PhilipsHueEntertainmentController* controller;
std::atomic<bool> KeepaliveThreadRunning;
std::thread* KeepaliveThread;

View file

@ -19,17 +19,17 @@
@comment
\*-------------------------------------------------------------------*/
RGBController_PhilipsWiz::RGBController_PhilipsWiz(PhilipsWizController* light_ptr)
RGBController_PhilipsWiz::RGBController_PhilipsWiz(PhilipsWizController* controller_ptr)
{
light = light_ptr;
controller = controller_ptr;
name = light->GetManufacturer() + " " + light->GetName();
vendor = light->GetManufacturer();
name = controller->GetManufacturer() + " " + controller->GetName();
vendor = controller->GetManufacturer();
type = DEVICE_TYPE_LIGHT;
version = light->GetVersion();
version = controller->GetVersion();
description = "Philips Wiz Device";
serial = light->GetUniqueID();
location = light->GetLocation();
serial = controller->GetUniqueID();
location = controller->GetLocation();
mode Direct;
Direct.name = "Direct";
@ -43,7 +43,7 @@ RGBController_PhilipsWiz::RGBController_PhilipsWiz(PhilipsWizController* light_p
RGBController_PhilipsWiz::~RGBController_PhilipsWiz()
{
delete light;
delete controller;
}
void RGBController_PhilipsWiz::SetupZones()
@ -78,7 +78,7 @@ void RGBController_PhilipsWiz::DeviceUpdateLEDs()
unsigned char grn = RGBGetGValue(colors[0]);
unsigned char blu = RGBGetBValue(colors[0]);
light->SetColor(red, grn, blu);
controller->SetColor(red, grn, blu);
}
void RGBController_PhilipsWiz::UpdateZoneLEDs(int /*zone*/)
@ -91,11 +91,6 @@ void RGBController_PhilipsWiz::UpdateSingleLED(int /*led*/)
DeviceUpdateLEDs();
}
void RGBController_PhilipsWiz::SetCustomMode()
{
}
void RGBController_PhilipsWiz::DeviceUpdateMode()
{

View file

@ -13,20 +13,18 @@
class RGBController_PhilipsWiz : public RGBController
{
public:
RGBController_PhilipsWiz(PhilipsWizController* light_ptr);
RGBController_PhilipsWiz(PhilipsWizController* controller_ptr);
~RGBController_PhilipsWiz();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void DeviceUpdateMode();
private:
PhilipsWizController* light;
PhilipsWizController* controller;
};