Skip to content

Commit

Permalink
v2.3.11 10-20-2020
Browse files Browse the repository at this point in the history
Thetis release
  • Loading branch information
w5wc committed Oct 20, 2020
1 parent 67e9518 commit 3021a9b
Show file tree
Hide file tree
Showing 33 changed files with 1,177 additions and 1,020 deletions.
8 changes: 8 additions & 0 deletions Project Files/Source/ChannelMaster/netInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,13 @@ int getLEDs()
return prn->hardware_LEDs;
}

PORT
void LRAudioSwap (int swap)
{
if (prn->lr_audio_swap != swap)
prn->lr_audio_swap = swap;
}

PORT
void create_rnet()
{
Expand Down Expand Up @@ -1273,6 +1280,7 @@ void create_rnet()
prn->wb_sample_size = 16;
prn->wb_update_rate = 70;
prn->wb_packets_per_frame = 32;
prn->lr_audio_swap = 0;
for (i = 0; i < MAX_ADC; i++) {
prn->adc[i].id = i;
prn->adc[i].rx_step_attn = 0;
Expand Down
10 changes: 10 additions & 0 deletions Project Files/Source/ChannelMaster/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,16 @@ void sendOutbound(int id, double* out)
}
else
{
if (prn->lr_audio_swap)
{
double swap;
for (i = 0; i < 2 * prn->audio[0].spp; i += 2)
{
swap = out[i + 0];
out[i + 0] = out[i + 1];
out[i + 1] = swap;
}
}
for (i = 0; i < 2 * prn->audio[0].spp; i++)
{
temp = out[i] >= 0.0 ? (short)floor(out[i] * 32767.0 + 0.5) :
Expand Down
3 changes: 3 additions & 0 deletions Project Files/Source/ChannelMaster/network.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ typedef struct CACHE_ALIGN _radionet
int wb_packets_per_frame;
volatile long wb_enable;

// L & R audio swap for certain models; fixes firmware bugs
int lr_audio_swap;

struct _adc
{
int id;
Expand Down
20 changes: 14 additions & 6 deletions Project Files/Source/ChannelMaster/networkproto1.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ void WriteMainLoop(char* bufp)
else if (nddc == 5)
ddc_freq = prn->rx[0].frequency;
else
ddc_freq = prn->rx[3].frequency;
ddc_freq = prn->rx[1].frequency; //Hermes RX2 freq
C1 = (ddc_freq >> 24) & 0xff; // byte 0 of rx2 freq
C2 = (ddc_freq >> 16) & 0xff; // byte 1 of rx2 freq
C3 = (ddc_freq >> 8) & 0xff; // byte 2 of rx2 freq
Expand Down Expand Up @@ -668,17 +668,26 @@ DWORD WINAPI sendProtocol1Samples(LPVOID n)

int i, j, k;
short temp;
double swap;
double *pbuffs [2];
pbuffs[0] = prn->outLRbufp;
pbuffs[1] = prn->outIQbufp;

while (io_keep_running != 0)
{
WaitForMultipleObjects(2, prn->hsendEventHandles, TRUE, INFINITE);

for (i = 0; i < 2 * 63; i++) // for each sample from both sets, 8 bytes per
for (j = 0; j < 2; j++) // for a sample from each set, 4 bytes per
for (k = 0; k < 2; k++) // for each component of the sample, 2 per
// if ((nddc == 2) || (nddc == 4))
{
for (i = 0; i < 4 * 63; i += 2) // swap L & R audio; firmware bug fix
{
swap = pbuffs[0][i + 0];
pbuffs[0][i + 0] = pbuffs[0][i + 1];
pbuffs[0][i + 1] = swap;
}
}
for (i = 0; i < 2 * 63; i++) // for each sample from both sets, 8 bytes per
for (j = 0; j < 2; j++) // for a sample from each set, 4 bytes per
for (k = 0; k < 2; k++) // for each component of the sample, 2 per
{
temp = pbuffs[j][i * 2 + k] >= 0.0 ? (short)floor(pbuffs[j][i * 2 + k] * 32767.0 + 0.5) :
(short)ceil(pbuffs[j][i * 2 + k] * 32767.0 - 0.5);
Expand All @@ -689,7 +698,6 @@ DWORD WINAPI sendProtocol1Samples(LPVOID n)
prn->OutBufp[8 * i + 4 * j + 2 * k + 0] = (char)((temp >> 8) & 0xff);
prn->OutBufp[8 * i + 4 * j + 2 * k + 1] = (char)(temp & 0xff);
}

WriteMainLoop(prn->OutBufp);
}
return 0;
Expand Down
108 changes: 101 additions & 7 deletions Project Files/Source/Console/Andromeda/Andromeda.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ public partial class Console
private bool AriesTuneState = false; // ATU tune state; true if solution available
private bool AriesEnabled = false; // true if ARIES ATU function enabled
private int AriesAntenna = 0; // antenna that Aries has been told to tune for
private int TXAntennaSent = -1; // antenna in use for TX
private string RXAntennaSentString = "none"; // antenna in use for RX

// array of ints to store TX antenna vs band
// initialised to antenna 1; setup form sends updates when it loads for any antennas on 2 or 3
private const int ARIESANTARRAYSIZE = 12;
Expand Down Expand Up @@ -267,6 +270,8 @@ public void SetAriesRXAntennaName(string Antenna, Band band)
DisplayAriesRXAntenna();
}



// function to set whether an aux input is selected as RX antenna for a given band
// this is called when an antenna control changes in setup.
// parameter true if aux input (ext1, ext2, xvtr) selected
Expand All @@ -278,22 +283,99 @@ public void SetAriesRXAuxAntenna(bool IsAux, Band band)
DisplayAriesRXAntenna();
}


// function to tell Aries that TUNE is active
// at the moment, it just sends a CAT message
private void SetAriesTuneState(bool IsTune)
{
MakeAriesTuneRequestMsg(IsTune);
}



// helper to find nearest band, if we are out of an amateur band. Same logic as Alex.
public Band AntennaBandFromFreq(bool IsTX)
{
Band result;

double freq = 0.0;

if (RX1XVTRIndex >= 0)
freq = XVTRForm.TranslateFreq(freq);
else
{
// really should check TX freq, in case it is a split frequency
freq = VFOAFreq;
}

// now find nearest "real" band
if (freq >= 12.075)
{
if (freq >= 23.17)
{
if (freq >= 26.465)
{
result = freq >= 39.85 ? Band.B6M : Band.B10M;
}
else /* >23.17 <26.465 */
{
result = Band.B12M;
}
}
else /* >12.075 <23.17 */
{
if (freq >= 16.209)
{
result = freq >= 19.584 ? Band.B15M : Band.B17M;
}
else
{
result = Band.B20M;
}
}
}
else /* < 12.075 */
{
if (freq >= 6.20175)
{
result = freq >= 8.7 ? Band.B30M : Band.B40M;
}
else
{
if (freq >= 4.66525)
{
result = Band.B60M;
}
else
{
result = freq >= 2.75 ? Band.B80M : Band.B160M;
}
}
}
return result;
}


// show the TX antenna on the Andromeda screen
private void DisplayAriesTXAntenna()
{
Band CurrentBand;
int Antenna;
int idx = (int)TXBand - (int)Band.B160M;

CurrentBand = TXBand;
// see if we are in an amateur band; if not lookup using Alex function
if ((CurrentBand < Band.B160M) || (CurrentBand > Band.B6M))
CurrentBand = AntennaBandFromFreq(true);

int idx = (int)CurrentBand - (int)Band.B160M;
if ((idx < ARIESANTARRAYSIZE) && (idx >= 0))
{
Antenna = AntennaArrayByBand[idx];
toolStripStatusLabelTXAnt.Text = "Tx Ant " + Antenna.ToString();
if(Antenna != TXAntennaSent)
{
toolStripStatusLabelTXAnt.Text = "Tx Ant " + Antenna.ToString();
TXAntennaSent = Antenna;
}
}
}

Expand All @@ -302,8 +384,16 @@ private void DisplayAriesTXAntenna()
private void DisplayAriesRXAntenna()
{
int Antenna;
Band CurrentBand;
string AntString = "RX";
int idx = (int)RX1Band - (int)Band.B160M;
CurrentBand = RX1Band;

// see if we are in an amateur band; if not lookup using Alex function
if ((CurrentBand < Band.B160M) || (CurrentBand > Band.B6M))
CurrentBand = AntennaBandFromFreq(false);

// convert to int, 160m = index value 0
int idx = (int)CurrentBand - (int)Band.B160M;
if ((idx < ARIESANTARRAYSIZE) && (idx >= 0))
{
if (RXAuxAntennaArrayByBand[idx])
Expand All @@ -330,7 +420,11 @@ private void DisplayAriesRXAntenna()
}
else
AntString = "Rx Ant " + RXAntennaArrayByBand[idx].ToString();
toolStripStatusLabelRXAnt.Text = AntString;
if(AntString != RXAntennaSentString)
{
toolStripStatusLabelRXAnt.Text = AntString;
RXAntennaSentString = AntString;
}
}
}

Expand Down Expand Up @@ -361,7 +455,7 @@ void TXAntennaStep()
}
}

// set TX antenna to specified antenna (1=3)
// set TX antenna to specified antenna (1=3) called by status bar handler
void SetNewTXAntenna(int Ant)
{
if ((Ant >= 1) && (Ant <= 3))
Expand All @@ -373,15 +467,15 @@ void SetNewTXAntenna(int Ant)
}
}

// set RX antenna to specified antenna (1=3)
// set RX antenna to specified antenna (1=3) called by status bar handler
void SetNewRXAntenna(int Ant)
{
if ((Ant >= 1) && (Ant <= 3))
{
// change antenna only if TX band == RX band
// step by the current TX antenna
if (SetupForm != null)
SetupForm.SetRXAntenna(Ant, TXBand);
SetupForm.SetRXAntenna(Ant, RX1Band);
}
}

Expand Down
2 changes: 1 addition & 1 deletion Project Files/Source/Console/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:

[assembly: AssemblyVersion("2.8.9.0")]
[assembly: AssemblyVersion("2.8.11.0")]

//
// In order to sign your assembly you must specify a key to use. Refer to the
Expand Down
7 changes: 5 additions & 2 deletions Project Files/Source/Console/CAT/CATCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6154,12 +6154,15 @@ public string ZZTO(string s)
tl = Convert.ToInt32(s);
tl = Math.Max(0, tl);
tl = Math.Min(100, tl);
console.SetupForm.TunePower = tl;
if (console.TXTunePower) console.PWR = tl;
else console.SetupForm.TunePower = tl;

return "";
}
else if(s.Length == parser.nGet) // if this is a read command
{
return AddLeadingZeros(console.SetupForm.TunePower);
if (console.TXTunePower) return AddLeadingZeros(console.PWR);
else return AddLeadingZeros(console.SetupForm.TunePower);
}
else
{
Expand Down
Loading

0 comments on commit 3021a9b

Please sign in to comment.