Skip to content

Skip disabled LEDs in color modifications, averaging, and dithering (#529) - #664

Open
psieg wants to merge 3 commits into
masterfrom
fix/529-luminosity-disabled-leds
Open

psieg wants to merge 3 commits into
masterfrom
fix/529-luminosity-disabled-leds

Conversation

@psieg

@psieg psieg commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Add Settings::getLedEnabled() to read per-LED enabled state across the active device's LED count (0 .. getNumberOfLeds(getConnectedDevice()) - 1).
  • Track m_ledEnabled in AbstractLedDevice (updateLedEnabled(), updateLedEnabled(const QList<bool>&, bool)), populated during AbstractLedDevice::updateDeviceSettings() with updateColors = false.
  • Clear cached m_ledEnabled in WizardPageUsingDevice::resetDeviceSettings() via device()->updateLedEnabled(QList<bool>(), false) so re-enabling previously disabled LEDs works immediately during wizard testing and calibration.
  • Wire both Settings::ledEnabledChanged and Settings::currentProfileInited through LedDeviceManager::updateLedEnabled() (LedDeviceCommands::UpdateLedEnabled) in LightpackApplication.cpp, respecting m_backlightStatus != Backlight::StatusOff so updating enabled flags (directly or via Settings::loadOrCreateProfile() / Settings::resetDefaults()) while backlight is off acks without turning LEDs back on.
  • Guard GrabWidget::settingsProfileChanged() with m_isUpdatingFromSettings around setIsAreaEnabled() so syncing grab widget UI from Settings updates widget visuals/controls without redundantly re-writing Settings::setLedEnabled() or emitting duplicate ledEnabledChanged signals.
  • In AbstractLedDevice::applyColorModifications(), when m_ledEnabled.count() == inColors.count():
    • Force disabled LEDs to (0, 0, 0) (including rawColors mode).
    • Compute avgColor only over enabled LEDs (falling back to black if none are enabled).
    • Skip minimum luminosity, dead-zone, brightness, white-balance, brightness cap, power-supply limiting, and estimatedTotalAmps for disabled LEDs while preserving existing behavior when m_ledEnabled is empty or has a mismatched length.
  • In AbstractLedDevice::applyDithering(), skip disabled LEDs and track dithering carry/index weighting solely over enabled indices so residual dithering carry cannot accumulate from or land on a disabled LED.
  • Add unit tests in LedDeviceManagerTest covering applyColorModifications() (minimum luminosity, dead-zone, avgColor exclusion, rawColors, power-supply/WB/brightness-cap, all-disabled, and empty/cleared/mismatched m_ledEnabled), applyDithering() carry isolation, and Settings::getLedEnabled(), Settings::loadOrCreateProfile(), Settings::resetDefaults(), and LedDeviceManager::updateLedEnabled() in both StatusOn and StatusOff with qScopeGuard cleanup.

Testing

  • Built Software with qmake6 -r && make -j2 on Linux (Qt 6.8.2).
  • Ran QT_QPA_PLATFORM=offscreen ./bin/LightpackTests — all 8 test suites passed (GrabCalculationTest: 6/6, SettingsMigrationTest: 5/5, LightpackMathTest: 3/3, LightpackApiTest: 102/102, AppVersionTest: 7/7, LightpackCommandLineParserTest: 9/9, LedDeviceManagerTest: 19/19, PluginHardeningTest: 3/3; 0 failed, 0 skipped).

Fixes #529

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scene luminosity setting changes disabled LEDs

1 participant