Bugfix: only enable highband source once per sweep

This commit is contained in:
Jan Käberich 2020-09-20 22:51:51 +02:00
parent c1f131b6d7
commit d32f7a61ee
3 changed files with 10 additions and 1 deletions

View File

@ -137,6 +137,14 @@ void FPGA::Disable(Periphery p) {
WriteRegister(Reg::SystemControl, SysCtrlReg);
}
bool FPGA::IsEnabled(Periphery p) {
if(SysCtrlReg & (uint16_t) p) {
return true;
} else {
return false;
}
}
void FPGA::SetWindow(Window w) {
SysCtrlReg &= ~0x0060;
SysCtrlReg |= (int) w << 5;

View File

@ -103,6 +103,7 @@ void SetNumberOfPoints(uint16_t npoints);
void SetSamplesPerPoint(uint32_t nsamples);
void Enable(Periphery p, bool enable = true);
void Disable(Periphery p);
bool IsEnabled(Periphery p);
void SetWindow(Window w);
void EnableInterrupt(Interrupt i);
void DisableInterrupt(Interrupt i);

View File

@ -259,7 +259,7 @@ void VNA::SweepHalted() {
Si5351.Enable(SiChannel::LowbandSource);
FPGA::Disable(FPGA::Periphery::SourceRF);
}
} else {
} else if(!FPGA::IsEnabled(FPGA::Periphery::SourceRF)){
// first sweep point in highband is also halted, disable lowband source
Si5351.Disable(SiChannel::LowbandSource);
FPGA::Enable(FPGA::Periphery::SourceRF);