Skip to content

Commit

Permalink
FFT plotter now also saves settings
Browse files Browse the repository at this point in the history
  • Loading branch information
ajn96 committed Nov 23, 2021
1 parent d7a872d commit d9ac222
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 5 deletions.
27 changes: 22 additions & 5 deletions src/FrequencyPlotGUI.vb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Public Class FrequencyPlotGUI
For n As Integer = 3 To 14
NFFT.Items.Add((2 ^ n).ToString)
Next
NFFT.SelectedIndex = 8


'set up list view
RegisterList.View = View.Details
Expand All @@ -62,12 +62,18 @@ Public Class FrequencyPlotGUI
'initialize variables
selectedRegList = New List(Of RegClass)
btn_stopPlot.Enabled = False

'set DR triggered register reads
m_TopGUI.FX3.DrActive = True

plotYLabel = "FFT Magnitude"

'Load settings
NFFT.SelectedText = m_TopGUI.plotSettings.SamplesPerFFT
FFT_Averages.Text = m_TopGUI.plotSettings.FFTAverages
input_3db_min.Text = m_TopGUI.plotSettings.MinPassband
input_3db_max.Text = m_TopGUI.plotSettings.MaxPassband
check_DCNull.Checked = m_TopGUI.plotSettings.NullDC
logXaxis.Checked = m_TopGUI.plotSettings.LogX
logYaxis.Checked = m_TopGUI.plotSettings.LogY
check_sciLabel.Checked = m_TopGUI.plotSettings.ScientificLabels

End Sub

Private Sub Shutdown() Handles Me.Closing
Expand All @@ -80,6 +86,17 @@ Public Class FrequencyPlotGUI
m_FFTStream.Dispose()
m_TopGUI.FFTPlotWidth = Width
m_TopGUI.FFTPlotHeight = Height

'save settings
m_TopGUI.plotSettings.SamplesPerFFT = NFFT.SelectedText
m_TopGUI.plotSettings.FFTAverages = FFT_Averages.Text
m_TopGUI.plotSettings.MinPassband = input_3db_min.Text
m_TopGUI.plotSettings.MaxPassband = input_3db_max.Text
m_TopGUI.plotSettings.NullDC = check_DCNull.Checked
m_TopGUI.plotSettings.LogX = logXaxis.Checked
m_TopGUI.plotSettings.LogY = logYaxis.Checked
m_TopGUI.plotSettings.ScientificLabels = check_sciLabel.Checked

'save register list
m_TopGUI.dataPlotRegs.Clear()
For Each reg In selectedRegList
Expand Down
20 changes: 20 additions & 0 deletions src/HelperClasses/PlotterSettings.vb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Public Class PlotterSettings

End Sub

'Time domain plotter settings

Public UpdateRate As String = "20"

Public SamplesRendered As String = "200"
Expand All @@ -28,4 +30,22 @@ Public Class PlotterSettings

Public Timestamp As Boolean = False

'FFT plotter settings

Public SamplesPerFFT As String = "4096"

Public FFTAverages As String = "1"

Public MinPassband As String = "10"

Public MaxPassband As String = "100"

Public NullDC As Boolean = False

Public LogX As Boolean = True

Public LogY As Boolean = True

Public ScientificLabels As Boolean = False

End Class

0 comments on commit d9ac222

Please sign in to comment.