mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-22 11:49:38 -05:00
Update to use SoapySDR frequency correction instead of RTL-SDR specific
This commit is contained in:
parent
8b61aaa62f
commit
94ca0bbe54
@ -168,6 +168,12 @@ SoapySDR::Device *SDRDeviceInfo::getSoapyDevice() {
|
||||
return soapyDevice;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param direction
|
||||
* @param channel
|
||||
* @return
|
||||
*/
|
||||
bool SDRDeviceInfo::hasCORR(int direction, size_t channel) {
|
||||
SoapySDR::Device *dev = getSoapyDevice();
|
||||
|
||||
|
@ -111,12 +111,16 @@ bool SDRThread::init() {
|
||||
//4. Apply other settings: Frequency, PPM correction, Gains, Device-specific settings:
|
||||
device->setFrequency(SOAPY_SDR_RX,0,"RF",frequency - offset.load());
|
||||
|
||||
if (devInfo->hasCORR(SOAPY_SDR_RX, 0)) {
|
||||
if (device->hasFrequencyCorrection(SOAPY_SDR_RX, 0)) {
|
||||
hasPPM.store(true);
|
||||
device->setFrequencyCorrection(SOAPY_SDR_RX, 0, ppm.load());
|
||||
} else if (devInfo->hasCORR(SOAPY_SDR_RX, 0)) {
|
||||
hasPPM.store(true);
|
||||
device->setFrequency(SOAPY_SDR_RX,0,"CORR",ppm.load());
|
||||
} else {
|
||||
hasPPM.store(false);
|
||||
}
|
||||
|
||||
if (device->hasDCOffsetMode(SOAPY_SDR_RX, 0)) {
|
||||
hasHardwareDC.store(true);
|
||||
// wxGetApp().sdrEnumThreadNotify(SDREnumerator::SDR_ENUM_MESSAGE, std::string("Found hardware DC offset correction support, internal disabled."));
|
||||
@ -518,7 +522,11 @@ void SDRThread::updateSettings() {
|
||||
}
|
||||
|
||||
if (ppm_changed.load() && hasPPM.load()) {
|
||||
device->setFrequency(SOAPY_SDR_RX,0,"CORR",ppm.load());
|
||||
if (device->hasFrequencyCorrection(SOAPY_SDR_RX, 0)) {
|
||||
device->setFrequencyCorrection(SOAPY_SDR_RX, 0, ppm.load());
|
||||
} else {
|
||||
device->setFrequency(SOAPY_SDR_RX, 0, "CORR", ppm.load());
|
||||
}
|
||||
ppm_changed.store(false);
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,11 @@ void TuningCanvas::StepTuner(ActiveState state, int exponent, bool up) {
|
||||
long long freq = activeDemod->getFrequency();
|
||||
long long diff = abs(wxGetApp().getFrequency() - freq);
|
||||
|
||||
if (shiftDown) {
|
||||
if (ctrlDown) { // Zero digits to right
|
||||
double intpart;
|
||||
modf(freq / (exp * 10), &intpart);
|
||||
freq = intpart * exp * 10;
|
||||
} else if (shiftDown) { // Prevent digit from carrying
|
||||
bool carried = (long long)((freq) / (exp * 10)) != (long long)((freq + amount) / (exp * 10)) || (bottom && freq < exp);
|
||||
freq += carried?(9*-amount):amount;
|
||||
} else {
|
||||
@ -199,7 +203,11 @@ void TuningCanvas::StepTuner(ActiveState state, int exponent, bool up) {
|
||||
if (state == TUNING_HOVER_BW) {
|
||||
long bw = wxGetApp().getDemodMgr().getLastBandwidth();
|
||||
|
||||
if (shiftDown) {
|
||||
if (ctrlDown) { // Zero digits to right
|
||||
double intpart;
|
||||
modf(bw / (exp * 10), &intpart);
|
||||
bw = intpart * exp * 10;
|
||||
} else if (shiftDown) { // Prevent digit from carrying
|
||||
bool carried = (long)((bw) / (exp * 10)) != (long)((bw + amount) / (exp * 10)) || (bottom && bw < exp);
|
||||
bw += carried?(9*-amount):amount;
|
||||
} else {
|
||||
@ -219,7 +227,11 @@ void TuningCanvas::StepTuner(ActiveState state, int exponent, bool up) {
|
||||
|
||||
if (state == TUNING_HOVER_CENTER) {
|
||||
long long ctr = wxGetApp().getFrequency();
|
||||
if (shiftDown) {
|
||||
if (ctrlDown) { // Zero digits to right
|
||||
double intpart;
|
||||
modf(ctr / (exp * 10), &intpart);
|
||||
ctr = intpart * exp * 10;
|
||||
} else if (shiftDown) { // Prevent digit from carrying
|
||||
bool carried = (long long)((ctr) / (exp * 10)) != (long long)((ctr + amount) / (exp * 10)) || (bottom && ctr < exp);
|
||||
ctr += carried?(9*-amount):amount;
|
||||
} else {
|
||||
@ -310,16 +322,16 @@ void TuningCanvas::OnMouseMoved(wxMouseEvent& event) {
|
||||
} else {
|
||||
switch (hoverState) {
|
||||
case TUNING_HOVER_FREQ:
|
||||
setStatusText("Click, wheel or drag a digit to change frequency; SPACE or numeric key for direct input. Right click to set/clear snap. Hold ALT to change PPM. Hold SHIFT to disable carry.");
|
||||
setStatusText("Click, wheel or drag(left/right) a digit to change frequency; SPACE or numeric key for direct input. Right click to set/clear snap. Hold ALT to change PPM. Hold SHIFT to disable carry. Hold CTRL to Zero Right.");
|
||||
break;
|
||||
case TUNING_HOVER_BW:
|
||||
setStatusText("Click, wheel or drag a digit to change bandwidth; SPACE or numeric key for direct input. Hold SHIFT to disable carry.");
|
||||
setStatusText("Click, wheel or drag(left/right) a digit to change bandwidth; SPACE or numeric key for direct input. Hold SHIFT to disable carry. Hold CTRL to Zero Right.");
|
||||
break;
|
||||
case TUNING_HOVER_CENTER:
|
||||
setStatusText("Click, wheel or drag a digit to change center frequency; SPACE or numeric key for direct input. Hold SHIFT to disable carry.");
|
||||
setStatusText("Click, wheel or drag(left/right) a digit to change center frequency; SPACE or numeric key for direct input. Hold SHIFT to disable carry. Hold CTRL to Zero Right.");
|
||||
break;
|
||||
case TUNING_HOVER_PPM:
|
||||
setStatusText("Click, wheel or drag a digit to change device PPM offset. Hold SHIFT to disable carry.");
|
||||
setStatusText("Click, wheel or drag(left/right) a digit to change device PPM offset. Hold SHIFT to disable carry.");
|
||||
break;
|
||||
case TUNING_HOVER_NONE:
|
||||
setStatusText("");
|
||||
|
Loading…
Reference in New Issue
Block a user