https://bugs.kde.org/show_bug.cgi?id=528611

            Bug ID: 528611
           Summary: Display 3 decimal places by default for Volt, Watt,
                    and Ampere sensor readings
    Classification: Plasma
           Product: plasmashell
      Version First 6.8.2
       Reported In:
          Platform: CachyOS
                OS: Linux
            Status: REPORTED
          Severity: wishlist
          Priority: NOR
         Component: System Monitor widgets
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
  Target Milestone: 1.0

Created attachment 198296
  --> https://bugs.kde.org/attachment.cgi?id=198296&action=edit
Screenshot After Modification

Currently, `formatNumber()` in `formatter/Formatter.cpp` defaults to 1 decimal
place (`precision = 1`) for floating-point sensor values when no explicit
precision is passed (`precision < 0`).

For modern hardware telemetry (such as CPU Vcore, SoC voltage, and core
power/current sensors), rounding values like `0.869 V` to `0.9 V` or `13.439 W`
to `13.4 W` discards critical millivolt, milliwatt, and milliamp resolution in
System Monitor widgets, even though `ksystemstats` already provides full
floating-point precision from `hwmon`. Keeping sub-1V values in `V` (e.g.,
`0.869 V`) with 3 decimal places rather than switching units to `mV` also
prevents widget columns from jittering left and right as CPU voltage
transitions between idle and boost.

This patch updates `formatNumber()` so that when `precision < 0` and the final
displayed unit (`adjusted`) is `UnitVolt`, `UnitWatt`, or `UnitAmpere`, it
defaults to 3 decimal places (`precision = 3`), while leaving prefixed units
(`kW`, `kV`, etc.) and all other sensor units unchanged. Existing
`formattertest` unit tests remain unaffected.

Note that `CPU vCore` is from the asusec-isa-000a driver and `SVI2_Core` is
from the zenpower-pci-00c3 driver.  The discrepancy between them is a poll
timing difference between them and is not caused by this patch.  They do sync
under a heavy benchmark load.

Also, while inspecting `formatter/Formatter.cpp`: in `unitFormat()`, `case
UnitPetaWatt:` on lines 287-288 currently returns `PV` instead of `PW` (likely
a copy-paste typo from `UnitPetaVolt` right above it).

There is a before and after modification screenshot attached, along with the
patch.
Thank you to all of the KDE developers for all that you do!

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to