mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 01:55:48 -05:00
BladeRF2 input: fixed sample rate and center frequency rounding issues by sending these values in the report to buddy message
This commit is contained in:
parent
2373dcf197
commit
3a4324a7fb
@ -34,18 +34,33 @@ public:
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
bool getRxElseTx() const { return m_rxElseTx; }
|
||||
uint64_t getCenterFrequency() const { return m_centerFrequency; }
|
||||
int getDevSampleRate() const { return m_devSampleRate; }
|
||||
bool getRxElseTx() const { return m_rxElseTx; }
|
||||
|
||||
static MsgReportBuddyChange* create(bool rxElseTx)
|
||||
static MsgReportBuddyChange* create(
|
||||
uint64_t centerFrequency,
|
||||
int devSampleRate,
|
||||
bool rxElseTx)
|
||||
{
|
||||
return new MsgReportBuddyChange(rxElseTx);
|
||||
return new MsgReportBuddyChange(
|
||||
centerFrequency,
|
||||
devSampleRate,
|
||||
rxElseTx);
|
||||
}
|
||||
|
||||
private:
|
||||
uint64_t m_centerFrequency; //!< Center frequency
|
||||
int m_devSampleRate; //!< device/host sample rate
|
||||
bool m_rxElseTx; //!< tells which side initiated the message
|
||||
|
||||
MsgReportBuddyChange(bool rxElseTx) :
|
||||
MsgReportBuddyChange(
|
||||
uint64_t centerFrequency,
|
||||
int devSampleRate,
|
||||
bool rxElseTx) :
|
||||
Message(),
|
||||
m_centerFrequency(centerFrequency),
|
||||
m_devSampleRate(devSampleRate),
|
||||
m_rxElseTx(rxElseTx)
|
||||
{ }
|
||||
};
|
||||
|
@ -575,11 +575,8 @@ bool BladeRF2Input::handleMessage(const Message& message)
|
||||
struct bladerf *dev = m_deviceShared.m_dev->getDev();
|
||||
BladeRF2InputSettings settings = m_settings;
|
||||
int status;
|
||||
int tmp_int;
|
||||
unsigned int tmp_uint;
|
||||
uint64_t tmp_uint64;
|
||||
bool tmp_bool;
|
||||
bladerf_gain_mode tmp_gain_mode;
|
||||
|
||||
// evaluate changes that may have been introduced by changes in a buddy
|
||||
|
||||
@ -589,22 +586,8 @@ bool BladeRF2Input::handleMessage(const Message& message)
|
||||
|
||||
if (report.getRxElseTx()) // Rx buddy change: check for: frequency, gain mode and value, bias tee, sample rate, bandwidth
|
||||
{
|
||||
|
||||
status = bladerf_get_sample_rate(dev, BLADERF_CHANNEL_RX(requestedChannel), &tmp_uint);
|
||||
|
||||
if (status < 0) {
|
||||
qCritical("BladeRF2Input::handleMessage: MsgReportBuddyChange: bladerf_get_sample_rate error: %s", bladerf_strerror(status));
|
||||
} else {
|
||||
settings.m_devSampleRate = tmp_uint;
|
||||
}
|
||||
|
||||
status = bladerf_get_frequency(dev, BLADERF_CHANNEL_RX(requestedChannel), &tmp_uint64);
|
||||
|
||||
if (status < 0) {
|
||||
qCritical("BladeRF2Input::handleMessage: MsgReportBuddyChange: bladerf_get_frequency error: %s", bladerf_strerror(status));
|
||||
} else {
|
||||
settings.m_centerFrequency = tmp_uint64;
|
||||
}
|
||||
settings.m_devSampleRate = report.getDevSampleRate();
|
||||
settings.m_centerFrequency = report.getCenterFrequency();
|
||||
|
||||
status = bladerf_get_bandwidth(dev, BLADERF_CHANNEL_RX(requestedChannel), &tmp_uint);
|
||||
|
||||
@ -614,22 +597,6 @@ bool BladeRF2Input::handleMessage(const Message& message)
|
||||
settings.m_bandwidth = tmp_uint;
|
||||
}
|
||||
|
||||
status = bladerf_get_gain_mode(dev, BLADERF_CHANNEL_RX(requestedChannel), &tmp_gain_mode);
|
||||
|
||||
if (status < 0) {
|
||||
qCritical("BladeRF2Input::handleMessage: MsgReportBuddyChange: bladerf_get_gain_mode error: %s", bladerf_strerror(status));
|
||||
} else {
|
||||
settings.m_gainMode = (int) tmp_gain_mode;
|
||||
}
|
||||
|
||||
status = bladerf_get_gain(dev, BLADERF_CHANNEL_RX(requestedChannel), &tmp_int);
|
||||
|
||||
if (status < 0) {
|
||||
qCritical("BladeRF2Input::handleMessage: MsgReportBuddyChange: bladerf_get_gain error: %s", bladerf_strerror(status));
|
||||
} else {
|
||||
settings.m_globalGain = tmp_int;
|
||||
}
|
||||
|
||||
status = bladerf_get_bias_tee(dev, BLADERF_CHANNEL_RX(requestedChannel), &tmp_bool);
|
||||
|
||||
if (status < 0) {
|
||||
@ -645,7 +612,7 @@ bool BladeRF2Input::handleMessage(const Message& message)
|
||||
if (status < 0) {
|
||||
qCritical("BladeRF2Input::handleMessage: MsgReportBuddyChange: bladerf_get_sample_rate error: %s", bladerf_strerror(status));
|
||||
} else {
|
||||
settings.m_devSampleRate = tmp_uint;
|
||||
settings.m_devSampleRate = tmp_uint+1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -894,7 +861,10 @@ bool BladeRF2Input::applySettings(const BladeRF2InputSettings& settings, bool fo
|
||||
|
||||
for (; itSource != sourceBuddies.end(); ++itSource)
|
||||
{
|
||||
DeviceBladeRF2Shared::MsgReportBuddyChange *report = DeviceBladeRF2Shared::MsgReportBuddyChange::create(true);
|
||||
DeviceBladeRF2Shared::MsgReportBuddyChange *report = DeviceBladeRF2Shared::MsgReportBuddyChange::create(
|
||||
settings.m_centerFrequency,
|
||||
settings.m_devSampleRate,
|
||||
true);
|
||||
(*itSource)->getSampleSourceInputMessageQueue()->push(report);
|
||||
}
|
||||
}
|
||||
@ -907,7 +877,10 @@ bool BladeRF2Input::applySettings(const BladeRF2InputSettings& settings, bool fo
|
||||
|
||||
for (; itSink != sinkBuddies.end(); ++itSink)
|
||||
{
|
||||
DeviceBladeRF2Shared::MsgReportBuddyChange *report = DeviceBladeRF2Shared::MsgReportBuddyChange::create(true);
|
||||
DeviceBladeRF2Shared::MsgReportBuddyChange *report = DeviceBladeRF2Shared::MsgReportBuddyChange::create(
|
||||
settings.m_centerFrequency,
|
||||
settings.m_devSampleRate,
|
||||
true);
|
||||
(*itSink)->getSampleSinkInputMessageQueue()->push(report);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user