robotastic / trunk-recorder

Records calls from a Trunked Radio System (P25 & SmartNet)
GNU General Public License v3.0
863 stars 192 forks source link

Config minTransmissionDuration incorrectly parsed. #868

Closed tadscottsmith closed 10 months ago

tadscottsmith commented 10 months ago

Not sure if this applies to other numbers in the config.json, but it appears the new config parser is not correctly reading values for decimal numbers set in minTransmissionDuration.

"minTransmissionDuration": 0.35, [2023-11-14 13:03:16.468952] (info) Minimum Transmission Duration (in seconds): 0

taclane commented 10 months ago

The parser seems to be operating as expected. Sorta. It appears do be doing some implicit conversion based on the default value, or where the value is being stored. For instance:

"minTransmissionDuration": 1.75, __

system->set_min_tx_duration(element.value("minTransmissionDuration", 0));

Minimum Transmission Duration (in seconds): 1

vs.

system->set_min_tx_duration(element.value("minTransmissionDuration", 0.0));

Minimum Transmission Duration (in seconds): 1.75

The other way to avoid the conversion is something like:

system->set_min_tx_duration(element.value<double>("minTransmissionDuration", 0));
taclane commented 10 months ago

Quickly scanning through the new config loader, other things that look like they may be affected by an unintentional conversion to integers include:

PPM error, device gain settings, min/max call duration, squelch, and call timeout

tadscottsmith commented 10 months ago

This appears to be resolved by 06b911c.