On Mon Jun 30 13:14:24 2025 +0000, Vibhav Pant wrote:
It would improve readability if `full_charge_capacity`, `capacity_now` and `rate_now` in `linux_battery` were instead replaced with an inline `union` type, something like
union { struct { int charge_full_uah; int charge_now_uah; int current_now_ua; } charge; struct { int energy_full_uwh; int energy_now_uwh; int power_now_uw; } energy; } capacity_now;
With `power_unit` as the tag. The `fill_battery_state` code would also be much clearer as a result.
Hi Vibhav,
I had forgotten to ask if the changes reflected your suggestion. Let me know if you'd prefer something else or I got something wrong. Thanks.