Skip to content

Commit

Permalink
tried to fix double parsing in config file
Browse files Browse the repository at this point in the history
  • Loading branch information
robotastic committed Nov 15, 2023
1 parent 0ba0614 commit 06b911c
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions trunk-recorder/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,11 @@ bool load_config(string config_file, Config &config, gr::top_block_sptr &tb, std
BOOST_LOG_TRIVIAL(info) << "Hide Encrypted Talkgroups: " << system->get_hideEncrypted();
system->set_hideUnknown(element.value("hideUnknownTalkgroups", system->get_hideUnknown()));
BOOST_LOG_TRIVIAL(info) << "Hide Unknown Talkgroups: " << system->get_hideUnknown();
system->set_min_duration(element.value("minDuration", 0));
system->set_min_duration(element.value("minDuration", 0.0));
BOOST_LOG_TRIVIAL(info) << "Minimum Call Duration (in seconds): " << system->get_min_duration();
system->set_max_duration(element.value("maxDuration", 0));
system->set_max_duration(element.value("maxDuration", 0.0));
BOOST_LOG_TRIVIAL(info) << "Maximum Call Duration (in seconds): " << system->get_max_duration();
system->set_min_tx_duration(element.value("minTransmissionDuration", 0));
system->set_min_tx_duration(element.value("minTransmissionDuration", 0.0));
BOOST_LOG_TRIVIAL(info) << "Minimum Transmission Duration (in seconds): " << system->get_min_tx_duration();
system->set_multiSite(element.value("multiSite", false));
BOOST_LOG_TRIVIAL(info) << "Multiple Site System: " << system->get_multiSite();
Expand All @@ -384,10 +384,10 @@ bool load_config(string config_file, Config &config, gr::top_block_sptr &tb, std
if (source_enabled) {
bool gain_set = false;
int silence_frames = element.value("silenceFrames", 0);
double center = element.value("center", 0);
double rate = element.value("rate", 0);
double error = element.value("error", 0);
double ppm = element.value("ppm", 0);
double center = element.value("center", 0.0);
double rate = element.value("rate", 0.0);
double error = element.value("error", 0.0);
double ppm = element.value("ppm", 0.0);
bool agc = element.value("agc", false);
int gain = element.value("gain", 0);
int if_gain = element.value("ifGain", 0);
Expand All @@ -414,10 +414,10 @@ bool load_config(string config_file, Config &config, gr::top_block_sptr &tb, std

std::string device = element.value("device", "");
BOOST_LOG_TRIVIAL(info) << "Driver: " << element.value("driver", "");
BOOST_LOG_TRIVIAL(info) << "Center: " << format_freq(element.value("center", 0));
BOOST_LOG_TRIVIAL(info) << "Rate: " << FormatSamplingRate(element.value("rate", 0));
BOOST_LOG_TRIVIAL(info) << "Error: " << element.value("error", 0);
BOOST_LOG_TRIVIAL(info) << "PPM Error: " << element.value("ppm", 0);
BOOST_LOG_TRIVIAL(info) << "Center: " << format_freq(element.value("center", 0.0));
BOOST_LOG_TRIVIAL(info) << "Rate: " << FormatSamplingRate(element.value("rate", 0.0));
BOOST_LOG_TRIVIAL(info) << "Error: " << element.value("error", 0.0);
BOOST_LOG_TRIVIAL(info) << "PPM Error: " << element.value("ppm", 0.0);
BOOST_LOG_TRIVIAL(info) << "Auto gain control: " << element.value("agc", false);
BOOST_LOG_TRIVIAL(info) << "Gain: " << element.value("gain", 0);
BOOST_LOG_TRIVIAL(info) << "IF Gain: " << element.value("ifGain", 0);
Expand Down

1 comment on commit 06b911c

@taclane
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gain values should also be doubles as well. The osmo driver will attempt to round it to the nearest valid gain level, but truncating to an int first might end up with a different value.

callTimeout and squelch were represented as doubles in 4.6 as well.

Please sign in to comment.