Skip to content

Commit

Permalink
CWX power to RX sockets fixed. Threads named, SetCWX considers High P…
Browse files Browse the repository at this point in the history
…riority packet

- partially fixes #228, at least for CWX form use. Serial pin not worked on yet.
- Threads named, to better track issues
- SetCWX changed to consider the high priority packet setting to that change to antennas and the cwx and be combined into one HP packet.
- antennas settings ignore in hwdmox if previously set by SerCWX related code
  • Loading branch information
ramdor committed Oct 29, 2023
1 parent 42b4021 commit ed024c5
Show file tree
Hide file tree
Showing 19 changed files with 187 additions and 64 deletions.
3 changes: 3 additions & 0 deletions Project Files/Source/ChannelMaster/aamix.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ __declspec (align (16)) AAMIX paamix[MAX_EXT_AAMIX]; // array of pointers for A

void mix_main (void *pargs)
{
const wchar_t* threadName = L"mix_main Thread";
SetThreadDescription(GetCurrentThread(), threadName);

DWORD taskIndex = 0;
HANDLE hTask = AvSetMmThreadCharacteristics(TEXT("Pro Audio"), &taskIndex);
if (hTask != 0) AvSetMmThreadPriority(hTask, 2);
Expand Down
5 changes: 5 additions & 0 deletions Project Files/Source/ChannelMaster/cmUtilities.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ int done = 0;

void WriteAudioFile (void* arg)
{
const wchar_t* threadName = L"WriteAudioFile Thread";
SetThreadDescription(GetCurrentThread(), threadName);

byte* dat = (byte *) arg;
FILE* file = fopen ("AudioFile", "wb");

Expand Down Expand Up @@ -115,6 +118,8 @@ struct EscribeEstructura EscribeCosas;

void EscribeLoTodo (void* arg)
{
const wchar_t* threadName = L"EscribeLoTodo Thread";
SetThreadDescription(GetCurrentThread(), threadName);

for (int i = 0; i < EscribeCosas.nddcs; i++)
{
Expand Down
3 changes: 3 additions & 0 deletions Project Files/Source/ChannelMaster/cmbuffs.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ void cmdata (int id, double* out)

void cm_main (void *pargs)
{
const wchar_t* threadName = L"cm_main Thread";
SetThreadDescription(GetCurrentThread(), threadName);

DWORD taskIndex = 0;
HANDLE hTask = AvSetMmThreadCharacteristics(TEXT("Pro Audio"), &taskIndex);
if (hTask != 0) AvSetMmThreadPriority(hTask, 2);
Expand Down
2 changes: 1 addition & 1 deletion Project Files/Source/ChannelMaster/netInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,7 @@ void SetCWX(int bit)
if (prn->tx[0].cwx != bit)
{
prn->tx[0].cwx = bit;
if (listenSock != INVALID_SOCKET)
if (listenSock != INVALID_SOCKET && prn->sendHighPriority != 0) //[2.10.3]MW0LGE considers high priority
CmdHighPriority();
}
}
Expand Down
5 changes: 5 additions & 0 deletions Project Files/Source/ChannelMaster/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -1228,6 +1228,9 @@ int IOThreadStop() {
}

DWORD WINAPI ReadThreadMain(LPVOID n) {
const wchar_t* threadName = L"ReadThreadMain Thread";
SetThreadDescription(GetCurrentThread(), threadName);

DWORD taskIndex = 0;
HANDLE hTask = AvSetMmThreadCharacteristics(TEXT("Pro Audio"), &taskIndex);
if (hTask != 0) AvSetMmThreadPriority(hTask, 2);
Expand All @@ -1243,6 +1246,8 @@ DWORD WINAPI ReadThreadMain(LPVOID n) {
}

DWORD WINAPI KeepAliveMain(LPVOID n) {
const wchar_t* threadName = L"KeepAliveMain Thread";
SetThreadDescription(GetCurrentThread(), threadName);

KeepAliveLoop();

Expand Down
6 changes: 6 additions & 0 deletions Project Files/Source/ChannelMaster/networkproto1.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ int MetisWriteFrame(int endpoint, char* bufp) {

// this is the main thread that reads data
DWORD WINAPI MetisReadThreadMain(LPVOID n) {
const wchar_t* threadName = L"MetisReadThreadMain Thread";
SetThreadDescription(GetCurrentThread(), threadName);

DWORD taskIndex = 0;
HANDLE hTask = AvSetMmThreadCharacteristics(TEXT("Pro Audio"), &taskIndex);
if (hTask != 0) AvSetMmThreadPriority(hTask, 2);
Expand Down Expand Up @@ -677,6 +680,9 @@ void WriteMainLoop(char* bufp)

DWORD WINAPI sendProtocol1Samples(LPVOID n)
{
const wchar_t* threadName = L"sendProtocol1Samples Thread";
SetThreadDescription(GetCurrentThread(), threadName);

DWORD taskIndex = 0;
HANDLE hTask = AvSetMmThreadCharacteristics(TEXT("Pro Audio"), &taskIndex);
if (hTask != 0) AvSetMmThreadPriority(hTask, 2);
Expand Down
3 changes: 3 additions & 0 deletions Project Files/Source/ChannelMaster/obbuffs.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ void obdata (int id, double* out)

void ob_main (void *pargs)
{
const wchar_t* threadName = L"ob_main Thread";
SetThreadDescription(GetCurrentThread(), threadName);

DWORD taskIndex = 0;
HANDLE hTask = AvSetMmThreadCharacteristics(TEXT("Pro Audio"), &taskIndex);
if (hTask != 0) AvSetMmThreadPriority(hTask, 2);
Expand Down
1 change: 1 addition & 0 deletions Project Files/Source/Console/BasicAudio.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public void Play()
// even though m_objPlayer.Play() is async for some reason perhaps on initial play there would
// be noticabled glitch in specturm. Starting it on this thread seems to reduce the occurance
m_objThread = new Thread(new ThreadStart(playSound));
m_objThread.Name = "Basic Audio Thread";
m_objThread.Priority = ThreadPriority.BelowNormal;
m_objThread.IsBackground = true;
m_objThread.Start();
Expand Down
9 changes: 6 additions & 3 deletions Project Files/Source/Console/CAT/TCPIPcatServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ public void StartSocketListener()
{
m_clientListenerThread =
new Thread(new ThreadStart(SocketListenerThreadStart));
m_clientListenerThread.Name = "TCI clientListener Thread";

m_clientListenerThread.Start();
m_clientListenerThread.Start();
}
}

Expand Down Expand Up @@ -336,11 +337,13 @@ public void StartServer(Console c, bool bTCPIPcatWelcomeMessage = true)

m_serverThread = new Thread(new ThreadStart(ServerThreadStart));
m_serverThread.Priority = ThreadPriority.BelowNormal;
m_serverThread.Start();
m_serverThread.Name = "TCI server Thread";
m_serverThread.Start();

m_purgingThread = new Thread(new ThreadStart(PurgingThreadStart));
m_purgingThread.Priority = ThreadPriority.Lowest;
m_purgingThread.Start();
m_purgingThread.Name = "TCI purging Thread";
m_purgingThread.Start();
}
catch(SocketException se)
{
Expand Down
7 changes: 5 additions & 2 deletions Project Files/Source/Console/TCIServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,9 @@ public void StartSocketListener()

m_clientListenerThread =
new Thread(new ThreadStart(SocketListenerThreadStart));
m_clientListenerThread.Name = "TCI client listener Thread";

m_clientListenerThread.Start();
m_clientListenerThread.Start();
}
}

Expand Down Expand Up @@ -2206,11 +2207,13 @@ public void StartServer(Console c, int rateLimit = 0, bool bCopyRX2VFObToVFOa =

m_serverThread = new Thread(new ThreadStart(ServerThreadStart));
m_serverThread.Priority = ThreadPriority.BelowNormal;
m_serverThread.Name = "TCI server Thread";
m_serverThread.Start();

m_purgingThread = new Thread(new ThreadStart(PurgingThreadStart));
m_purgingThread.Priority = ThreadPriority.Lowest;
m_purgingThread.Start();
m_purgingThread.Name = "TCI purging Thread";
m_purgingThread.Start();
}
catch(SocketException se)
{
Expand Down
Loading

0 comments on commit ed024c5

Please sign in to comment.