Skip to content

Bugfix: Signal min/max in UI#120

Open
ramonfelder wants to merge 3 commits into
sigrokproject:masterfrom
ramonfelder:bugfix-signal-min-max
Open

Bugfix: Signal min/max in UI#120
ramonfelder wants to merge 3 commits into
sigrokproject:masterfrom
ramonfelder:bugfix-signal-min-max

Conversation

@ramonfelder
Copy link
Copy Markdown
Contributor

@ramonfelder ramonfelder commented Apr 27, 2026

This PR fixes the initialization and resetting of signal_min_ and signal_max_ values in AnalogSignal.

Those values are used to determine the SI prefix when a value is displayed. Without this fix, signal_min_ and/or signal_max_ sometimes start with high values, leading to signal readings like e.g. 0.000 GV, or with NaN, leading to readings like e.g. 7384926150847261938450274 yV.

The PR also resets signal_min_ and signal_max_ whenever a new acquisition is started.

Because autoranging also sets signal_min_ and signal_max_, the issue only becomes noticable when autoranging is disabled.

The UI is currently not informed when samples are cleared. As a result, every new acquisition starts with the min/max range
from the previous acquisition. During an acquisition, the range can only increase and never decrease.

This leads to incorrect SI prefixes being used for signal values when the values of a new acquisition are orders of magnitude smaller
than those of any previous acquisition.
Because autoranging also sets the min and max values, the issue only becomes noticable when autoranging is disabled.

Since the min_max_changed signal can only increase the signal range, it cannot be used to reset the range. Therefore, a different signal is required.
This change uses the existing samples_cleared signal for that purpose.
With this commit, SignalBase emits a samples_cleared signal every time an acquisition is started, without any additional condition.
The UI uses this event to reset the min an max values in AnalogSignal.
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.

1 participant