kopia lustrzana https://github.com/ogre/habdec
added --ppm correction flag
rodzic
f61f7df16c
commit
c1ee6adc48
|
@ -313,6 +313,17 @@ bool IQSource_SoapySDR::setOption(const std::string& option, const void* p_data)
|
|||
}
|
||||
return true;
|
||||
}
|
||||
else if(option == "ppm_double")
|
||||
{
|
||||
double value = *reinterpret_cast<double*>(p_data_nonconst);
|
||||
if( p_device_ && p_device_->hasFrequencyCorrection(SOAPY_SDR_RX, 0) )
|
||||
{
|
||||
if(b_verbose)
|
||||
cout<<"Set "<<option<<" = "<<setprecision(1)<<value<<endl;
|
||||
p_device_->setFrequencyCorrection( SOAPY_SDR_RX, 0, value );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if(option == "gain_double")
|
||||
{
|
||||
double value = *reinterpret_cast<double*>(p_data_nonconst);
|
||||
|
@ -377,6 +388,17 @@ bool IQSource_SoapySDR::getOption(const std::string& option, void* p_data)
|
|||
}
|
||||
return false;
|
||||
}
|
||||
else if(option == "ppm_double")
|
||||
{
|
||||
if( p_device_ && p_device_->hasFrequencyCorrection(SOAPY_SDR_RX, 0) )
|
||||
{
|
||||
*reinterpret_cast<double*>(p_data) = p_device_->getFrequencyCorrection( SOAPY_SDR_RX, 0);
|
||||
if(b_verbose)
|
||||
cout<<"getOption "<<option<<" "<<*reinterpret_cast<double*>(p_data)<<endl;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else if(option == "gain_double")
|
||||
{
|
||||
if(p_device_)
|
||||
|
|
|
@ -84,6 +84,7 @@ public:
|
|||
float rtty_ascii_stops_ = 2;
|
||||
bool live_print_ = true;
|
||||
bool afc_ = false;
|
||||
double ppm_ = 0;
|
||||
std::string sentence_cmd_ = "";
|
||||
std::string habitat_payload_ = "";
|
||||
|
||||
|
@ -101,6 +102,7 @@ public:
|
|||
oFile<<"latlon = "<<GLOBALS::get().station_lon_<<endl;
|
||||
|
||||
oFile<<"freq = "<<setprecision(9)<<GLOBALS::get().frequency_/1e6<<endl;
|
||||
oFile<<"ppm = "<<setprecision(9)<<GLOBALS::get().ppm_<<endl;
|
||||
oFile<<"gain = "<<GLOBALS::get().gain_<<endl;
|
||||
oFile<<"biast = "<<GLOBALS::get().biast_<<endl;
|
||||
oFile<<"print = "<<GLOBALS::get().live_print_<<endl;
|
||||
|
@ -131,6 +133,7 @@ public:
|
|||
cout<<"\tstation: "<<GLOBALS::get().station_callsign_<<endl;
|
||||
cout<<"\tlatlon: "<<GLOBALS::get().station_lat_<<" "<<GLOBALS::get().station_lon_<<endl;
|
||||
cout<<"\tfreq: "<<GLOBALS::get().frequency_<<endl;
|
||||
cout<<"\tppm: "<<GLOBALS::get().ppm_<<endl;
|
||||
cout<<"\tgain: "<<GLOBALS::get().gain_<<endl;
|
||||
cout<<"\tlive_print: "<<GLOBALS::get().live_print_<<endl;
|
||||
cout<<"\tbaud: "<<GLOBALS::get().baud_<<endl;
|
||||
|
|
|
@ -137,6 +137,7 @@ bool SetupDevice(SoapySDR::Kwargs& o_device)
|
|||
double biastee = GLOBALS::get().biast_;
|
||||
GLOBALS::get().p_iq_source_->setOption("biastee_double", &biastee);
|
||||
GLOBALS::get().p_iq_source_->setOption("sampling_rate_double", &GLOBALS::get().sampling_rate_);
|
||||
GLOBALS::get().p_iq_source_->setOption("ppm_double", &GLOBALS::get().ppm_);
|
||||
|
||||
o_device = device;
|
||||
return true;
|
||||
|
|
|
@ -86,6 +86,7 @@ void prog_opts(int ac, char* av[])
|
|||
("latlon", po::value< std::vector<float> >()->multitoken(), "station GPS location (decimal)")
|
||||
|
||||
("freq", po::value<float>(), "frequency in MHz")
|
||||
("ppm", po::value<float>(), "frequency correction in PPM")
|
||||
("gain", po::value<int>(), "gain")
|
||||
("print", po::value<bool>(), "live print received chars, values: 0, 1")
|
||||
("rtty", po::value< std::vector<float> >()->multitoken(), "rtty: baud bits stops, example: -rtty 300 8 2")
|
||||
|
@ -179,6 +180,10 @@ void prog_opts(int ac, char* av[])
|
|||
{
|
||||
GLOBALS::get().frequency_ = vm["freq"].as<float>() * 1e6;
|
||||
}
|
||||
if (vm.count("ppm"))
|
||||
{
|
||||
GLOBALS::get().ppm_ = vm["ppm"].as<float>();
|
||||
}
|
||||
if (vm.count("gain"))
|
||||
{
|
||||
GLOBALS::get().gain_ = vm["gain"].as<int>();
|
||||
|
|
|
@ -60,6 +60,13 @@ bool HandleCommand(const std::string i_command, websocket::stream<tcp::socket>&
|
|||
string o_command = "cmd::set:frequency=" + to_string(frequency);
|
||||
ws.write( boost::asio::buffer(o_command.c_str(), o_command.size()) );
|
||||
}
|
||||
else if(i_command == "get:ppm")
|
||||
{
|
||||
double ppm = 0;
|
||||
GLOBALS::get().p_iq_source_->getOption("ppm_double", &ppm);
|
||||
string o_command = "cmd::set:ppm=" + to_string(ppm);
|
||||
ws.write( boost::asio::buffer(o_command.c_str(), o_command.size()) );
|
||||
}
|
||||
else if(i_command == "get:gain")
|
||||
{
|
||||
double gain = 0;
|
||||
|
@ -138,6 +145,14 @@ bool HandleCommand(const std::string i_command, websocket::stream<tcp::socket>&
|
|||
string o_command = "cmd::set:decimation=" + to_string(decim_factor_log);
|
||||
ws.write( boost::asio::buffer(o_command.c_str(), o_command.size()) );
|
||||
}
|
||||
else if( regex_match(i_command, match, regex(R"_(set\:ppm=([+-]?([0-9]*[.])?[0-9]+))_")) && match.size() > 1 )
|
||||
{
|
||||
double ppm = stod(match[1]);
|
||||
GLOBALS::get().p_iq_source_->setOption("ppm_double", &ppm);
|
||||
string o_command = "cmd::set:ppm=" + to_string(ppm);
|
||||
ws.write( boost::asio::buffer(o_command.c_str(), o_command.size()) );
|
||||
GLOBALS::get().ppm_ = ppm;
|
||||
}
|
||||
else if( regex_match(i_command, match, regex(R"_(set\:gain=([+-]?([0-9]*[.])?[0-9]+))_")) && match.size() > 1 )
|
||||
{
|
||||
double gain = stod(match[1]);
|
||||
|
|
Ładowanie…
Reference in New Issue