reform2-lpc-fw/src/boards/reform2/board_reform2.c: bump max capacity

  • this accomodates for the cells in current classic Reform with 2200 mAh cells
  • helps avoiding the accumulated capacity to become negative
  • system might soft-poweroff too early when charge is close to zero due to configuration in the OS (for example upower)
  • when the system shuts down too early, lpc can never learn the true zero

drive-by fix:

  • reform2-lpc-fw/src/boards/reform2/board_reform2.c: first float division, then integer cast

This is an attempt to fix wrong values being reported when the accumulated charge becomes smaller than zero. If one tracks /sys/bus/spi/drivers/reform2_lpc/spi1.0/power_supply/BAT0/charge_now over time, one gets the following graph during discharge:

screenshot-2025-10-06-09-45-29

After crossing zero, the value jumps up to 18204000. Divided by 1000 and multiplied by 3.6 that is 65534.4 i.e. the uint16_t maximum.

Merge request reports

Loading