On Fri, Mar 26, 2021 at 11:22:32PM +0100, Patrick Wildt wrote: > It's pretty normal for voltage to go up once AC is connected. In the > end, afaik batteries are charged by applying voltage. Additionally > if an external supply provides power, there's a smaller voltage drop. I thought as much, thanks.
> The "remaining battery time" to become invalid makes sense as well, > I mean, with an AC it's gonna be endless and there's no way to measure > the battery change. Well, the only thing it could maybe try and > estimate is time until charged. That's stuff for another diff (perhaps; I've heard guessing estimates is hard). > What happens to battery percentage? Does it change while it's charging? > > As mentioned, connecting the charger will make the voltage go up, but > the battery charge will not have changed, hence I expect the percentage > to stay the same value, even though the voltage changes. But with time, > percentage should go up. the `percent0' values does increase steadily over time while AC is plugged in. > > @@ -348,9 +348,12 @@ cwfg_update_sensors(void *arg) > > uint8_t val; > > int error, n; > > > > -#if NAPM > 0 > > - /* reset previous reads so apm(4) never gets stale values > > + /* invalidate all previous reads to avoid stale/incoherent values > > * in case of transient cwfg_read() failures below */ > > + sc->sc_sensor[CWFG_SENSOR_VCELL].flags |= SENSOR_FINVALID; > > + sc->sc_sensor[CWFG_SENSOR_SOC].flags |= SENSOR_FINVALID; > > + sc->sc_sensor[CWFG_SENSOR_RTT].flags |= SENSOR_FINVALID; > > I'd probably put a newline here, but that's just personal nitpicking. Sure, committed with it. > I think it makes sense that outdated information should be marked > invalid. Doing that upfront makes sense. Doing it for VCELL is > not strictly necessary, but makes sense for consistency. I did this for consistency, yes.