Skip to content

Commit

Permalink
🐛 Razer: Do not call lighting functions if the device has no lighting.
Browse files Browse the repository at this point in the history
  • Loading branch information
hexawyz committed Sep 2, 2024
1 parent a5b7c89 commit 9c55765
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,16 @@ await _transport.IsConnectedToExternalPowerAsync(cancellationToken).ConfigureAwa
}

// No idea if that's the right thing to do but it seem to produce some valid good results. (Might just be by coincidence)
byte flag = await _transport.GetDeviceInformationXxxxxAsync(cancellationToken).ConfigureAwait(false);
_appliedEffect = await _transport.GetSavedEffectAsync(flag, cancellationToken).ConfigureAwait(false) ?? DisabledEffect.SharedInstance;
if (HasLighting)
{
byte flag = await _transport.GetDeviceInformationXxxxxAsync(cancellationToken).ConfigureAwait(false);
_appliedEffect = await _transport.GetSavedEffectAsync(flag, cancellationToken).ConfigureAwait(false) ?? DisabledEffect.SharedInstance;

// Reapply the persisted effect. (In case it was overridden by a temporary effect)
await ApplyEffectAsync(_appliedEffect, _currentBrightness, false, true, cancellationToken).ConfigureAwait(false);
// Reapply the persisted effect. (In case it was overridden by a temporary effect)
await ApplyEffectAsync(_appliedEffect, _currentBrightness, false, true, cancellationToken).ConfigureAwait(false);

_currentEffect = _appliedEffect;
_currentEffect = _appliedEffect;
}
}

protected override void OnDeviceExternalPowerChange(bool isCharging)
Expand Down

0 comments on commit 9c55765

Please sign in to comment.