Skip to content

Commit fbeb2c1

Browse files
Use LED ID and version string to determine if mode 14 is supported
1 parent 0295b90 commit fbeb2c1

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

Controllers/ENESMBusController/ENESMBusController.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ static const char* ene_channels[] = /* ENE channel strings
3131

3232
ENESMBusController::ENESMBusController(ENESMBusInterface* interface, ene_dev_id dev)
3333
{
34-
this->interface = interface;
35-
this->dev = dev;
34+
this->interface = interface;
35+
this->dev = dev;
36+
supports_mode_14 = false;
3637

3738
UpdateDeviceName();
3839

@@ -93,6 +94,17 @@ ENESMBusController::ENESMBusController(ENESMBusInterface* interface, ene_dev_id
9394
direct_reg = ENE_REG_COLORS_DIRECT_V2;
9495
effect_reg = ENE_REG_COLORS_EFFECT_V2;
9596
channel_cfg = ENE_CONFIG_CHANNEL_V1;
97+
98+
// Check for Mode 14 support, only known to exist on modules where the
99+
// DRAM 3 zone ID exists
100+
for(std::size_t cfg_zone_idx = 0; cfg_zone_idx < ENE_NUM_ZONES; cfg_zone_idx++)
101+
{
102+
if(config_table[channel_cfg + cfg_zone_idx] == (unsigned char)ENE_LED_CHANNEL_DRAM_3)
103+
{
104+
supports_mode_14 = true;
105+
break;
106+
}
107+
}
96108
}
97109
// AUMA0-E6K5-0106 - Second generation motherboard controller
98110
else if (strcmp(device_name, "AUMA0-E6K5-0106") == 0)
@@ -371,6 +383,11 @@ void ENESMBusController::SetMode(unsigned char mode, unsigned char speed, unsign
371383
ENERegisterWrite(ENE_REG_APPLY, ENE_APPLY_VAL);
372384
}
373385

386+
bool ENESMBusController::SupportsMode14()
387+
{
388+
return(supports_mode_14);
389+
}
390+
374391
void ENESMBusController::UpdateDeviceName()
375392
{
376393
for (int i = 0; i < 16; i++)

Controllers/ENESMBusController/ENESMBusController.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ class ENESMBusController
120120
void SetLEDColorDirect(unsigned int led, unsigned char red, unsigned char green, unsigned char blue);
121121
void SetLEDColorEffect(unsigned int led, unsigned char red, unsigned char green, unsigned char blue);
122122
void SetMode(unsigned char mode, unsigned char speed, unsigned char direction);
123+
bool SupportsMode14();
123124

124125
void UpdateDeviceName();
125126

@@ -136,4 +137,5 @@ class ENESMBusController
136137
unsigned char channel_cfg;
137138
ENESMBusInterface* interface;
138139
ene_dev_id dev;
140+
bool supports_mode_14;
139141
};

Controllers/ENESMBusController/RGBController_ENESMBus.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ RGBController_ENESMBus::RGBController_ENESMBus(ENESMBusController * controller_p
159159
RandomFlicker.speed = ENE_SPEED_NORMAL;
160160
modes.push_back(RandomFlicker);
161161

162-
if(version == "AUDA0-E6K5-0101")
162+
if(controller->SupportsMode14())
163163
{
164164
mode DoubleFade;
165165
DoubleFade.name = "Double Fade";

0 commit comments

Comments
 (0)