tr_config: logColor is a string in TR 5.x; TR_CENTER_HZ keeps the control channels it covers (node-26#45)
Both found on node-002. A boolean logColor made TR 5.2.1 refuse the whole config (json type_error.302). MTA Zone 2's live control channel is 770.43 MHz, outside the widest-cover window, so a centre override must be able to pick which control channels to keep rather than demand all of them fit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
010a6b0be5
commit
c4379890df
@@ -224,7 +224,13 @@ def build_tr_config(
|
|||||||
# channels are known here, so the SDR is centred on those. A system
|
# channels are known here, so the SDR is centred on those. A system
|
||||||
# whose voice channels sit outside that ~2 MHz loses those calls (TR
|
# whose voice channels sit outside that ~2 MHz loses those calls (TR
|
||||||
# logs "no source covering" for each) — needs a second source.
|
# logs "no source covering" for each) — needs a second source.
|
||||||
covered = ccs if center_override else widest_cover(ccs, int(sample_rate))
|
if center_override:
|
||||||
|
half = int(sample_rate) * USABLE_BANDWIDTH_SHARE / 2
|
||||||
|
covered = [c for c in ccs if abs(c - center_override) <= half]
|
||||||
|
if not covered:
|
||||||
|
raise ValueError(f"TR_CENTER_HZ {center_override} covers none of {name!r}'s control channels.")
|
||||||
|
else:
|
||||||
|
covered = widest_cover(ccs, int(sample_rate))
|
||||||
if len(covered) < len(ccs):
|
if len(covered) < len(ccs):
|
||||||
system["control_channels"] = covered
|
system["control_channels"] = covered
|
||||||
logger.warning(
|
logger.warning(
|
||||||
@@ -267,7 +273,7 @@ def build_tr_config(
|
|||||||
# reads the control-channel decode rate from it for the health check.
|
# reads the control-channel decode rate from it for the health check.
|
||||||
"logFile": True,
|
"logFile": True,
|
||||||
"logDir": f"{TR_APP_DIR}/logs",
|
"logDir": f"{TR_APP_DIR}/logs",
|
||||||
"logColor": False,
|
"logColor": "none", # TR 5.x: a string ("console"|"none"), not a bool
|
||||||
# Live audio for Discord: simplestream sends every call's PCM to the
|
# Live audio for Discord: simplestream sends every call's PCM to the
|
||||||
# edge-node, which follows one talkgroup at a time into PulseAudio.
|
# edge-node, which follows one talkgroup at a time into PulseAudio.
|
||||||
"audioStreaming": True,
|
"audioStreaming": True,
|
||||||
|
|||||||
@@ -499,3 +499,10 @@ def test_wide_control_channel_list_is_cut_to_what_one_sdr_covers():
|
|||||||
# MTA Zone 2 (node-002): five control channels spanning 4.15 MHz.
|
# MTA Zone 2 (node-002): five control channels spanning 4.15 MHz.
|
||||||
ccs = [770_156_250, 770_431_250, 773_293_750, 773_843_750, 774_306_250]
|
ccs = [770_156_250, 770_431_250, 773_293_750, 773_843_750, 774_306_250]
|
||||||
assert tr_config.widest_cover(ccs, 2_400_000) == ccs[2:]
|
assert tr_config.widest_cover(ccs, 2_400_000) == ccs[2:]
|
||||||
|
|
||||||
|
|
||||||
|
def test_center_override_keeps_only_the_control_channels_it_covers():
|
||||||
|
tr, _ = tr_config.build_tr_config(
|
||||||
|
"P25", "MTA", {"control_channels": [770.15625, 770.43125, 773.29375]},
|
||||||
|
**{**TR_KW, "center_override": 770_900_000})
|
||||||
|
assert tr["systems"][0]["control_channels"] == [770_156_250, 770_431_250]
|
||||||
|
|||||||
Reference in New Issue
Block a user