Skip to content

Commit

Permalink
Use LED ID and version string to determine if mode 14 is supported
Browse files Browse the repository at this point in the history
  • Loading branch information
CalcProgrammer1 committed Jul 10, 2023
1 parent 0295b90 commit fbeb2c1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
21 changes: 19 additions & 2 deletions Controllers/ENESMBusController/ENESMBusController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ static const char* ene_channels[] = /* ENE channel strings

ENESMBusController::ENESMBusController(ENESMBusInterface* interface, ene_dev_id dev)
{
this->interface = interface;
this->dev = dev;
this->interface = interface;
this->dev = dev;
supports_mode_14 = false;

UpdateDeviceName();

Expand Down Expand Up @@ -93,6 +94,17 @@ ENESMBusController::ENESMBusController(ENESMBusInterface* interface, ene_dev_id
direct_reg = ENE_REG_COLORS_DIRECT_V2;
effect_reg = ENE_REG_COLORS_EFFECT_V2;
channel_cfg = ENE_CONFIG_CHANNEL_V1;

// Check for Mode 14 support, only known to exist on modules where the
// DRAM 3 zone ID exists
for(std::size_t cfg_zone_idx = 0; cfg_zone_idx < ENE_NUM_ZONES; cfg_zone_idx++)
{
if(config_table[channel_cfg + cfg_zone_idx] == (unsigned char)ENE_LED_CHANNEL_DRAM_3)
{
supports_mode_14 = true;
break;
}
}
}
// AUMA0-E6K5-0106 - Second generation motherboard controller
else if (strcmp(device_name, "AUMA0-E6K5-0106") == 0)
Expand Down Expand Up @@ -371,6 +383,11 @@ void ENESMBusController::SetMode(unsigned char mode, unsigned char speed, unsign
ENERegisterWrite(ENE_REG_APPLY, ENE_APPLY_VAL);
}

bool ENESMBusController::SupportsMode14()
{
return(supports_mode_14);
}

void ENESMBusController::UpdateDeviceName()
{
for (int i = 0; i < 16; i++)
Expand Down
2 changes: 2 additions & 0 deletions Controllers/ENESMBusController/ENESMBusController.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class ENESMBusController
void SetLEDColorDirect(unsigned int led, unsigned char red, unsigned char green, unsigned char blue);
void SetLEDColorEffect(unsigned int led, unsigned char red, unsigned char green, unsigned char blue);
void SetMode(unsigned char mode, unsigned char speed, unsigned char direction);
bool SupportsMode14();

void UpdateDeviceName();

Expand All @@ -136,4 +137,5 @@ class ENESMBusController
unsigned char channel_cfg;
ENESMBusInterface* interface;
ene_dev_id dev;
bool supports_mode_14;
};
2 changes: 1 addition & 1 deletion Controllers/ENESMBusController/RGBController_ENESMBus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ RGBController_ENESMBus::RGBController_ENESMBus(ENESMBusController * controller_p
RandomFlicker.speed = ENE_SPEED_NORMAL;
modes.push_back(RandomFlicker);

if(version == "AUDA0-E6K5-0101")
if(controller->SupportsMode14())
{
mode DoubleFade;
DoubleFade.name = "Double Fade";
Expand Down

0 comments on commit fbeb2c1

Please sign in to comment.