Skip to content

Delayed EV counters cause a SQLite write on every control tick #1245

Closed

Description

@frahlg

With a confirmed EV level and delayed session counter, every power-estimate update writes the checkpoint to state.db. At a two-second control interval this produces continuous unnecessary writes during charging.

Use bounded checkpoints while preserving immediate saves for user corrections and final stopped progress. The fix checkpoints after 30 seconds or 30 Wh, and immediately at a stop or failed-save retry. For a 75 kWh battery, 30 Wh is 0.036 percentage points after charging loss. An abrupt process loss between checkpoints can temporarily omit that small increment until the counter catches up; the confirmed anchor must survive.

Regressions bound writes over 90 control ticks, require no writes for unchanged stopped energy, verify exact stopped-state recovery through SQLite reopen, and verify full progress after counter catch-up. Fix: #1240.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions