Skip to content

add EMA smoothing to CPU and temperature widgets - #2

Merged
neoden merged 2 commits into
masterfrom
feature/ema-smoothing
Jan 26, 2026
Merged

neoden merged 2 commits into
masterfrom
feature/ema-smoothing

Conversation

@neoden

@neoden neoden commented Jan 26, 2026

Copy link
Copy Markdown
Owner
  • EMA smoothing for CPU and Temperature widgets to reduce flickering
  • Rename average_seconds → smoothing_interval_seconds (breaking change)
  • Warn about unknown config keys

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds Exponential Moving Average (EMA) smoothing to CPU and Temperature widgets to reduce flickering in the status bar display. It also introduces a breaking configuration change by renaming average_seconds to smoothing_interval_seconds and adds warnings for unknown configuration keys to help users migrate.

Changes:

  • Implemented new EMA utility package with comprehensive tests for exponential moving average smoothing
  • Refactored CPU widget to use EMA instead of simple averaging, with updated tests
  • Added EMA smoothing to Temperature widget
  • Renamed config parameter from average_seconds to smoothing_interval_seconds (breaking change)
  • Added detection and warnings for unknown/deprecated config keys
  • Updated default smoothing interval from 5 to 3 seconds

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
util/ema.go New EMA implementation with period-based alpha calculation and readiness tracking
util/ema_test.go Comprehensive test suite for EMA functionality including edge cases
widgets/cpu.go Refactored to use EMA smoothing instead of history-based averaging, added math.Round for display
widgets/cpu_test.go Updated tests to verify EMA behavior instead of history management
widgets/temperature.go Added EMA smoothing to temperature sensors with default interval handling
config/config.go Renamed field and added unknown key detection with warnings to stderr
config/config_test.go Updated tests for renamed field and added test for unknown key warnings
config.example.toml Updated documentation with new parameter names and better descriptions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread util/ema.go Outdated
Comment thread widgets/cpu.go Outdated
Comment thread widgets/cpu_test.go Outdated
Comment thread widgets/temperature.go Outdated
Comment thread widgets/temperature.go Outdated
@neoden neoden self-assigned this Jan 26, 2026
@neoden
neoden merged commit 10874d2 into master Jan 26, 2026
2 checks passed
@neoden
neoden deleted the feature/ema-smoothing branch January 26, 2026 20:23
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.

2 participants