Use LED ID and version string to determine if mode 14 is supported

This commit is contained in:
Adam Honse 2023-07-09 15:44:33 -05:00
parent 0295b9041f
commit fbeb2c1c45
3 changed files with 22 additions and 3 deletions

View file

@ -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();
@ -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)
@ -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++)

View file

@ -120,6 +120,7 @@ public:
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();
@ -136,4 +137,5 @@ private:
unsigned char channel_cfg;
ENESMBusInterface* interface;
ene_dev_id dev;
bool supports_mode_14;
};

View file

@ -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";