File: autotrack_dev.cpp

package info (click to toggle)
satdump 1.2.2%2Bgb79af48-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 81,648 kB
  • sloc: cpp: 276,768; ansic: 164,598; lisp: 1,219; sh: 283; xml: 106; makefile: 7
file content (53 lines) | stat: -rw-r--r-- 1,404 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "autotrack.h"
#include "logger.h"

void AutoTrackApp::start_device()
{
    if (is_started)
        return;

    set_frequency(frequency_hz);

    try
    {
        current_samplerate = source_ptr->get_samplerate();
        if (current_samplerate == 0)
            throw satdump_exception("Samplerate not set!");

        source_ptr->start();

        // if (current_decimation > 1)
        // {
        //     decim_ptr = std::make_shared<dsp::SmartResamplerBlock<complex_t>>(source_ptr->output_stream, 1, current_decimation);
        //     decim_ptr->start();
        //     logger->info("Setting up resampler...");
        //}

        if (d_parameters.contains("fft_enable") && d_parameters["fft_enable"])
        {
            fft->set_fft_settings(fft_size, get_samplerate(), fft_rate);
            // waterfall_plot->set_rate(fft_rate, waterfall_rate);
            fft_plot->bandwidth = get_samplerate();
        }

        splitter->input_stream = /*current_decimation > 1 ? decim_ptr->output_stream :*/ source_ptr->output_stream;
        splitter->start();
        is_started = true;
    }
    catch (std::runtime_error &e)
    {
        logger->error(e.what());
    }
}

void AutoTrackApp::stop_device()
{
    if (!is_started)
        return;

    splitter->stop_tmp();
    // if (current_decimation > 1)
    //     decim_ptr->stop();
    source_ptr->stop();
    is_started = false;
}