fix(dmr): block MOX and tune on receive mode

This commit is contained in:
2026-07-14 20:35:20 +03:00
parent e5451b7843
commit d794805081
2 changed files with 36 additions and 4 deletions
+18
View File
@@ -2145,6 +2145,13 @@ begin
if S.Mode = MODE_DMR then Exit;
end;
if FTxSliceId = SliceId then Exit;
// Selecting main A while it is in DMR is allowed as an RX selection, but it
// cannot inherit an active carrier from a previously selected TX slice.
if (SliceId = 0) and (FMode = MODE_DMR) then
begin
if FTuning then SetTune(False)
else if FTransmitting then SetMOX(False);
end;
FTxSliceId := SliceId;
// Передающий тракт под режим нового источника (idle-канал, применится к PTT).
if FWDSPReady and Assigned(FDSPEngine) then
@@ -3143,6 +3150,13 @@ end;
procedure TRadioController.SetMode(M: Integer);
begin
FMode := M;
// Entering receive-only DMR on the selected main TX source immediately
// releases an existing carrier. SetTune(False) also releases MOX.
if ActiveTXMode = MODE_DMR then
begin
if FTuning then SetTune(False)
else if FTransmitting then SetMOX(False);
end;
if Assigned(FDMRDec) then FDMRDec.SetEnabled(FMode = MODE_DMR);
ApplyModeDefaults; // дефолтный фильтр/девиация под режим
FBandCache[FCurrentBand].Mode := FMode;
@@ -4026,6 +4040,9 @@ procedure TRadioController.SetMOX(On_: Boolean);
var
WasTransmitting: Boolean;
begin
// DMR support is receive-only. This guard also covers CAT, web and hardware
// PTT. A selected non-DMR TX slice remains valid while main A receives DMR.
if On_ and (ActiveTXMode = MODE_DMR) then Exit;
// Safety: блокируем TX на бэндах с DoNotTx (Alex) и на RX-only трансвертере.
if On_ and FDevConnected and (FCurrentXvtr < 0)
and FAlexSettings.DoNotTx[EnsureRange(TxBandIdx, 0, 10)] then
@@ -4128,6 +4145,7 @@ end;
procedure TRadioController.SetTune(On_: Boolean);
begin
if On_ = FTuning then Exit;
if On_ and (ActiveTXMode = MODE_DMR) then Exit;
// Safety: те же блокировки, что и в SetMOX — TUN это TX через WDSP PostGen-тон,
// он тоже должен молчать на бэндах с DoNotTx и на RX-only XVTR.
if On_ and FDevConnected and (FCurrentXvtr < 0)