kopia lustrzana https://github.com/f4exb/sdrangel
Try setting Gain & Bandwidth.
rodzic
6547711c16
commit
5b475a5331
|
@ -1,7 +1,7 @@
|
|||
project(demod)
|
||||
|
||||
add_subdirectory(lora)
|
||||
add_subdirectory(nfm_testing)
|
||||
add_subdirectory(nfm)
|
||||
add_subdirectory(ssb)
|
||||
add_subdirectory(tcpsrc)
|
||||
add_subdirectory(usb)
|
||||
|
|
|
@ -26,13 +26,13 @@ MESSAGE_CLASS_DEFINITION(V4LInput::MsgConfigureV4L, Message)
|
|||
MESSAGE_CLASS_DEFINITION(V4LInput::MsgReportV4L, Message)
|
||||
|
||||
V4LInput::Settings::Settings() :
|
||||
m_gain(0)
|
||||
m_gain(6)
|
||||
{
|
||||
}
|
||||
|
||||
void V4LInput::Settings::resetToDefaults()
|
||||
{
|
||||
m_gain = 0;
|
||||
m_gain = 6;
|
||||
}
|
||||
|
||||
QByteArray V4LInput::Settings::serialize() const
|
||||
|
@ -53,7 +53,7 @@ bool V4LInput::Settings::deserialize(const QByteArray& data)
|
|||
}
|
||||
|
||||
if(d.getVersion() == 1) {
|
||||
d.readS32(1, &m_gain, 0);
|
||||
d.readS32(1, &m_gain, 6);
|
||||
//d.readS32(2, &m_samplerate, 0);
|
||||
return true;
|
||||
} else {
|
||||
|
|
|
@ -64,7 +64,6 @@ static void xioctl(int fh, unsigned long int request, void *arg)
|
|||
void
|
||||
V4LThread::OpenSource(const char *filename)
|
||||
{
|
||||
struct v4l2_format fmt;
|
||||
struct v4l2_buffer buf;
|
||||
struct v4l2_requestbuffers req;
|
||||
enum v4l2_buf_type type;
|
||||
|
@ -79,16 +78,19 @@ V4LThread::OpenSource(const char *filename)
|
|||
return;
|
||||
}
|
||||
// sampletype depends on samplerate. Set that first
|
||||
set_sample_rate((double)SAMPLERATE);
|
||||
set_sample_rate( (double)SAMPLERATE );
|
||||
set_center_freq( (double)centerFreq );
|
||||
|
||||
set_bandwidth( (double)IF_BANDWIDTH );
|
||||
set_tuner_gain( (double) 6.0);
|
||||
#if 0
|
||||
struct v4l2_format fmt;
|
||||
pixelformat = V4L2_PIX_FMT_SDR_CS14LE;
|
||||
CLEAR(fmt);
|
||||
fmt.type = V4L2_BUF_TYPE_SDR_CAPTURE;
|
||||
fmt.fmt.sdr.pixelformat = pixelformat;
|
||||
xioctl(fd, VIDIOC_G_FMT, &fmt);
|
||||
xioctl(fd, VIDIOC_S_FMT, &fmt);
|
||||
qCritical(" Expecting format CS14LE, got : %4.4s", (char *)&fmt.fmt.sdr.pixelformat);
|
||||
|
||||
#endif
|
||||
CLEAR(req);
|
||||
req.count = 8;
|
||||
req.type = V4L2_BUF_TYPE_SDR_CAPTURE;
|
||||
|
@ -232,30 +234,28 @@ V4LThread::work(int noutput_items)
|
|||
unsigned int pos = 0;
|
||||
// MSI format is 252 sample pairs :( 63 * 4) * 4bytes
|
||||
it = m_convertBuffer.begin();
|
||||
if (recebuf_len >= 8) { // in bytes
|
||||
if (recebuf_len >= 16) { // in bytes
|
||||
b = (uint16_t *) recebuf_ptr;
|
||||
unsigned int len = 8 * noutput_items; // decimation (i+q * 4 : cmplx)
|
||||
if (len * 2 > recebuf_len)
|
||||
len = recebuf_len / 2;
|
||||
// Decimate by four for lower cpu usage
|
||||
// ??? seems to have gone a bit wrong.
|
||||
for (pos = 0; pos < len - 3; pos += 4) {
|
||||
xreal = CASTUP(b[pos+0]<<2) + CASTUP(b[pos+1]<<2)
|
||||
+ CASTUP(b[pos+2]<<2) + CASTUP(b[pos+3]<<2);
|
||||
yimag = 0;
|
||||
//CASTUP(b[pos+1]<<2) + CASTUP(b[pos+3]<<2)
|
||||
//+ CASTUP(b[pos+5]<<2) + CASTUP(b[pos+7]<<2);
|
||||
for (pos = 0; pos < len - 7; pos += 8) {
|
||||
xreal = CASTUP(b[pos+0]<<2) + CASTUP(b[pos+2]<<2)
|
||||
+ CASTUP(b[pos+4]<<2) + CASTUP(b[pos+6]<<2);
|
||||
yimag = CASTUP(b[pos+1]<<2) + CASTUP(b[pos+3]<<2)
|
||||
+ CASTUP(b[pos+5]<<2) + CASTUP(b[pos+7]<<2);
|
||||
Sample s( (qint16)(xreal >> 2) , (qint16)(yimag >> 2) );
|
||||
*it = s;
|
||||
it++;
|
||||
}
|
||||
m_sampleFifo->write(m_convertBuffer.begin(), it);
|
||||
recebuf_len -= pos * 2; // size of int16
|
||||
recebuf_ptr = (void*)(b + pos);
|
||||
recebuf_ptr = &b[pos];
|
||||
}
|
||||
// return now if there is still data in buffer, else free buffer and get another.
|
||||
if (recebuf_len >= 8)
|
||||
return pos / 4;
|
||||
if (recebuf_len >= 16)
|
||||
return pos / 8;
|
||||
{ // free buffer, if there was one.
|
||||
if (pos > 0) {
|
||||
CLEAR(buf);
|
||||
|
@ -292,5 +292,5 @@ V4LThread::work(int noutput_items)
|
|||
recebuf_len = buf.bytesused;
|
||||
recebuf_mmap_index = buf.index;
|
||||
}
|
||||
return pos / 4;
|
||||
return pos / 8;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
// lowest samplerate in the kernel is 1.2M, but this works better
|
||||
#define SAMPLERATE 1536000
|
||||
#define IF_BANDWIDTH 300000
|
||||
#define BLOCKSIZE 8192
|
||||
|
||||
class V4LThread : public QThread {
|
||||
|
|
Ładowanie…
Reference in New Issue