mirror of
https://github.com/jankae/LibreVNA.git
synced 2026-01-02 06:40:12 +01:00
fix intermittent source generation problem
This commit is contained in:
parent
99d34a39ce
commit
a39b9465a6
|
|
@ -134,7 +134,8 @@ void MAX2871::SetCPCurrent(uint8_t mA) {
|
|||
|
||||
bool MAX2871::SetFrequency(uint64_t f) {
|
||||
if (f < 23500000 || f > MaxFreq) {
|
||||
LOG_ERR("Frequency must be between 23.5MHz and 6GHz");
|
||||
LOG_ERR("Frequency must be between 23.5MHz and 6GHz, requested %lu%06luHz", (uint32_t ) (f / 1000000),
|
||||
(uint32_t ) (f % 1000000));
|
||||
return false;
|
||||
}
|
||||
LOG_DEBUG("Setting frequency to %lu%06luHz...", (uint32_t ) (f / 1000000),
|
||||
|
|
|
|||
|
|
@ -87,24 +87,26 @@ static bool setPLLFrequencies(uint64_t f) {
|
|||
}
|
||||
LOFreq = f + HW::getIF1();
|
||||
}
|
||||
if(sourceFreq > 0) {
|
||||
if(sourceFreq > HW::BandSwitchFrequency) {
|
||||
Source.SetFrequency(sourceFreq);
|
||||
}
|
||||
LO1.SetFrequency(LOFreq);
|
||||
bool needsRefSwitch = false;
|
||||
if(settings.suppressPeaks) {
|
||||
// Integer spurs can cause a small peak.
|
||||
uint32_t sourceDist = Source.DistanceToIntegerSpur();
|
||||
uint32_t LODist = LO1.DistanceToIntegerSpur();
|
||||
if((sourceDist > 0) && (sourceDist < 3 * HW::getIF2())) {
|
||||
LOG_INFO("Source spur at %lu: %lu", (uint32_t) f, sourceDist);
|
||||
sourceRefIndex = !sourceRefIndex;
|
||||
Source.SetReference(PLLRefFreqs[sourceRefIndex], false, 1, false);
|
||||
Source.SetFrequency(sourceFreq);
|
||||
needsRefSwitch = true;
|
||||
if(sourceFreq > HW::BandSwitchFrequency) {
|
||||
uint32_t sourceDist = Source.DistanceToIntegerSpur();
|
||||
if((sourceDist > 0) && (sourceDist < 3 * HW::getIF2())) {
|
||||
LOG_DEBUG("Source spur at %lu: %lu", (uint32_t) f, sourceDist);
|
||||
sourceRefIndex = !sourceRefIndex;
|
||||
Source.SetReference(PLLRefFreqs[sourceRefIndex], false, 1, false);
|
||||
Source.SetFrequency(sourceFreq);
|
||||
needsRefSwitch = true;
|
||||
}
|
||||
}
|
||||
uint32_t LODist = LO1.DistanceToIntegerSpur();
|
||||
if((LODist > 0) && (LODist < 3 * HW::getIF2())) {
|
||||
LOG_INFO("LO spur at %lu", (uint32_t) f);
|
||||
LOG_DEBUG("LO spur at %lu", (uint32_t) f);
|
||||
LO1RefIndex = !LO1RefIndex;
|
||||
LO1.SetReference(PLLRefFreqs[LO1RefIndex], false, 1, false);
|
||||
LO1.SetFrequency(LOFreq);
|
||||
|
|
|
|||
Loading…
Reference in a new issue