Skip to content

MeterModel: m_activeTxSlice initializer should be -1 to match clear() #2076

@ten9876

Description

@ten9876

Follow-up to PR #2073 (cc @jensenpat).

MeterModel.h:167 declares:

int m_activeTxSlice{0};

But MeterModel::clear() (MeterModel.cpp) resets it to -1:

m_activeTxSlice = -1;

So a freshly-constructed MeterModel reports active slice 0, but a cleared (post-disconnect) MeterModel reports -1. Functionally harmless because clear() always runs on disconnect before any TX activity could plausibly target slice 0, but the inconsistency is worth tightening.

Suggested fix

One-line change in the header:

int m_activeTxSlice{-1};

Then either:

  • Drop the matching assignment from clear() (now redundant), or
  • Leave both for symmetry with the rest of clear()'s "reset to default" pattern.

Either is fine. Whichever reads cleaner — I'd leave both for symmetry.

Why this is a good-first-issue

  • One-line edit
  • No tests need updating (existing tests that call setActiveTxSlice(0) already pass)
  • Build + run ./build/meter_model_test to verify, no behavior change

cc @jensenpat — flagged this during review of #2073, didn't want to block the merge over it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions