Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid resetting histogram, min & max unnecessarily #1290

Merged
merged 1 commit into from
Oct 1, 2023

Conversation

argilo
Copy link
Member

@argilo argilo commented Sep 30, 2023

Partially addresses #1282.

Comment on lines -367 to -368
m_MaxHoldValid = false;
m_MinHoldValid = false;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to reset max/min hold data when dragging the Y axis.

Comment on lines -485 to -487
m_MaxHoldValid = false;
m_MinHoldValid = false;
m_histIIRValid = false;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to reset anything when adjusting the demod frequency.

Comment on lines -958 to -959
m_MaxHoldValid = false;
m_MinHoldValid = false;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to reset max/min when zooming the Y axis.

@@ -1187,7 +1180,7 @@ void CPlotter::draw(bool newData)
&& tnow_ms >= tlast_plot_drawn_ms + PLOTTER_UPDATE_LIMIT_MS);

// Do not waste time with histogram calculations unless in this mode.
const bool doHistogram = (plotterVisible && m_PlotMode == PLOT_MODE_HISTOGRAM);
const bool doHistogram = (plotterVisible && m_PlotMode == PLOT_MODE_HISTOGRAM && newData);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Processing the histogram after an overlay update causes the IIR data to be blown away.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At low frame rates, this make the histogram chase the avg line while panning. I think that's ok, since it also cuts down on processing, since the histogram isn't constantly redrawn during panning. Either way is fine with me.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, that was unintended. I was trying to prevent the IIR from being reset when the demod frequency was changed. I'll remove this change and have a look to see whether there's a better way to accomplish that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, it's not that the IIR is reset, just that one IIR averaging step executes each time updateOverlay is called, so the IIR rapidly decays even though no new data has arrived.

Copy link
Member Author

@argilo argilo Sep 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some other events that also trigger updateOverlay and cause IIR decay:

  • filter cutoff adjustment
  • changing demod type
  • setting A/B markers
  • enabling/disabling the band plan

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the condition to (!m_histIIRValid || newData) seems to do the trick.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Comment on lines -1903 to -1904
m_MaxHoldValid = false;
m_MinHoldValid = false;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to reset max/min when dragging the Plot dB / WF dB sliders.

Copy link
Contributor

@willcode willcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't see any bad effects from removing those invalidations.

@@ -1187,7 +1180,7 @@ void CPlotter::draw(bool newData)
&& tnow_ms >= tlast_plot_drawn_ms + PLOTTER_UPDATE_LIMIT_MS);

// Do not waste time with histogram calculations unless in this mode.
const bool doHistogram = (plotterVisible && m_PlotMode == PLOT_MODE_HISTOGRAM);
const bool doHistogram = (plotterVisible && m_PlotMode == PLOT_MODE_HISTOGRAM && newData);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At low frame rates, this make the histogram chase the avg line while panning. I think that's ok, since it also cuts down on processing, since the histogram isn't constantly redrawn during panning. Either way is fine with me.

@argilo argilo added the bug label Oct 1, 2023
@argilo argilo merged commit 2ee9faf into master Oct 1, 2023
22 checks passed
@argilo argilo deleted the avoid-plotter-reset branch October 1, 2023 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants