MCPcopy Create free account
hub / github.com/BatchDrake/SigDigger / onTriggerSampler

Method onTriggerSampler

Components/TimeWindow.cpp:1714–1765  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1712}
1713
1714void
1715TimeWindow::onTriggerSampler(void)
1716{
1717 if (!this->ui->realWaveform->isComplete())
1718 return;
1719
1720 SamplingProperties props;
1721 SUCOMPLEX dataMin = 2 * this->ui->realWaveform->getDataRMS();
1722 SUCOMPLEX dataMax = 2 * this->ui->realWaveform->getDataRMS();
1723 SUFLOAT maxAmp;
1724
1725 this->populateSamplingProperties(props);
1726
1727 if (props.length == 0) {
1728 QMessageBox::warning(
1729 this,
1730 "Start sampling",
1731 "Cannot perform sampling: nothing to sample");
1732 return;
1733 }
1734
1735 if (props.rate < props.fs / SCAST(qreal, props.length)) {
1736 this->ui->baudSpin->setFocus();
1737 QMessageBox::warning(
1738 this,
1739 "Start sampling",
1740 "Cannot perform sampling: symbol rate is too small (or zero)");
1741 return;
1742 }
1743
1744 if (props.sync == ZERO_CROSSING) {
1745 maxAmp = 1;
1746 } else {
1747 maxAmp =
1748 SU_MAX(
1749 SU_MAX(
1750 SU_C_REAL(dataMin),
1751 SU_C_IMAG(dataMin)),
1752 SU_MAX(
1753 SU_C_REAL(dataMax),
1754 SU_C_IMAG(dataMax)));
1755 }
1756
1757 if (maxAmp < 0)
1758 maxAmp = 0;
1759
1760 this->samplerDialog->reset();
1761 this->samplerDialog->setAmplitudeLimits(0, maxAmp);
1762 this->samplerDialog->setProperties(props);
1763
1764 this->startSampling();
1765}
1766
1767void
1768TimeWindow::onResample(void)

Callers

nothing calls this directly

Calls 5

startSamplingMethod · 0.95
setAmplitudeLimitsMethod · 0.80
resetMethod · 0.45
setPropertiesMethod · 0.45

Tested by

no test coverage detected