Skip to content

Commit

Permalink
Expose reset and enable/disable
Browse files Browse the repository at this point in the history
  • Loading branch information
BatchDrake committed May 6, 2023
1 parent a05ebfd commit 4b027a8
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 6 deletions.
42 changes: 42 additions & 0 deletions DopplerTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ DopplerTool::DopplerTool(
"dopplertool:acceleration",
"Doppler Tool: VLOS acceleation [m/s^2]",
0.)->setAdjustable(true);
GlobalProperty::registerProperty(
"dopplertool:enabled",
"Doppler Tool: correction enabled (boolean)",
0.)->setAdjustable(true);
GlobalProperty::registerProperty(
"dopplertool:reset",
"Doppler Tool: Reset requested (boolean)",
0.)->setAdjustable(true);
}

m_propShift = GlobalProperty::lookupProperty("dopplertool:freq_shift");
Expand All @@ -112,6 +120,9 @@ DopplerTool::DopplerTool(
m_propAccel = GlobalProperty::lookupProperty("dopplertool:acceleration");
m_propCorr = GlobalProperty::lookupProperty("dopplertool:correction");

m_propEnabled = GlobalProperty::lookupProperty("dopplertool:enabled");
m_propReset = GlobalProperty::lookupProperty("dopplertool:reset");

refreshUi();
connectAll();
}
Expand Down Expand Up @@ -265,6 +276,18 @@ DopplerTool::connectAll()
SIGNAL(changed()),
this,
SLOT(onPropBiasChanged()));

connect(
m_propEnabled,
SIGNAL(changed()),
this,
SLOT(onPropEnabledChanged()));

connect(
m_propReset,
SIGNAL(changed()),
this,
SLOT(onPropResetChanged()));
}

void
Expand Down Expand Up @@ -506,3 +529,22 @@ DopplerTool::onFrequencyChanged()
{
applySpectrumState();
}

void
DopplerTool::onPropEnabledChanged()
{
m_panelConfig->enabled = m_propEnabled->toBool();
m_corrector->setEnabled(m_panelConfig->enabled);
}

void
DopplerTool::onPropResetChanged()
{
bool reset = m_propReset->toBool();

if (reset) {
m_propReset->setValueSilent(false);
m_corrector->reset();
}
}

16 changes: 10 additions & 6 deletions DopplerTool.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,14 @@ namespace SigDigger {

// Global properties
static bool g_propsCreated;
GlobalProperty *m_propShift = nullptr;
GlobalProperty *m_propRate = nullptr;
GlobalProperty *m_propBias = nullptr;
GlobalProperty *m_propAccel = nullptr;
GlobalProperty *m_propVel = nullptr;
GlobalProperty *m_propCorr = nullptr;
GlobalProperty *m_propShift = nullptr;
GlobalProperty *m_propRate = nullptr;
GlobalProperty *m_propBias = nullptr;
GlobalProperty *m_propAccel = nullptr;
GlobalProperty *m_propVel = nullptr;
GlobalProperty *m_propCorr = nullptr;
GlobalProperty *m_propEnabled = nullptr;
GlobalProperty *m_propReset = nullptr;

// This is what is actually passed to the corrector
qreal m_currResetFreq = 0;
Expand Down Expand Up @@ -117,6 +119,8 @@ namespace SigDigger {
void onPropRateChanged();
void onPropBiasChanged();

void onPropEnabledChanged();
void onPropResetChanged();

void onReset();
void onToggleEnabled();
Expand Down

0 comments on commit 4b027a8

Please sign in to comment.