Skip to content

Commit

Permalink
ToT fixes / vac bypass change
Browse files Browse the repository at this point in the history
bypass vac will only get applied in PollPTT loop if needed (for both mic and vox)
a ToT/led indicator that terminates mox will not key back up instantly if using external keying hardware. It will require PTT to be released first. Fixes #518
  • Loading branch information
ramdor committed Oct 10, 2024
1 parent 614dfe2 commit 760c5b4
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 48 deletions.
109 changes: 62 additions & 47 deletions Project Files/Source/Console/console.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11566,11 +11566,11 @@ public float Rx2MeterData
get { return rx2_meter_new_data; }
}

private bool all_mode_mic_ptt = false;
private bool _all_mode_mic_ptt = false;
public bool AllModeMicPTT
{
get { return all_mode_mic_ptt; }
set { all_mode_mic_ptt = value; }
get { return _all_mode_mic_ptt; }
set { _all_mode_mic_ptt = value; }
}

//private int last_rx1_xvtr_index = -1; // index of last xvtr in use
Expand Down Expand Up @@ -14640,11 +14640,11 @@ public bool CWSidetone
}
}

private PTTMode current_ptt_mode = PTTMode.NONE;
private PTTMode _current_ptt_mode = PTTMode.NONE;
public PTTMode CurrentPTTMode
{
get { return current_ptt_mode; }
set { current_ptt_mode = value; }
get { return _current_ptt_mode; }
set { _current_ptt_mode = value; }
}

private bool rx2_preamp_present = false;
Expand Down Expand Up @@ -18103,11 +18103,11 @@ public int APFGain
}
}

private bool cat_ptt = false;
private bool _cat_ptt = false;
public bool CATPTT
{
get { return cat_ptt; }
set { cat_ptt = value; }
get { return _cat_ptt; }
set { _cat_ptt = value; }
}

private bool reverse_paddles = false;
Expand Down Expand Up @@ -24407,7 +24407,7 @@ private async void UpdateVOX()
await Task.Delay(100);
}
}

private bool mon_recall = false;
private static readonly HiPerfTimer vox_timer = new HiPerfTimer();

Expand All @@ -24423,41 +24423,54 @@ private async void PollPTT()
if (!manual_mox && !disable_ptt && !rx_only && !_tx_inhibit && !QSKEnabled)
{
bool mic_ptt = (dotdashptt & 0x01) != 0; // PTT from radio
bool cat_hs_ptt = CWInput.CATPTT; // CAT serial PTT
bool cw_ptt = CWInput.KeyerPTT; // CW serial PTT
bool vox_ptt = Audio.VOXActive;
bool cat_ptt_local = (ptt_bit_bang_enabled && serialPTT != null && serialPTT.isPTT()) |
(!ptt_bit_bang_enabled && cat_hs_ptt) | cat_ptt;
bool cat_ptt = (ptt_bit_bang_enabled && serialPTT != null && serialPTT.isPTT()) | // CAT serial PTT
(!ptt_bit_bang_enabled && CWInput.CATPTT) | _cat_ptt;

if (!_mox)
{
Audio.VACBypass = (chkVAC1.Checked && m_allow_micvox_bypass);
// we can come in here from a ToT ( StopAllTX() ) //[2.10.3.6]MWLGE fixes #518
// however we dont want switch anything back on, unless all of the above have been released
if (_stop_all_tx)
{
if (_tci_ptt || cat_ptt || cw_ptt || mic_ptt || vox_ptt)
{
await Task.Delay(1);
continue; // skip all, and restart the loop
}
else
_stop_all_tx = false;
}

//Audio.VACBypass = (chkVAC1.Checked && m_allow_micvox_bypass); //[2.10.3.6]MW0LGE originally from PR #87, by W4WMT. We dont want to do this every 1ms
if (chkVAC1.Checked && (allow_vac_bypass || m_allow_micvox_bypass))
{
if(!Audio.VACBypass) Audio.VACBypass = true;
}
else if (Audio.VACBypass)
{
Audio.VACBypass = false;
}

if (_tci_ptt)
{
current_ptt_mode = PTTMode.TCI;
_current_ptt_mode = PTTMode.TCI;
chkMOX.Checked = true;
}
if (cat_ptt_local)

if (cat_ptt)
{
current_ptt_mode = PTTMode.CAT;
_current_ptt_mode = PTTMode.CAT;
chkMOX.Checked = true;
//[2.10.3.5]MW0LGE removed as seems somewhat strange to do. Vox/cw/micptt do not consider it, and they could quite easily fail from out of band issue
//if (!_mox) // although we are in a !mox block, the mox bool gets updated by the _checked event on chkMOX.Checked=true (the line above)
// // if mox(tx) failed then assume it is ok to pull the power
//{
// chkPower.Checked = false;
// return;
//}
}

if ((tx_mode == DSPMode.CWL ||
tx_mode == DSPMode.CWU) &&
(cw_ptt || mic_ptt))
if ((tx_mode == DSPMode.CWL || tx_mode == DSPMode.CWU) && (cw_ptt || mic_ptt))
{
current_ptt_mode = PTTMode.CW;
_current_ptt_mode = PTTMode.CW;

if (chkVAC1.Checked && allow_vac_bypass)
Audio.VACBypass = true;
//if (chkVAC1.Checked && allow_vac_bypass) //[2.10.3.6]MW0LGE see above
// Audio.VACBypass = true;

chkMOX.Checked = true;
}
Expand All @@ -24470,14 +24483,14 @@ private async void PollPTT()
tx_mode == DSPMode.DIGU ||
tx_mode == DSPMode.DIGL ||
tx_mode == DSPMode.FM ||
all_mode_mic_ptt) &&
_all_mode_mic_ptt) &&
mic_ptt &&
current_ptt_mode != PTTMode.CW)
_current_ptt_mode != PTTMode.CW)
{
current_ptt_mode = PTTMode.MIC;
_current_ptt_mode = PTTMode.MIC;

if (chkVAC1.Checked && allow_vac_bypass)
Audio.VACBypass = true;
//if (chkVAC1.Checked && allow_vac_bypass) //[2.10.3.6]MW0LGE see above
// Audio.VACBypass = true;

chkMOX.Checked = true;
}
Expand All @@ -24492,13 +24505,13 @@ private async void PollPTT()
tx_mode == DSPMode.FM) &&
vox_ptt)
{
current_ptt_mode = PTTMode.VOX;
_current_ptt_mode = PTTMode.VOX;
chkMOX.Checked = true;
}
}
else // else if(mox)
{
switch (current_ptt_mode)
switch (_current_ptt_mode)
{
case PTTMode.TCI:
if (!_tci_ptt)
Expand All @@ -24509,7 +24522,7 @@ private async void PollPTT()
case PTTMode.CAT:
if (chkVAC1.Checked && m_allow_micvox_bypass)
Audio.VACBypass = false;
if (!cat_ptt_local)
if (!cat_ptt)
{
chkMOX.Checked = false;
}
Expand Down Expand Up @@ -25937,7 +25950,7 @@ private void Console_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if (spacebar_ptt)
{
current_ptt_mode = PTTMode.SPACE;
_current_ptt_mode = PTTMode.SPACE;
chkMOX.Checked = !chkMOX.Checked;
if (chkMOX.Checked)
{
Expand Down Expand Up @@ -28172,9 +28185,9 @@ private void HdwMOXChanged(bool tx, double freq)
if (cw_fw_keyer &&
(RX1DSPMode == DSPMode.CWL || RX1DSPMode == DSPMode.CWU) &&
!chkTUN.Checked &&
current_ptt_mode != PTTMode.SPACE &&
current_ptt_mode != PTTMode.CAT &&
current_ptt_mode != PTTMode.CW)
_current_ptt_mode != PTTMode.SPACE &&
_current_ptt_mode != PTTMode.CAT &&
_current_ptt_mode != PTTMode.CW)
NetworkIO.SetPttOut(0);
else NetworkIO.SetPttOut(1);
if (serialPTT != null) serialPTT.setDTR(true);
Expand Down Expand Up @@ -28418,9 +28431,9 @@ private void chkMOX_CheckedChanged2(object sender, System.EventArgs e)
return;
}

if (allow_mox_bypass && current_ptt_mode != PTTMode.MIC &&
current_ptt_mode != PTTMode.SPACE &&
current_ptt_mode != PTTMode.CAT)
if (allow_mox_bypass && _current_ptt_mode != PTTMode.MIC &&
_current_ptt_mode != PTTMode.SPACE &&
_current_ptt_mode != PTTMode.CAT)
{
if (chkMOX.Checked)
{
Expand Down Expand Up @@ -28577,7 +28590,7 @@ private void chkMOX_CheckedChanged2(object sender, System.EventArgs e)
}
else
{
current_ptt_mode = PTTMode.NONE;
_current_ptt_mode = PTTMode.NONE;

//Undo FM Offsets
if (radio.GetDSPTX(0).CurrentDSPMode == DSPMode.FM && current_fm_tx_mode != FMTXMode.Simplex
Expand Down Expand Up @@ -29115,7 +29128,7 @@ private async void chkTUN_CheckedChanged(object sender, System.EventArgs e)
// MW0LGE_21k8 moved below mox
updateVFOFreqs(chkTUN.Checked, true);

current_ptt_mode = PTTMode.MANUAL;
_current_ptt_mode = PTTMode.MANUAL;
manual_mox = true;

NetworkIO.SetUserOut0(1); // <--- love the way this is commented MW0LGE_22b - why are we switching DB9 pins? 1 & 3 ?
Expand Down Expand Up @@ -45902,10 +45915,12 @@ private void removeDelegates()
TimeOutTimerManager.RemoveCallback(timeOutTimer);
}
//
private bool _stop_all_tx = false;
public void StopAllTx()
{
if (MOX || manual_mox || chkTUN.Checked || chk2TONE.Checked)
{
_stop_all_tx = true;
MOX = false;
manual_mox = false;
if (chkTUN.Checked)
Expand Down
2 changes: 1 addition & 1 deletion Project Files/Source/Console/titlebar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace Thetis
{
class TitleBar
{
public const string BUILD_NAME = "rc5d";
public const string BUILD_NAME = "rc5e";
public static string GetString(bool bWithFirmware = true)
{
string sRevision = "." + Common.GetRevision();
Expand Down
3 changes: 3 additions & 0 deletions Project Files/Source/ReleaseNotes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ Please report any issue over on [GitHub here](https://github.com/ramdor/Thetis/i
- [add] dark mode option added to BsdWorld urls in Web Image item
- [add] use command line option -cmasioconfig to add a new cmasio tab to audio setting. Remove old cmasio settings from the registry if you want to use this feature as they have moved. See notes in the tab
- [add] option in led indicator to stop tx if conditions met
- [change] when using [extended] Thetis will now allow tx anywhere. It will select the nearest band to the frequency you have selected and use that band info for bpf/lpfs. This will now permit power output on 8m for example. If you use this feature be aware of the out of band transmission possibilities and potential issues for the hardware
- [change] meter container borders have been reduced
- [change] importing a db with meter containers will no longer clear existing ones, they will be added if possible
- [change] containers no longer store/convert all skin meter images, only the ones required for that specific container. Considerable memory savings
Expand All @@ -95,6 +96,7 @@ Please report any issue over on [GitHub here](https://github.com/ramdor/Thetis/i
- [change] right axis on history chart is not shown if not used
- [change] -help text adjusted for the new -dbid flag
- [change] spectrum and grid directX renderers now use directX clip to limit draw items such as line. Previously LOTS of IF statements were used. For a 2000 pixel wide spectrum, at 60fps, it is a saving of over 720,000 IF statements per second, per receiver, and has been replaced by a single directX clip statement. It also fixes the line that used to draw at the bottom of the spectrum if data was below the low limit, and also fixes some rx2 items moving into the rx1 space
- [change] bypass vac will only get applied in PollPTT loop if needed (for both mic and vox)
- [fix] fix issue where you could not remove tx profile entries if they only had case changes in their name, such as ABc and abc
- [fix] import of container locations now works when importing a database
- [fix] fixed issue where a meter container would re-appear if console was minimised and then restored and that container had been docked at some point
Expand Down Expand Up @@ -140,6 +142,7 @@ Please report any issue over on [GitHub here](https://github.com/ramdor/Thetis/i
- [fix] when dragging docked meter containers the user control area of the console form would show unpainted areas. The area covered by the container is now instantly repainted when the container moved/resized/hidden
- [fix] range limits for spectrum and waterfall high/low values. High now cant go below low, and low cant go above high
- [fix] port limit ranges for tci/cat/n1mm/mmio, of 0-65535
- [fix] a ToT/led indicator that terminates mox will not key back up instantly if using external keying hardware. It will require PTT to be released first. Fixes #518

## v2.10.3.5 Change Log
- [add] midi device DJ2GO2 Touch MIDI is now handled uniquely, and main sliders will have values reversed
Expand Down

0 comments on commit 760c5b4

Please sign in to comment.