mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-22 16:08:39 -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
|
MESSAGE_CLASS_DECLARATION
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
uint64_t getCenterFrequency() const { return m_centerFrequency; }
|
||||||
|
int getDevSampleRate() const { return m_devSampleRate; }
|
||||||
bool getRxElseTx() const { return m_rxElseTx; }
|
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:
|
private:
|
||||||
|
uint64_t m_centerFrequency; //!< Center frequency
|
||||||
|
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(bool rxElseTx) :
|
MsgReportBuddyChange(
|
||||||
|
uint64_t centerFrequency,
|
||||||
|
int devSampleRate,
|
||||||
|
bool rxElseTx) :
|
||||||
Message(),
|
Message(),
|
||||||
|
m_centerFrequency(centerFrequency),
|
||||||
|
m_devSampleRate(devSampleRate),
|
||||||
m_rxElseTx(rxElseTx)
|
m_rxElseTx(rxElseTx)
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
@ -575,11 +575,8 @@ bool BladeRF2Input::handleMessage(const Message& message)
|
|||||||
struct bladerf *dev = m_deviceShared.m_dev->getDev();
|
struct bladerf *dev = m_deviceShared.m_dev->getDev();
|
||||||
BladeRF2InputSettings settings = m_settings;
|
BladeRF2InputSettings settings = m_settings;
|
||||||
int status;
|
int status;
|
||||||
int tmp_int;
|
|
||||||
unsigned int tmp_uint;
|
unsigned int tmp_uint;
|
||||||
uint64_t tmp_uint64;
|
|
||||||
bool tmp_bool;
|
bool tmp_bool;
|
||||||
bladerf_gain_mode tmp_gain_mode;
|
|
||||||
|
|
||||||
// evaluate changes that may have been introduced by changes in a buddy
|
// 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
|
if (report.getRxElseTx()) // Rx buddy change: check for: frequency, gain mode and value, bias tee, sample rate, bandwidth
|
||||||
{
|
{
|
||||||
|
settings.m_devSampleRate = report.getDevSampleRate();
|
||||||
status = bladerf_get_sample_rate(dev, BLADERF_CHANNEL_RX(requestedChannel), &tmp_uint);
|
settings.m_centerFrequency = report.getCenterFrequency();
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
status = bladerf_get_bandwidth(dev, BLADERF_CHANNEL_RX(requestedChannel), &tmp_uint);
|
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;
|
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);
|
status = bladerf_get_bias_tee(dev, BLADERF_CHANNEL_RX(requestedChannel), &tmp_bool);
|
||||||
|
|
||||||
if (status < 0) {
|
if (status < 0) {
|
||||||
@ -645,7 +612,7 @@ bool BladeRF2Input::handleMessage(const Message& message)
|
|||||||
if (status < 0) {
|
if (status < 0) {
|
||||||
qCritical("BladeRF2Input::handleMessage: MsgReportBuddyChange: bladerf_get_sample_rate error: %s", bladerf_strerror(status));
|
qCritical("BladeRF2Input::handleMessage: MsgReportBuddyChange: bladerf_get_sample_rate error: %s", bladerf_strerror(status));
|
||||||
} else {
|
} 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)
|
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);
|
(*itSource)->getSampleSourceInputMessageQueue()->push(report);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -907,7 +877,10 @@ bool BladeRF2Input::applySettings(const BladeRF2InputSettings& settings, bool fo
|
|||||||
|
|
||||||
for (; itSink != sinkBuddies.end(); ++itSink)
|
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);
|
(*itSink)->getSampleSinkInputMessageQueue()->push(report);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user