Skip to content

Releases: codingadventures/LeGo2-Fan-Control

smoothing rewrite, safety/stability fixes

Choose a tag to compare

@codingadventures codingadventures released this 04 Jul 18:00
  • Rewrote the smoothing algorithm — ramp-rate limiting + hysteresis + hold-timeout (described above), replacing the previous fixed-distance approach. Fixes both fan "skyrocketing" on fast temperature deltas and lagging behind sustained load.
  • Thread safety — added a lock around state shared between the background control loop and the UI, removing read/write races.
  • Atomic settings saves — settings are written to a temp file and renamed, so a power loss mid-write can't corrupt them.
  • Input validation — curves received from the UI are bounds-checked before being applied.
  • Reliable sleep/wake handling — detects wake via a monotonic time-gap and immediately re-applies fan settings.
  • Faster, safer shutdown — the control loop uses an interruptible wait, so unloading returns almost instantly while still releasing EC control back to the firmware.
  • Cleanup and testability — removed unused plugin-template scaffolding and extracted the pure control math into fan_logic.py, with a test_smoothing.py simulation harness for verifying behavior without hardware.