Skip to content

DMM: drop false readings at AUTO range changes - #151

Open
vvzvlad wants to merge 6 commits into
bve:mainfrom
vvzvlad:dmm-range-fixes
Open

vvzvlad wants to merge 6 commits into
bve:mainfrom
vvzvlad:dmm-range-fixes

Conversation

@vvzvlad

@vvzvlad vvzvlad commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

At an AUTO range switch the chip's first reading is wrong: 0 V, or the old digits at the new range's
scale (23.03 V while stepping 2.2 → 4.5 V). That reading is no longer shown, so the display, the
statistics, the trend chart and the ampere-hour counter skip it; the raw stream (DMM log, serial
output) keeps it. The switching reading sometimes comes flagged MANUAL (2 of 20 switches on a
0.5–4.5 V sine), so AUTO is judged on the reading before the change. An overload is always shown,
and never two readings in a row are dropped.

The check runs on every packet, under the manual HOLD too, before the charge integrates it, and it
follows the function and input itself, so a function selected under HOLD is covered. Only a number
or an overload tells the range: a --.-- placeholder passes to HOLD and the statistics and leaves
the check's state alone.

The DMM session log takes only a reading that passed this settling and the overload check, the one on
screen. The DMM log and the serial output keep the raw packets; for a thermocouple the DMM log writes the
converted temperature, so it skips a dropped reading too.

Testing

  • pio run builds all four environments without new warnings
  • Tested on ZT703S
  • Tested on ZT706S
  • Not tested on hardware (explain why): no ZT706S here

On ZT703S: ten minutes of a 0.5–4.5 V sine across the 2.5 V range, 20 range switches, no false
reading on screen; the switching reading came flagged MANUAL twice and was dropped both times.
HOLD and placeholders: host test on both boards (1.0000 A, then 9.900 A 500 ms later in the next
range: 0 C with HOLD on and off, also with HOLD on before the current function is selected;
1.0000 → --.-- → 1.0001 keeps the placeholder; the session log's maximum stays 1.0000 A after the
false 9.900 A); not re-run on hardware.

Checklist

  • The change does not write to the factory block (0x08000000–0x0801FFFF)
  • vendor/ is unchanged, or a third-party component is updated as a whole
  • README updated if the behaviour or the installation changed

@bve

bve commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Thanks for tracking down the autorange transient. Two cases need attention.

  • Local HOLD bypasses the range-settling filter while the charge counter keeps integrating. In a host test with both board configurations, the same two DC current packets (1.0000 A, then a transient 9.900 A 500 ms later in the next range) added 2.725 C under HOLD and 0 C with HOLD off. Please apply the range-transient check before charge integration in both cases. Session filtering and integration
  • A NoReading placeholder can be mistaken for a range change based on its decimal position. The host test with 1.0000 followed by --.-- showed the placeholder being dropped, which lets Stable/Auto-Hold treat the window across it as stable. Please only use usable numeric readings to detect a range transition and pass placeholders through to the existing hold and statistics logic. Range detection

@vvzvlad

vvzvlad commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

Fixed both.

  • The range check now runs on every packet, HOLD included, before the charge integrates it. It follows
    the function and input itself, so a current function selected while HOLD is already on is covered
    too. Host test on both boards with your packets (1.0000 A, then 9.900 A 500 ms later in the next
    range): 0 C with HOLD on and off, also with HOLD switched on before the current function is selected.
  • Only a number or an overload tells the range; a --.-- placeholder passes to HOLD and the statistics
    and leaves the check's state alone.

Two choices you may want to overrule:

  • An overload still sets the range the check knows (it is never dropped itself). Numbers only is a
    one-line change.
  • A range change across a placeholder still drops the first number after it, so on a large capacitor
    the first value of the new one shows one measurement cycle later.

Also, for a thermocouple the session log no longer records the previous reading a second time when a
packet is dropped. Not re-run on hardware after these changes. Rebased onto 0.21.19.

@bve

bve commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Thanks for handling HOLD and allowing placeholders through to the existing logic. On both board configurations, I confirmed that the 9.900 A range-change transient after 1.0000 A is skipped by the display path and contributes 0 C, with HOLD on or off.

The same transient still records a 9.900 A maximum in Session log. For regular readings the session receives meter_.latest(), so its sequence check compares the raw packet to itself. A dropped reading can still change the interval statistics or open an event.

Please make Session log consume only fresh readings that passed the settling filter. The raw packet stream can continue to retain the original readings for diagnosis. Session log input

@vvzvlad

vvzvlad commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Fixed. The session log now takes only a reading that passed the range-change and overload settling, the one on screen. The DMM log and the serial output still get the raw packets; for a thermocouple the DMM log writes the converted temperature, so it skips a dropped reading too (docs/DMM_SESSION_LOGGING.md says so).

A host test on the real dmm::Session, both boards, your packets: after 1.0000 A and the false 9.900 A the log's maximum is 1.0000 A from one reading (9.900 A before the fix); the next 9.900 A reading is recorded, with HOLD and without.

Rebased onto 0.22.2; every commit builds. When merged with #153, both change the same session_.observe line in poll.cpp: it needs the sequence check from here and the thermocoupleType() argument from there.

@vvzvlad

vvzvlad commented Nov 28, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto 436d4f0 without conflicts. 3be6afb's HOLD lock and functionPending stay as you wrote them (poll.cpp:92). All five commits build, and pio test -e native passes, test_dmm_ranges included.

At an AUTO range switch the chip's first reading is wrong: 0 V, or the
old digits at the new range's scale (23.03 V stepping 2.2 -> 4.5 V).
Seen at the 2.5 V and 25 mA switches against a lab supply. Like the
settling after an Ohm overload, that reading is not shown, so the
display, the statistics and the trend chart skip it; the raw stream (DMM
log, serial output) keeps it. The ampere-hour charge pauses at it as at
a lost reading, with nothing estimated for its interval. It is judged on
the packet as sent (a thermocouple's millivolts), an overload is always
shown, and never two readings in a row are dropped.
The chip's switching reading sometimes comes flagged MANUAL (2 of 20
switches on a 0.5-4.5 V sine), so the range settling let that false 0 V
through as a user's range. AUTO is now taken from the reading before
the change.
AUTO on the switching reading itself still counts: a run of switches
where one reading comes flagged MANUAL drops the next bad one again,
as entering AUTO straight into another range does.
Under the manual HOLD the range settling was off while the charge kept
integrating, so a false 9.900 A after 1.0000 A added 2.725 C that HOLD
off did not. The range settle now sees every packet and the charge's run
ends at the dropped reading in both cases. RangeSettle follows the
function and current input itself, since the session's own context stays
frozen under HOLD and a function selected then cleared it on every packet.

A placeholder ("--.--") took its decimal point for a range and was
dropped as a change, so Stable and Auto-Hold saw a stable window across
it. Only a number or an overload tells the range now; a placeholder
passes to HOLD and the statistics and leaves the range settle as it was.

The session log gets a thermocouple's shown reading, which a dropped
packet leaves at the one before: it is no longer observed twice.
The session log was fed the raw packet, so the false reading at an AUTO
range change still set its maximum, its interval statistics and events.
It now observes only a reading the range and overload settling let
through, the one the screen shows; the DMM log keeps the raw packets.
…the CSV log

The statistics resume after an AUTO range change from its second reading,
the first being the false one the screen skips; the session log's note
names the per-packet CSV log as the rest of the document does.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants