1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 17:28:50 -05:00

BladeRF input: communicate Fc Pos change to buddy to align center frequencies

This commit is contained in:
f4exb 2018-09-27 23:38:23 +02:00
parent 5c09985664
commit 2a1f0a0d0e
2 changed files with 15 additions and 0 deletions

View File

@ -35,31 +35,37 @@ public:
public: public:
uint64_t getCenterFrequency() const { return m_centerFrequency; } uint64_t getCenterFrequency() const { return m_centerFrequency; }
int getFcPos() const { return m_fcPos; }
int getDevSampleRate() const { return m_devSampleRate; } int getDevSampleRate() const { return m_devSampleRate; }
bool getRxElseTx() const { return m_rxElseTx; } bool getRxElseTx() const { return m_rxElseTx; }
static MsgReportBuddyChange* create( static MsgReportBuddyChange* create(
uint64_t centerFrequency, uint64_t centerFrequency,
int fcPos,
int devSampleRate, int devSampleRate,
bool rxElseTx) bool rxElseTx)
{ {
return new MsgReportBuddyChange( return new MsgReportBuddyChange(
centerFrequency, centerFrequency,
fcPos,
devSampleRate, devSampleRate,
rxElseTx); rxElseTx);
} }
private: private:
uint64_t m_centerFrequency; //!< Center frequency uint64_t m_centerFrequency; //!< Center frequency
int m_fcPos; //!< Center frequency position
int m_devSampleRate; //!< device/host sample rate int m_devSampleRate; //!< device/host sample rate
bool m_rxElseTx; //!< tells which side initiated the message bool m_rxElseTx; //!< tells which side initiated the message
MsgReportBuddyChange( MsgReportBuddyChange(
uint64_t centerFrequency, uint64_t centerFrequency,
int fcPos,
int devSampleRate, int devSampleRate,
bool rxElseTx) : bool rxElseTx) :
Message(), Message(),
m_centerFrequency(centerFrequency), m_centerFrequency(centerFrequency),
m_fcPos(fcPos),
m_devSampleRate(devSampleRate), m_devSampleRate(devSampleRate),
m_rxElseTx(rxElseTx) m_rxElseTx(rxElseTx)
{ } { }

View File

@ -602,6 +602,13 @@ bool BladeRF2Input::handleMessage(const Message& message)
{ {
settings.m_devSampleRate = report.getDevSampleRate(); settings.m_devSampleRate = report.getDevSampleRate();
settings.m_centerFrequency = report.getCenterFrequency(); settings.m_centerFrequency = report.getCenterFrequency();
settings.m_fcPos = (BladeRF2InputSettings::fcPos_t) report.getFcPos();
BladeRF2InputThread *inputThread = findThread();
if (inputThread) {
inputThread->setFcPos(requestedChannel, (int) settings.m_fcPos);
}
status = bladerf_get_bandwidth(dev, BLADERF_CHANNEL_RX(requestedChannel), &tmp_uint); status = bladerf_get_bandwidth(dev, BLADERF_CHANNEL_RX(requestedChannel), &tmp_uint);
@ -878,6 +885,7 @@ bool BladeRF2Input::applySettings(const BladeRF2InputSettings& settings, bool fo
{ {
DeviceBladeRF2Shared::MsgReportBuddyChange *report = DeviceBladeRF2Shared::MsgReportBuddyChange::create( DeviceBladeRF2Shared::MsgReportBuddyChange *report = DeviceBladeRF2Shared::MsgReportBuddyChange::create(
settings.m_centerFrequency, settings.m_centerFrequency,
(int) settings.m_fcPos,
settings.m_devSampleRate, settings.m_devSampleRate,
true); true);
(*itSource)->getSampleSourceInputMessageQueue()->push(report); (*itSource)->getSampleSourceInputMessageQueue()->push(report);
@ -894,6 +902,7 @@ bool BladeRF2Input::applySettings(const BladeRF2InputSettings& settings, bool fo
{ {
DeviceBladeRF2Shared::MsgReportBuddyChange *report = DeviceBladeRF2Shared::MsgReportBuddyChange::create( DeviceBladeRF2Shared::MsgReportBuddyChange *report = DeviceBladeRF2Shared::MsgReportBuddyChange::create(
settings.m_centerFrequency, settings.m_centerFrequency,
(int) settings.m_fcPos,
settings.m_devSampleRate, settings.m_devSampleRate,
true); true);
(*itSink)->getSampleSinkInputMessageQueue()->push(report); (*itSink)->getSampleSinkInputMessageQueue()->push(report);