Greatly reduce flickering of HyperX DRAM by saving the apply until all LEDs have been written

This commit is contained in:
Adam Honse 2020-12-05 02:31:31 -06:00
parent 7d76d60db8
commit 9345682eb0
3 changed files with 13 additions and 4 deletions

View file

@ -76,6 +76,12 @@ unsigned int HyperXDRAMController::GetMode()
return(mode);
}
void HyperXDRAMController::SendApply()
{
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x02);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x03);
}
void HyperXDRAMController::SetEffectColor(unsigned char red, unsigned char green, unsigned char blue)
{
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x01);
@ -179,9 +185,6 @@ void HyperXDRAMController::SetLEDColor(unsigned int slot, unsigned int led, unsi
bus->i2c_smbus_write_byte_data(dev, green_base + (3 * led), green);
bus->i2c_smbus_write_byte_data(dev, blue_base + (3 * led), blue );
bus->i2c_smbus_write_byte_data(dev, bright_base + (3 * led), 0x64 );
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x02);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x03);
}
void HyperXDRAMController::SetMode(unsigned char new_mode, bool random, unsigned short new_speed)

View file

@ -212,8 +212,11 @@ public:
unsigned int GetLEDCount();
unsigned int GetSlotCount();
unsigned int GetMode();
void SetMode(unsigned char new_mode, bool random, unsigned short new_speed);
void SendApply();
void SetMode(unsigned char new_mode, bool random, unsigned short new_speed);
void SetAllColors(unsigned char red, unsigned char green, unsigned char blue);
void SetEffectColor(unsigned char red, unsigned char green, unsigned char blue);
void SetLEDColor(unsigned int led, unsigned char red, unsigned char green, unsigned char blue);

View file

@ -181,6 +181,7 @@ void RGBController_HyperXDRAM::DeviceUpdateLEDs()
unsigned char blu = RGBGetBValue(color);
hyperx->SetLEDColor(led_idx, red, grn, blu);
}
hyperx->SendApply();
}
else
{
@ -204,6 +205,7 @@ void RGBController_HyperXDRAM::UpdateZoneLEDs(int zone)
unsigned char blu = RGBGetBValue(color);
hyperx->SetLEDColor(led, red, grn, blu);
}
hyperx->SendApply();
}
else
{
@ -229,6 +231,7 @@ void RGBController_HyperXDRAM::UpdateSingleLED(int led)
{
hyperx->SetEffectColor(red, grn, blu);
}
hyperx->SendApply();
}
void RGBController_HyperXDRAM::SetCustomMode()