diff --git a/Project Files/Source/ChannelMaster/cmasio.c b/Project Files/Source/ChannelMaster/cmasio.c index 1f0ea7b4..3d6703b7 100644 --- a/Project Files/Source/ChannelMaster/cmasio.c +++ b/Project Files/Source/ChannelMaster/cmasio.c @@ -52,7 +52,7 @@ void create_cmasio() char* asioDriverName = (char*)calloc(32, sizeof(char)); if (getASIODriverString(asioDriverName) != 0) { free(asioDriverName); return; } char buf[128]; - sprintf_s(buf, 128, "Initializing cmASIO with: \nblock size = %d\nsample rate = %d\ndriver name = \"%s\"\n\n", pcma->blocksize, samplerate, asioDriverName); + sprintf_s(buf, 128, "Initializing cmASIO with: \nblock size = %d\nsample rate = %d\ndriver name = %s\n\n", pcma->blocksize, samplerate, asioDriverName); OutputDebugStringA(buf); //[2.10.3.13]MW0LGE get explicit base channel indices for the stereo pair, default to 0 if none in registry @@ -400,4 +400,4 @@ void resetCMAevents() pcma->overFlowsIn = pcma->overFlowsOut = pcma->underFlowsIn = pcma->underFlowsOut = 0; resetRMatchDiags(pcma->rmatchIN); resetRMatchDiags(pcma->rmatchOUT); -} \ No newline at end of file +} diff --git a/Project Files/Source/ChannelMaster/cmasio.h b/Project Files/Source/ChannelMaster/cmasio.h index e9cb7749..6c29bdd3 100644 --- a/Project Files/Source/ChannelMaster/cmasio.h +++ b/Project Files/Source/ChannelMaster/cmasio.h @@ -91,4 +91,4 @@ typedef struct _cmasio extern CMASIO pcma; -#endif \ No newline at end of file +#endif diff --git a/Project Files/Source/ChannelMaster/netInterface.c b/Project Files/Source/ChannelMaster/netInterface.c index b844384f..be920882 100644 --- a/Project Files/Source/ChannelMaster/netInterface.c +++ b/Project Files/Source/ChannelMaster/netInterface.c @@ -625,6 +625,9 @@ void DisablePA(int bit) { if (prn->tx[0].pa != bit) { + if (HPSDRModel == HPSDRModel_HERMESLITE) + EnableApolloTuner(!bit); // MI0BOT: This call used on HL2 to enable/disable PA + prn->tx[0].pa = bit; if (listenSock != INVALID_SOCKET) CmdGeneral(); @@ -810,6 +813,25 @@ void SetLineBoost(int bits) } } +PORT // MI0BOT: Causes a HL2 to perform a reset on disconnect +void SetResetOnDisconnect(int bit) +{ + if (prn->reset_on_disconnect != bit) + { + prn->reset_on_disconnect = bit & 0x1; + } +} + +PORT // MI0BOT: Control to swap the left and right audio channels send over P1 + +void SwapAudioChannels(int swap) +{ + if (prn->swap_audio_channels != swap) + { + prn->swap_audio_channels = swap & 0x1; + } +} + PORT void SetPureSignal(int bit) { @@ -1173,11 +1195,32 @@ void SetCWX(int bit) { if (prn->tx[0].cwx != bit) { - prn->tx[0].cwx = bit; + if (prn->cw.break_in == true || XmitBit == true || prn->tx[0].cwx_ptt == true) + { + prn->tx[0].cwx = bit; + } + keySidetone(0, 0, bit); if (listenSock != INVALID_SOCKET) //[2.10.3.6]MW0LGE high priority always CmdHighPriority(); } + else + { + // Make sure we get correct side tone when break-in is not active + if (prn->cw.break_in != true) + keySidetone(0, 0, bit); + } +} + +PORT // MI0BOT: On the HL2 the CWX protocol has been updated to pass PTT in Bit 3 +void SetCWXPTT(int bit) +{ + if (prn->tx[0].cwx_ptt != bit) + { + prn->tx[0].cwx_ptt = bit; + if (listenSock != INVALID_SOCKET) + CmdHighPriority(); + } } PORT @@ -1412,6 +1455,138 @@ void LRAudioSwap (int swap) prn->lr_audio_swap = swap; } +PORT // MI0BOT: Controls the delay for PTT to Tx power out for HL2 +void SetTxLatency (int txLatency) +{ + prn->tx[0].tx_latency = txLatency; +} + +PORT // MI0BOT: Determines the delay until Tx/Rx change over after Tx buffer empties for the HL2 +void SetPttHang (int pttHang) +{ + prn->tx[0].ptt_hang = pttHang; +} + +PORT // MI0BOT: Initialises for a read of the I2C on the HL2 +int I2CReadInitiate(int bus, int address, int control) +{ + int return_code = -1; + + // Only read when a sequence of writes are not in progress + // This is true only when the IN and OUT indexes are the same + + if (prn->i2c.in_index == prn->i2c.out_index) + { + // Get the next free spot in the queue + + unsigned char next = prn->i2c.in_index + 1 >= MAX_I2C_QUEUE ? 0 : prn->i2c.in_index + 1; + + prn->i2c.i2c_queue[next].bus = bus; + prn->i2c.i2c_queue[next].address = address; + prn->i2c.i2c_queue[next].control = control; + + prn->i2c.i2c_control = 0; // Clear all the control bits + prn->i2c.ctrl_read = 1; + prn->i2c.ctrl_stop = 1; + prn->i2c.ctrl_request = 1; + + prn->i2c.in_index = next; // Move IN index on to start the transmission + + return_code = 0; + } + + return return_code; +} + +PORT // MI0BOT: Initialises for a write of the I2C on the HL2 where a return is expected +int I2CWriteInitiate(int bus, int address, int control, int data) +{ + int return_code = -1; + + if (0 == prn->i2c.ctrl_read) + { + // Only proceed if read is not in progress + + // Get the next index in the IN queue + unsigned char next = prn->i2c.in_index + 1 >= MAX_I2C_QUEUE ? 0 : prn->i2c.in_index + 1; + + if (next != prn->i2c.out_index) + { + // Only proceed if the indexes are not the same, as that is the overflow condition + + prn->i2c.i2c_queue[next].bus = bus; + prn->i2c.i2c_queue[next].address = address; + prn->i2c.i2c_queue[next].control = control; + prn->i2c.i2c_queue[next].write_data = data; + + // We are expecting a response + prn->i2c.ctrl_request = 1; + + // Move the index on to start the transmission + prn->i2c.in_index = next; + + return_code = 0; + } + } + + return return_code; +} + +PORT // MI0BOT: Write to the I2C on the HL2 when a return is not expected +int I2CWrite(int bus, int address, int control, int data) +{ + int return_code = -1; + + if (0 == prn->i2c.ctrl_read) + { + // Only proceed if read is not in progress + + // Get the next index in the IN queue + unsigned char next = prn->i2c.in_index + 1 >= MAX_I2C_QUEUE ? 0 : prn->i2c.in_index + 1; + + if (next != prn->i2c.out_index) + { + // Only proceed if the indexs are not the same, as that is the overflow condition + + prn->i2c.i2c_queue[next].bus = bus; + prn->i2c.i2c_queue[next].address = address; + prn->i2c.i2c_queue[next].control = control; + prn->i2c.i2c_queue[next].write_data = data; + + // Move the index on to start the transmission + prn->i2c.in_index = next; + + return_code = 0; + } + } + + return return_code; +} + +PORT // MI0BOT: Handles the I2C responses for the HL2 +int I2CResponse(unsigned char* read_data) +{ + int return_code = 1; + + if (prn->i2c.ctrl_error) + { + return_code = -1; + } + else if (prn->i2c.ctrl_read_available) + { + prn->i2c.i2c_control = 0; + + read_data[0] = prn->i2c.read_data[0]; + read_data[1] = prn->i2c.read_data[1]; + read_data[2] = prn->i2c.read_data[2]; + read_data[3] = prn->i2c.read_data[3]; + + return_code = 0; + } + + return return_code; +} + PORT void create_rnet() { @@ -1444,6 +1619,16 @@ void create_rnet() prn->cc_seq_no = 0; prn->cc_seq_err = 0; + prn->i2c.i2c_control = 0; // MI0BOT: HL2 I2C variables + prn->i2c.returned_address = 0; + prn->i2c.read_data[0] = 0; + prn->i2c.read_data[1] = 0; + prn->i2c.read_data[2] = 0; + prn->i2c.read_data[3] = 0; + prn->i2c.in_index = 0; + prn->i2c.out_index = 0; + prn->i2c.delay = 0; + prn->cw.mode_control = 0; prn->cw.sidetone_level = 0; prn->cw.sidetone_freq = 0; @@ -1512,6 +1697,7 @@ void create_rnet() prn->tx[i].frequency = 0; prn->tx[i].sampling_rate = 192; prn->tx[i].cwx = 0; + prn->tx[i].cwx_ptt = 0; // MI0BOT: HL2 control of PTT via CWX protocol prn->tx[i].dash = 0; prn->tx[i].dot = 0; prn->tx[i].ptt_out = 0; @@ -1520,6 +1706,8 @@ void create_rnet() prn->tx[i].epwm_max = 0; prn->tx[i].epwm_min = 0; prn->tx[i].pa = 0; + prn->tx[i].tx_latency = 20; // MI0BOT: HL2 + prn->tx[i].ptt_hang = 12; // MI0BOT: HL2 prn->tx[i].mic_in_seq_no = 0; prn->tx[i].mic_in_seq_err = 0; prn->tx[i].mic_out_seq_no = 0; @@ -1533,19 +1721,9 @@ void create_rnet() prn->puresignal_run = 0; - for (i = 0; i < 6; i++) - prn->discovery.MACAddr[i] = 0; - prn->discovery.BoardType = 0; - prn->discovery.protocolVersion = 0; - prn->discovery.fwCodeVersion = 0; - prn->discovery.MercuryVersion_0 = 0; - prn->discovery.MercuryVersion_1 = 0; - prn->discovery.MercuryVersion_2 = 0; - prn->discovery.MercuryVersion_3 = 0; - prn->discovery.PennyVersion = 0; - prn->discovery.MetisVersion = 0; - prn->discovery.numRxs = 0; - + prn->reset_on_disconnect = 0; // MI0BOT: Intialised to not reset on software disconnect + prn->swap_audio_channels = 0; // MI0BOT: Control to swap the left and right audio channels send over P1 + prbpfilter = (RBPFILTER)malloc0(sizeof(rbpfilter)); prbpfilter->bpfilter = 0; prbpfilter->enable = 1; diff --git a/Project Files/Source/ChannelMaster/network.c b/Project Files/Source/ChannelMaster/network.c index c7fbbc92..ed60133f 100644 --- a/Project Files/Source/ChannelMaster/network.c +++ b/Project Files/Source/ChannelMaster/network.c @@ -79,7 +79,7 @@ void DeInitMetisSockets() { } } -/* returns 0 on success, != 0 otherwise */ +/* returns 0 on success, != 0 otherwise */ // MI0BOT: Added remotePort to allow remote access to several HL2s by different port number PORT int nativeInitMetis(char* netaddr, int port, char* localaddr, int localport, int protocol, int model_id, int p2hw_uses_differnt_ports) { @@ -219,6 +219,8 @@ int nativeInitMetis(char* netaddr, int port, char* localaddr, int localport, int printf("destination addr: 0x%08x\n", DestIp); fflush(stdout); + //RemotePort = remotePort; // MI0BOT: Remote access over WAN using different port + memset(&MacAddr, 0xff, sizeof(MacAddr)); SendARP(DestIp, SrcIp, &MacAddr, &PhysAddrLen); return 0; @@ -344,21 +346,6 @@ int GetMetisIPAddr(void) { return MetisAddr; } -PORT -void GetMACAddr(unsigned char addr_bytes[]) { - memcpy(addr_bytes, prn->discovery.MACAddr, 6); -} - -PORT -void GetCodeVersion(unsigned char addr_bytes[]) { - memcpy(addr_bytes, &(prn->discovery.fwCodeVersion), 1); -} - -PORT -void GetBoardID(char addr_bytes[]) { - memcpy(addr_bytes, &(prn->discovery.BoardType), 1); -} - int SendStart(void) { prn->run = 1; CmdGeneral(); //1024 @@ -1450,7 +1437,19 @@ int IOThreadStop() { } io_keep_running = 0; // flag to stop - WaitForSingleObject(prn->hReadThreadMain, INFINITE); + if (HPSDRModel == HPSDRModel_HERMESLITE) + { + // MI0BOT: Thread locking up, so timeout added. + if (WAIT_TIMEOUT == WaitForSingleObject(prn->hReadThreadMain, 1000)) + { + // Thread has stopped, so let everybody know + IOThreadRunning = 0; + } + } + else + { + WaitForSingleObject(prn->hReadThreadMain, INFINITE); + } CloseHandle(prn->hReadThreadMain); CloseHandle(prn->hReadThreadInitSem); diff --git a/Project Files/Source/ChannelMaster/network.h b/Project Files/Source/ChannelMaster/network.h index c421cd1d..2c322ea3 100644 --- a/Project Files/Source/ChannelMaster/network.h +++ b/Project Files/Source/ChannelMaster/network.h @@ -37,6 +37,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define MAX_SYNC_RX (2) #define CACHE_ALIGN __declspec (align(16)) +// MI0BOT: For I2C use on HL2 +#define MAX_I2C_QUEUE (32) + #define MAX_IN_SEQ_LOG (40) #define MAX_IN_SEQ_SNAPSHOTS (20) @@ -103,6 +106,46 @@ typedef struct CACHE_ALIGN _radionet WSANETWORKEVENTS wsaProcessEvents; int hardware_LEDs; + int reset_on_disconnect; // MI0BOT: Reset on software disconnect + int swap_audio_channels; // MI0BOT: Control to swap the left and right audio channels send over P1 + + + struct _i2c // MI0BOT: I2C data structure for HL2 + { +#pragma pack(push, 1) + union + { + unsigned char i2c_control; + struct { + unsigned char ctrl_read : 1, // bit 00 + ctrl_stop : 1, // bit 01 + ctrl_request : 1, // bit 02 + ctrl_error : 1, // bit 03 + ctrl_read_available : 1, // bit 04 + : 1, // bit 05 + : 1, // bit 06 + : 1; // bit 07 + }; + }; +#pragma pack(pop) + +#pragma pack(push, 1) + struct { + unsigned char bus; + unsigned char address; + unsigned char control; + unsigned char write_data; + } i2c_queue[MAX_I2C_QUEUE]; +#pragma pack(pop) + + unsigned char in_index; + unsigned char out_index; + signed char delay; + + unsigned char returned_address; + unsigned char read_data[4]; + + } i2c; // puresignal settings int puresignal_run; @@ -218,6 +261,7 @@ typedef struct CACHE_ALIGN _radionet int frequency; int sampling_rate; int cwx; + int cwx_ptt; // MI0BOT: CWX enhancement for PTT on HL2 int dash; int dot; int ptt_out; @@ -229,6 +273,8 @@ typedef struct CACHE_ALIGN _radionet int epwm_max; int epwm_min; int pa; + int tx_latency; // MI0BOT: Delay in TX buffer + int ptt_hang; // MI0BOT: Delay before PTT drops out after TX buffer empties unsigned mic_in_seq_no; unsigned mic_in_seq_err; unsigned mic_out_seq_no; @@ -240,21 +286,6 @@ typedef struct CACHE_ALIGN _radionet int spp; // LR-samples per network packet } audio[MAX_AUDIO_STREAMS]; - struct _discovery - { - unsigned char MACAddr[6]; - char BoardType; - char protocolVersion; - char fwCodeVersion; - char MercuryVersion_0; - char MercuryVersion_1; - char MercuryVersion_2; - char MercuryVersion_3; - char PennyVersion; - char MetisVersion; - char numRxs; - } discovery; - } radionet, *RADIONET; RADIONET prn; @@ -408,6 +439,7 @@ int ApolloATU; int WSAinitialized; SOCKET listenSock; +int RemotePort; // MI0BOT: Allows different remote port for WAN access SYSTEMTIME lt; static const double const_1_div_2147483648_ = 1.0 / 2147483648.0; @@ -453,7 +485,9 @@ enum _RadioProtocol // Protocol 1 USB DWORD WINAPI MetisReadThreadMain(LPVOID n); void WriteMainLoop(char* bufp); +void WriteMainLoop_HL2(char* bufp); // MI0BOT: Different write loop for HL2 void MetisReadThreadMainLoop(void); +void MetisReadThreadMainLoop_HL2(void); // MI0BOT: Different read loop for HL2 DWORD WINAPI sendProtocol1Samples(LPVOID n); int MetisReadDirect(unsigned char* bufp); int MetisWriteFrame(int endpoint, char* bufp); diff --git a/Project Files/Source/ChannelMaster/networkproto1.c b/Project Files/Source/ChannelMaster/networkproto1.c index 6a1b4ff1..257b3421 100644 --- a/Project Files/Source/ChannelMaster/networkproto1.c +++ b/Project Files/Source/ChannelMaster/networkproto1.c @@ -249,7 +249,10 @@ DWORD WINAPI MetisReadThreadMain(LPVOID n) { ReleaseSemaphore(prn->hReadThreadInitSem, 1, NULL); printf("MetisReadThread runs...\n"); fflush(stdout); - MetisReadThreadMainLoop(); + if (HPSDRModel == HPSDRModel_HERMESLITE) // MI0BOT: Different read loop for HL2 + MetisReadThreadMainLoop_HL2(); + else + MetisReadThreadMainLoop(); IOThreadRunning = 0; printf("MetisReadThread dies...\n"); fflush(stdout); @@ -416,6 +419,172 @@ void MetisReadThreadMainLoop(void) } } +void MetisReadThreadMainLoop_HL2(void) +{ + mic_decimation_count = 0; + SeqError = 0; + // allocate buffers for I/O + FPGAReadBufp = (unsigned char*)calloc(1024, sizeof(unsigned char)); + FPGAWriteBufp = (char*)calloc(1024, sizeof(char)); + + ForceCandCFrame(3); // send 3 C&C frames + printf("iot: main loop starting\n"); fflush(stdout); + + prn->hDataEvent = WSACreateEvent(); + WSAEventSelect(listenSock, prn->hDataEvent, FD_READ); + PrintTimeHack(); + printf("- MetisReadThreadMainLoop()\n"); + fflush(stdout); + + while (io_keep_running != 0) + { + //MW0LGE_21g WSAWaitForMultipleEvents(1, &prn->hDataEvent, FALSE, WSA_INFINITE, FALSE); + //added similar timout code from ReadThreadMainLoop + DWORD retVal = WSAWaitForMultipleEvents(1, &prn->hDataEvent, FALSE, prn->wdt ? 3000 : WSA_INFINITE, FALSE); + if ((retVal == WSA_WAIT_FAILED) || (retVal == WSA_WAIT_TIMEOUT)) + { + HaveSync = 0; //send console LOS + destroy_pro(prop); + prop = NULL; // this needed bacause of a change to ForceReset in setup.cs + continue; + } + else + { + WSAEnumNetworkEvents(listenSock, prn->hDataEvent, &prn->wsaProcessEvents); + if (prn->wsaProcessEvents.lNetworkEvents & FD_READ) + { + if (prn->wsaProcessEvents.iErrorCode[FD_READ_BIT] != 0) + { + printf("FD_READ failed with error %d\n", + prn->wsaProcessEvents.iErrorCode[FD_READ_BIT]); + break; + } + + MetisReadDirect(FPGAReadBufp); + + { + int frame, cb, isamp; + int isample, iddc, spr; + unsigned char* bptr; + int mic_sample_count; + for (frame = 0; frame < 2; frame++) + { + bptr = FPGAReadBufp + 512 * frame; + if ((bptr[0] == 0x7f) && (bptr[1] == 0x7f) && (bptr[2] == 0x7f)) + { + for (cb = 0; cb < 5; cb++) + ControlBytesIn[cb] = bptr[cb + 3]; + + if (ControlBytesIn[0] & 0x80) + { + if (0x3f == prn->i2c.returned_address) + { + prn->i2c.ctrl_error = 1; + } + else + { + prn->i2c.read_data[0] = ControlBytesIn[1]; + prn->i2c.read_data[1] = ControlBytesIn[2]; + prn->i2c.read_data[2] = ControlBytesIn[3]; + prn->i2c.read_data[3] = ControlBytesIn[4]; + + prn->i2c.ctrl_read_available = 1; + } + } + else + { + prn->ptt_in = ControlBytesIn[0] & 0x1; + prn->dash_in = (ControlBytesIn[0] << 1) & 0x1; + prn->dot_in = (ControlBytesIn[0] << 2) & 0x1; + switch (ControlBytesIn[0] & 0xf8) + { + case 0x00: // C0 0000 0000 + prn->adc[0].adc_overload = ControlBytesIn[1] & 0x01; + prn->user_dig_in = ((ControlBytesIn[1] >> 1) & 0xf); + break; + case 0x08: // C0 0000 1xxx + prn->tx[0].exciter_power = ((ControlBytesIn[1] << 8) & 0xff00) | (((int)(ControlBytesIn[2])) & 0xff); // (AIN5) drive power + prn->tx[0].fwd_power = ((ControlBytesIn[3] << 8) & 0xff00) | (((int)(ControlBytesIn[4])) & 0xff); // (AIN1) PA coupler + PeakFwdPower((float)(prn->tx[0].fwd_power)); + break; + case 0x10: // C0 0001 0xxx + prn->tx[0].rev_power = ((ControlBytesIn[1] << 8) & 0xff00) | (((int)(ControlBytesIn[2])) & 0xff); // (AIN2) PA reverse power + PeakRevPower((float)(prn->tx[0].rev_power)); + prn->user_adc0 = ((ControlBytesIn[3] << 8) & 0xff00) | (((int)(ControlBytesIn[4])) & 0xff); // AIN3 MKII PA Volts + break; + case 0x18: // C0 0001 1xxx + prn->user_adc1 = ((ControlBytesIn[1] << 8) & 0xff00) | (((int)(ControlBytesIn[2])) & 0xff); // AIN4 MKII PA Amps + prn->supply_volts = ((ControlBytesIn[3] << 8) & 0xff00) | (((int)(ControlBytesIn[4])) & 0xff); // AIN6 Hermes Volts + break; + case 0x20: // C0 0010 0xxx + prn->adc[0].adc_overload = ControlBytesIn[1] & 1; + prn->adc[1].adc_overload = (ControlBytesIn[2] & 1) << 1; + prn->adc[2].adc_overload = (ControlBytesIn[3] & 1) << 2; + break; + } + } + + spr = 504 / (6 * nddc + 2); // samples per ddc + for (iddc = 0; iddc < nddc; iddc++) // 'nddc' is the number of DDCs running + { + for (isample = 0; isample < spr; isample++) + { + int k = 8 + isample * (6 * nddc + 2) + iddc * 6; + prn->RxBuff[iddc][2 * isample + 0] = const_1_div_2147483648_ * + (double)(bptr[k + 0] << 24 | + bptr[k + 1] << 16 | + bptr[k + 2] << 8); + prn->RxBuff[iddc][2 * isample + 1] = const_1_div_2147483648_ * + (double)(bptr[k + 3] << 24 | + bptr[k + 4] << 16 | + bptr[k + 5] << 8); + } + } + // WriteAudio(30.0, 48000, spr, prn->RxBuff[0], 3); + switch (nddc) + { + case 2: + twist(spr, 0, 1, 0); + break; + case 4: + xrouter(0, 0, 0, spr, prn->RxBuff[0]); + twist(spr, 2, 3, 1); + xrouter(0, 0, 2, spr, prn->RxBuff[1]); + break; + case 5: + twist(spr, 0, 1, 0); + twist(spr, 3, 4, 1); + xrouter(0, 0, 2, spr, prn->RxBuff[2]); + break; + } + mic_sample_count = 0; + + for (isamp = 0; isamp < spr; isamp++) // for each set of samples + { + int k = 8 + nddc * 6 + isamp * (2 + nddc * 6); + + mic_decimation_count++; + if (mic_decimation_count == mic_decimation_factor) + { + mic_decimation_count = 0; + prn->TxReadBufp[2 * mic_sample_count + 0] = const_1_div_2147483648_ * + (double)(bptr[k + 0] << 24 | + bptr[k + 1] << 16); + prn->TxReadBufp[2 * mic_sample_count + 1] = 0.0; + + mic_sample_count++; + } + } + + Inbound(inid(1, 0), mic_sample_count, prn->TxReadBufp); + } + } + } + } + } + } +} + void WriteMainLoop(char* bufp) { // now attempt to TX if there is a frame of data to send @@ -697,6 +866,341 @@ void WriteMainLoop(char* bufp) ReleaseSemaphore(prn->hobbuffsRun[1], 1, 0); } +void WriteMainLoop_HL2(char* bufp) +{ + // now attempt to TX if there is a frame of data to send + int txframe; + unsigned char C0 = 0, C1 = 0, C2 = 0, C3 = 0, C4 = 0; + unsigned char CWMode; + char* txbptr; + int ddc_freq; + // create 2 USB frames + for (txframe = 0; txframe < 2; txframe++) + { + txbptr = FPGAWriteBufp + 512 * txframe; + txbptr[0] = 0x7f; // add the 3 sync bytes + txbptr[1] = 0x7f; + txbptr[2] = 0x7f; + + // if TX/RX has changed we need to change the DDC0 frequency for Hermes-II; so jump to that C&C next + if (XmitBit != PreviousTXBit) + { + if (nddc == 2) + out_control_idx = 2; + PreviousTXBit = XmitBit; + } + + // add the 5 control bytes: get inc TX bit + // "C0=0" used to be sent often, but will rarely be changed + // so it is now sent at the same rate as everything else + C0 = (unsigned char)XmitBit; + + if (0 != prn->i2c.delay) + { + prn->i2c.delay--; + } + + if ((0 >= --prn->i2c.delay) && + (prn->i2c.in_index != prn->i2c.out_index)) + { + prn->i2c.delay = 5; + + // The IN and OUT indexes are not the same, so there is data for transmission + + unsigned char next = prn->i2c.out_index + 1 >= MAX_I2C_QUEUE ? 0 : prn->i2c.out_index + 1; + + if (0 == prn->i2c.i2c_queue[next].bus) + { + C0 |= (0x3c << 1) | (prn->i2c.ctrl_request << 7); //I2C1 0x3c + } + else + { + C0 |= (0x3d << 1) | (prn->i2c.ctrl_request << 7); //I2C1 0x3d + } + + unsigned char address = prn->i2c.i2c_queue[next].address; + + if (0x7f < address) + { + address = address >> 1; + } + + C2 = 0x80 | address; // Stop request + + if (prn->i2c.ctrl_read) + { + C1 = 0x07; + } + else + { + C1 = 0x06; + } + + C3 = prn->i2c.i2c_queue[next].control; + C4 = prn->i2c.i2c_queue[next].write_data; + + prn->i2c.out_index = next; + } + else + { + switch (out_control_idx) // now m=pick the frame of control bytes + { + case 0: // C0=0: general settings + C1 = (SampleRateIn2Bits & 3); + C2 = (prn->cw.eer & 1) | ((prn->oc_output << 1) & 0xFE); + C3 = (prbpfilter->_10_dB_Atten & 1) | ((prbpfilter->_20_dB_Atten << 1) & 2) | + ((prn->rx[0].preamp << 2) & 0b00000100) | ((prn->adc[0].dither << 3) & 0b00001000) | + ((prn->adc[0].random << 4) & 0b00010000) | ((prbpfilter->_Rx_1_Out << 7) & 0b10000000); + if (prbpfilter->_XVTR_Rx_In) + C3 |= 0b01100000; + else if (prbpfilter->_Rx_1_In) + C3 |= 0b00100000; + else if (prbpfilter->_Rx_2_In) + C3 |= 0b01000000; + + if (prbpfilter->_ANT_3 == 1) + C4 = 0b10; + else if (prbpfilter->_ANT_2 == 1) + C4 = 0b01; + else + C4 = 0b0; + C4 |= 0b00000100; // duplex bit /* Should be assigned */ + C4 |= (nddc - 1) << 3; // number of DDCs to run + C4 |= (P1_en_diversity) << 7; // if diversity, locks VFOs + break; + + // the frequency assignments will need to change + // when we work out a mapping for the ADC channels + case 1: //TX VFO 0x01 + C0 |= 2; + C1 = (prn->tx[0].frequency >> 24) & 0xff; // byte 0 of tx freq + C2 = (prn->tx[0].frequency >> 16) & 0xff; // byte 1 of tx freq + C3 = (prn->tx[0].frequency >> 8) & 0xff; // byte 2 of tx freq + C4 = (prn->tx[0].frequency) & 0xff; // byte 3 of tx freq + break; + + case 2: //RX1 VFO (DDC0) 0x02 + C0 |= 4; + // DDC0 is always RX0 freqency, except if Puresignal TX with hermes-II + if ((nddc == 2) && (XmitBit == 1) && (prn->puresignal_run)) + ddc_freq = prn->tx[0].frequency; + else + ddc_freq = prn->rx[0].frequency; + C1 = (ddc_freq >> 24) & 0xff; // byte 0 of rx1 freq + C2 = (ddc_freq >> 16) & 0xff; // byte 1 of rx1 freq + C3 = (ddc_freq >> 8) & 0xff; // byte 2 of rx1 freq + C4 = (ddc_freq) & 0xff; // byte 3 of rx1 freq + break; + + case 3: //RX2 VFO (DDC1) 0x03 + C0 |= 6; + // DDC1 is TX freq if Hermes-II && TX && Puresignal; + // RX1 freq if Orion; + // else RX2 freq if Hermes + if ((nddc == 2) && (XmitBit == 1) && (prn->puresignal_run)) + ddc_freq = prn->tx[0].frequency; + else if (nddc == 5) + ddc_freq = prn->rx[0].frequency; + else + 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 + C4 = (ddc_freq) & 0xff; // byte 3 of rx2 freq + break; + + // ADC assignments hardwired according to the configuration (see spreadsheet) + // orion: taken from setup form + // Hermes/Hermes-E don't use this data + case 4: // ADC assignments & ADC Tx ATT 0x0e + C0 |= 0x1c; //C0 0001 110x + C1 = P1_adc_cntrl & 0xFF; + C2 = (P1_adc_cntrl >> 8) & 0b0011111111; + C3 = prn->adc[0].tx_step_attn & 0b00011111; + C4 = 0; + break; + + case 5: //RX3 VFO (DDC2) 0x04 + C0 |= 8; + // if Orion, DDC2 is RX2 frequency; else TX frequency for Hermes + if (nddc == 5) + ddc_freq = prn->rx[3].frequency; + else + ddc_freq = prn->tx[0].frequency; + C1 = (ddc_freq >> 24) & 0xff; // byte 0 of rx3 freq + C2 = (ddc_freq >> 16) & 0xff; // byte 1 of rx3 freq + C3 = (ddc_freq >> 8) & 0xff; // byte 2 of rx3 freq + C4 = (ddc_freq) & 0xff; // byte 3 of rx3 freq + break; + + case 6: //RX4 VFO (DDC3) 0x05 + C0 |= 0x0a; + // DDC3 is TX frequency always + ddc_freq = prn->tx[0].frequency; + C1 = (ddc_freq >> 24) & 0xff; // byte 0 of rx4 freq + C2 = (ddc_freq >> 16) & 0xff; // byte 1 of rx4 freq + C3 = (ddc_freq >> 8) & 0xff; // byte 2 of rx4 freq + C4 = (ddc_freq) & 0xff; // byte 3 of rx4 freq + break; + + case 7: //RX5 VFO (DDC4) 0x06 + C0 |= 0x0c; + // DDC4 is TX frequency for Orion2 TX with puresignal, otherwise not used, so make TX always + ddc_freq = prn->tx[0].frequency; + C1 = (ddc_freq >> 24) & 0xff; // byte 0 of rx5 freq + C2 = (ddc_freq >> 16) & 0xff; // byte 1 of rx5 freq + C3 = (ddc_freq >> 8) & 0xff; // byte 2 of rx5 freq + C4 = (ddc_freq) & 0xff; // byte 3 of rx5 freq + break; + + case 8: //RX6 VFO 0x07 + C0 |= 0x0e; + // DDC5 not used + ddc_freq = prn->rx[0].frequency; + C1 = (ddc_freq >> 24) & 0xff; // byte 0 of rx6 freq + C2 = (ddc_freq >> 16) & 0xff; // byte 1 of rx6 freq + C3 = (ddc_freq >> 8) & 0xff; // byte 2 of rx6 freq + C4 = (ddc_freq) & 0xff; // byte 3 of rx6 freq + break; + + case 9: //RX7 VFO 0x08 + C0 |= 0x10; + // DDC6 not used + ddc_freq = prn->rx[0].frequency; + C1 = (ddc_freq >> 24) & 0xff; // byte 0 of rx7 freq + C2 = (ddc_freq >> 16) & 0xff; // byte 1 of rx7 freq + C3 = (ddc_freq >> 8) & 0xff; // byte 2 of rx7 freq + C4 = (ddc_freq) & 0xff; // byte 3 of rx7 freq + break; + + case 10: // 0x09 + C0 |= 0x12; //C0 0001 001x + C1 = prn->tx[0].drive_level; // SWR adjustment before this in SetOutputPowerFactor() + C2 = ((prn->mic.mic_boost & 1) | ((prn->mic.line_in & 1) << 1) | ApolloFilt | + ApolloTuner | ApolloATU | ApolloFiltSelect | 0b01000000) & 0x7f; + C3 = (prbpfilter->_13MHz_HPF & 1) | ((prbpfilter->_20MHz_HPF & 1) << 1) | + ((prbpfilter->_9_5MHz_HPF & 1) << 2) | ((prbpfilter->_6_5MHz_HPF & 1) << 3) | + ((prbpfilter->_1_5MHz_HPF & 1) << 4) | ((prbpfilter->_Bypass & 1) << 5) | + ((prbpfilter->_6M_preamp & 1) << 6) | ((prn->tx[0].pa & 1) << 7); + C4 = (prbpfilter->_30_20_LPF & 1) | ((prbpfilter->_60_40_LPF & 1) << 1) | + ((prbpfilter->_80_LPF & 1) << 2) | ((prbpfilter->_160_LPF & 1) << 3) | + ((prbpfilter->_6_LPF & 1) << 4) | ((prbpfilter->_12_10_LPF & 1) << 5) | + ((prbpfilter->_17_15_LPF & 1) << 6); + break; + + case 11: //Preamp control 0x0a + C0 |= 0x14; //C0 0001 010x + C1 = (prn->rx[0].preamp & 1) | ((prn->rx[1].preamp & 1) << 1) | + ((prn->rx[2].preamp & 1) << 2) | ((prn->rx[0].preamp & 1) << 3) | + ((prn->mic.mic_trs & 1) << 4) | ((prn->mic.mic_bias & 1) << 5) | + ((prn->mic.mic_ptt & 1) << 6); + C2 = (prn->mic.line_in_gain & 0b00011111) | ((prn->puresignal_run & 1) << 6); + C3 = prn->user_dig_out & 0b00001111; + if (XmitBit) + C4 = (prn->adc[0].tx_step_attn & 0b00111111) | 0b01000000; // Larger range for the HL2 attenuator + else + C4 = (prn->adc[0].rx_step_attn & 0b00111111) | 0b01000000; // Larger range for the HL2 attenuator + break; + + case 12: // Step ATT control 0x0b + C0 |= 0x16; //C0 0001 011x + if (XmitBit) + C1 = 0x1F; + else + C1 = (prn->adc[1].rx_step_attn); + C1 |= 0b00100000; + C2 = (prn->adc[2].rx_step_attn & 0b00011111) | 0b00100000 | + ((prn->cw.rev_paddle & 1) << 6); + + if (prn->cw.iambic == 0) + CWMode = 0b00000000; + else if (prn->cw.mode_b == 0) + CWMode = 0b01000000; + else + CWMode = 0b10000000; + C3 = (prn->cw.keyer_speed & 0b00111111) | CWMode; + C4 = (prn->cw.keyer_weight & 0b01111111) | ((prn->cw.strict_spacing) << 7); + break; + + // 0x18, 1A are reserved + + case 13: // CW 0x0f + C0 |= 0x1e; //C0 0001 111x + C1 = prn->cw.cw_enable; + C2 = prn->cw.sidetone_level; + C3 = prn->cw.rf_delay; + C4 = 0; + break; + + case 14: // CW 0x10 + C0 |= 0x20; //C0 0010 000x + C1 = (prn->cw.hang_delay >> 2) & 0b11111111; + C2 = (prn->cw.hang_delay & 0b00000011); + C3 = (prn->cw.sidetone_freq >> 4) & 0b11111111; + C4 = (prn->cw.sidetone_freq) & 0b00001111; + break; + + case 15: // EER PWM 0x11 + C0 |= 0x22; //C0 0010 001x + C1 = (prn->tx[0].epwm_min >> 2) & 0b11111111; + C2 = (prn->tx[0].epwm_min & 0b00000011); + C3 = (prn->tx[0].epwm_max >> 2) & 0b11111111; + C4 = (prn->tx[0].epwm_max & 0b00000011); + break; + + case 16: // BPF2 0x12 + C0 |= 0x24; //C0 0010 010x + C1 = (prbpfilter2->_13MHz_HPF & 1) | ((prbpfilter2->_20MHz_HPF & 1) << 1) | + ((prbpfilter2->_9_5MHz_HPF & 1) << 2) | ((prbpfilter2->_6_5MHz_HPF & 1) << 3) | + ((prbpfilter2->_1_5MHz_HPF & 1) << 4) | ((prbpfilter2->_Bypass & 1) << 5) | + ((prbpfilter2->_6M_preamp & 1) << 6) | ((prbpfilter2->_rx2_gnd) << 7); + C2 = (xvtr_enable & 1) | ((prn->puresignal_run & 1) << 6); + C3 = 0; + C4 = 0; + break; + + case 17: // TX latency and PTT hang 0x17 + C0 |= 0x2e; //C0 0010 111x + C1 = 0; + C2 = 0; + C3 = (prn->tx[0].ptt_hang & 0b00011111); + C4 = (prn->tx[0].tx_latency & 0b01111111); + break; + + case 18: // Reset on disconnect 0x3a + C0 |= 0x74; //C0 0111 010x + C1 = 0; + C2 = 0; + C3 = 0; + C4 = prn->reset_on_disconnect; + break; + + } + + if (out_control_idx < 18) // ready for next USB frame + out_control_idx++; + else + out_control_idx = 0; + } + + txbptr[3] = C0; // add the C0-C4 bytes to USB frame + txbptr[4] = C1; + txbptr[5] = C2; + txbptr[6] = C3; + txbptr[7] = C4; + } + + // now add the data for the two USB frames + memcpy(FPGAWriteBufp + 8, bufp, sizeof(char) * 8 * 63); // add LRIQ to frame 1 + memcpy(FPGAWriteBufp + 520, bufp + 504, sizeof(char) * 8 * 63); // add LRIQ to frame 2 + + // we created 2 USB frames, so send them + MetisWriteFrame(0x02, FPGAWriteBufp); + ReleaseSemaphore(prn->hobbuffsRun[0], 1, 0); + ReleaseSemaphore(prn->hobbuffsRun[1], 1, 0); +} + + DWORD WINAPI sendProtocol1Samples(LPVOID n) { DWORD taskIndex = 0; @@ -723,12 +1227,17 @@ DWORD WINAPI sendProtocol1Samples(LPVOID n) if (!XmitBit) memset(prn->outIQbufp, 0, sizeof(complex) * 126); // WriteAudio (30.0, 48000, 126, prn->outIQbufp, 3); // WriteAudio (60.0, 48000, 126, prn->outLRbufp, 3); - for (i = 0; i < 4 * 63; i += 2) // swap L & R audio; firmware bug fix + + if (prn->swap_audio_channels) // To cater for different firmware at the hardware, allow control of audio channels swapping { - swap = pbuffs[0][i + 0]; - pbuffs[0][i + 0] = pbuffs[0][i + 1]; - pbuffs[0][i + 1] = swap; + 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 @@ -736,13 +1245,23 @@ DWORD WINAPI sendProtocol1Samples(LPVOID n) 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); if (prn->cw.cw_enable && j == 1) - temp = (prn->tx[0].dot << 2 | - prn->tx[0].dash << 1 | - prn->tx[0].cwx) & 0b00000111; + if (HPSDRModel == HPSDRModel_HERMESLITE) + temp = (prn->tx[0].cwx_ptt << 3 | // MI0BOT: Bit 3 in HL2 is used to signal PTT for CWX + prn->tx[0].dot << 2 | + prn->tx[0].dash << 1 | + prn->tx[0].cwx) & 0b00001111; + else + temp = (prn->tx[0].dot << 2 | + prn->tx[0].dash << 1 | + prn->tx[0].cwx) & 0b00000111; 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); + + if (HPSDRModel == HPSDRModel_HERMESLITE) // MI0BOT: Different write loop for HL2 + WriteMainLoop_HL2(prn->OutBufp); + else + WriteMainLoop(prn->OutBufp); } return 0; } diff --git a/Project Files/Source/Console/Andromeda/Andromeda.cs b/Project Files/Source/Console/Andromeda/Andromeda.cs index 4ae9201e..5f3ef79e 100644 --- a/Project Files/Source/Console/Andromeda/Andromeda.cs +++ b/Project Files/Source/Console/Andromeda/Andromeda.cs @@ -4152,7 +4152,24 @@ private void SelectModeDependentPanel() //slow down, perhaps z-order fighting, not sure. ~1-3 seconds taken to get through //this function, changing from digi to something else. //Hidden controls are still returned in this.Controls so will still be saved out ok - switch (RX1DSPMode) + + + // MI0BOT: Make the panel based on mode of the current transmit VFO + DSPMode currentMode; + + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + { + if (chkVFOBTX.Checked) + currentMode = RX2DSPMode; + else + currentMode = RX1DSPMode; + } + else + { + currentMode = RX1DSPMode; + } + + switch (currentMode) { case DSPMode.LSB: case DSPMode.USB: diff --git a/Project Files/Source/Console/CAT/CATCommands.cs b/Project Files/Source/Console/CAT/CATCommands.cs index 83e5f9c4..5d20b4c9 100644 --- a/Project Files/Source/Console/CAT/CATCommands.cs +++ b/Project Files/Source/Console/CAT/CATCommands.cs @@ -18,7 +18,7 @@ // // You may contact the author via email at: k5kdn@arrl.net //================================================================= -// Continual modifications Copyright (C) 2019-2025 Richard Samphire (MW0LGE) +// Continual modifications Copyright (C) 2019-2025 Richard Samphire (MW0LGE) /* Modifications to support the Behringer Midi controllers by Chris Codella, W2PA, April 2017. Indicated by //-W2PA comment lines. @@ -34,8 +34,8 @@ Modifications to support the Behringer Midi controllers using System.Globalization; using System.Collections.Generic; using System.Windows.Forms; -using System.Runtime.InteropServices; - +using System.Runtime.InteropServices; + namespace Thetis { /// @@ -51,8 +51,8 @@ public class CATCommands private Band[] BandList; private int LastBandIndex; private readonly ASCIIEncoding AE = new ASCIIEncoding(); - - public bool Verbose { get; set; } = false; + + public bool Verbose { get; set; } = false; private readonly int NCATInit = 500; private int NCATs = 0; private readonly int NCATtime = 50; @@ -362,7 +362,12 @@ public string IF() // temp = " "; string f = ZZFA(""); - if(f.Length > 11) + + // MI0BOT: Redirect CAT to VFO B + if (console.CATtoVFOB && HardwareSpecific.Model == HPSDRModel.HERMESLITE) + f = ZZFB(""); + + if (f.Length > 11) { f = f.Substring(f.Length-11,11); } @@ -373,10 +378,15 @@ public string IF() rtn += rit; // RIT status 1 byte rtn += xit; // XIT status 1 byte rtn += "000"; // dummy for memory bank 3 bytes - rtn += tx; // tx-rx status 1 byte - // rtn += temp; -// rtn += Mode2KString(console.RX1DSPMode); // current mode 1 bytes - tempmode = Mode2KString(console.RX1DSPMode); + rtn += tx; // tx-rx status 1 byte + // rtn += temp; + // rtn += Mode2KString(console.RX1DSPMode); // current mode 1 bytes + // MI0BOT: Redirect CAT to VFO B + if (console.CATtoVFOB && HardwareSpecific.Model == HPSDRModel.HERMESLITE) + tempmode = Mode2KString(console.RX2DSPMode); + else + tempmode = Mode2KString(console.RX1DSPMode); + if(tempmode == "?;") rtn += "2"; else @@ -582,8 +592,11 @@ public string MD(string s) } else if(s.Length == parser.nGet) { - - return Mode2KString(console.RX1DSPMode); + // MI0BOT: Redirect CAT to VFO B + if (console.CATtoVFOB && HardwareSpecific.Model == HPSDRModel.HERMESLITE) + return Mode2KString(console.RX2DSPMode); + else + return Mode2KString(console.RX1DSPMode); } else @@ -890,9 +903,9 @@ public string SL(string s) { return parser.Error1; } - } - - // Reads the S Meter value //TODO modify to consider console.S9Frequency + } + + // Reads the S Meter value //TODO modify to consider console.S9Frequency public string SM(string s) { int sm = 0; @@ -1107,8 +1120,8 @@ public string ZZAB(string s) //Sets or reads the console step size (also see zzst(read only) public string ZZAC(string s) - { - int step; + { + int step; if (s.Length == parser.nSet) { step = Convert.ToInt32(s); @@ -1218,8 +1231,8 @@ public string ZZAG(string s) return parser.Error1; // return a ? } - } - + } + public string ZZAI(string s) { if(console.SetupForm.AllowFreqBroadcast) @@ -1285,7 +1298,7 @@ public string ZZAR(string s) if (s.Length == parser.nSet) { - if (console.RF != n && console.AutoAGCRX1) console.AutoAGCRX1 = false; // turn off 'auto agc' only if different MW0LGE_21k8 + if (console.RF != n && console.AutoAGCRX1) console.AutoAGCRX1 = false; // turn off 'auto agc' only if different MW0LGE_21k8 console.RF = n; console.TitleBarEncoderString = "RX1 AGC Threshold = " + n; return ""; @@ -1322,8 +1335,8 @@ public string ZZAS(string s) } if (s.Length == parser.nSet) - { - if (console.RX2RF != n && console.AutoAGCRX2) console.AutoAGCRX2 = false; // turn off 'auto agc' only if different MW0LGE_21k8 + { + if (console.RX2RF != n && console.AutoAGCRX2) console.AutoAGCRX2 = false; // turn off 'auto agc' only if different MW0LGE_21k8 console.RX2RF = n; console.TitleBarEncoderString = "RX2 AGC Threshold = " + n; return ""; @@ -1395,8 +1408,8 @@ public string ZZAU(string s) } else return parser.Error1; - } - + } + public string ZZAY(string s) // AFP tYpe { int n = 0; @@ -1416,14 +1429,14 @@ public string ZZAY(string s) // AFP tYpe } else if (s.Length == parser.nGet) { - x = console.APFType; + x = console.APFType; return x.ToString(); } else { return parser.Error1; } - } + } //Moves the RX2 bandswitch down one band @@ -1613,9 +1626,9 @@ public string ZZBT(string s) return Band2String(console.RX2Band); } else if (s.Length == parser.nSet) - { - Band b = String2Band(s); - + { + Band b = String2Band(s); + console.RX2Band = b; console.SetupRX2Band(b); // MW0LGE_21g return ""; @@ -1635,12 +1648,12 @@ public string ZZBU() //Shuts down the console public string ZZBY() { - if (console.InvokeRequired) //[2.10.3.6]MW0LGE Fixes #460 - needed as Midi is from another thread - { - console.BeginInvoke(new MethodInvoker(() => - { - console.Close(); - })); + if (console.InvokeRequired) //[2.10.3.6]MW0LGE Fixes #460 - needed as Midi is from another thread + { + console.BeginInvoke(new MethodInvoker(() => + { + console.Close(); + })); } else console.Close(); @@ -1649,25 +1662,25 @@ public string ZZBY() // Sets or reads the CW Break In Enabled checkbox public string ZZCB(string s) - { - if (s.Length == parser.nSet && (s == "0" || s == "1")) - { - console.CATBreakIn = Convert.ToInt32(s); - return ""; - } - else if (s.Length == parser.nGet) - { - return console.CATBreakIn.ToString(); - } - else - { - return parser.Error1; - } - - } - - - // Sets or reads the CW Break In Delay + { + if (s.Length == parser.nSet && (s == "0" || s == "1")) + { + console.CATBreakIn = Convert.ToInt32(s); + return ""; + } + else if (s.Length == parser.nGet) + { + return console.CATBreakIn.ToString(); + } + else + { + return parser.Error1; + } + + } + + + // Sets or reads the CW Break In Delay public string ZZCD(string s) { int n = 0; @@ -1907,8 +1920,8 @@ public string ZZCT(string s) if(s != null && s != "") n = Convert.ToInt32(s); n = Math.Max(console.CPDRMin, n); //[2.10.3.6]MW0LGE was 0 - n = Math.Min(console.CPDRMax, n); //was 20 - + n = Math.Min(console.CPDRMax, n); //was 20 + if (s.Length == parser.nSet) { console.CPDRLevel = n; @@ -1927,9 +1940,9 @@ public string ZZCT(string s) // Reads the CPU Usage public string ZZCU() - { - //return parser.Error1; - if (console.initializing) return ""; + { + //return parser.Error1; + if (console.initializing) return ""; return String.Format("{0:000.00}", console.CPUPercSmoothed); } @@ -2127,9 +2140,9 @@ public string ZZDG(string s) } else return parser.Error1; - } - - //Sets or reads the Diversity Form RX Source radio buttons + } + + //Sets or reads the Diversity Form RX Source radio buttons public string ZZDH(string s) { if (s.Length == parser.nSet) @@ -2464,35 +2477,35 @@ public string ZZDX(string s) } else return parser.Error1; - } - - //MW0LGE_22b - ////Reads or sets the DX threshold - //public string ZZDY(string s) - //{ - // int n = 0; - - // if (s != null && s != "") - // n = Convert.ToInt32(s); - // n = Math.Max(0, n); - // n = Math.Min(10, n); - - // if (s.Length == parser.nSet) - // { - // console.DXLevel = n; - // return ""; - // } - // else if (s.Length == parser.nGet) - // { - // return AddLeadingZeros((int)console.DXLevel); - // } - // else - // { - // return parser.Error1; - // } - - //} - + } + + //MW0LGE_22b + ////Reads or sets the DX threshold + //public string ZZDY(string s) + //{ + // int n = 0; + + // if (s != null && s != "") + // n = Convert.ToInt32(s); + // n = Math.Max(0, n); + // n = Math.Min(10, n); + + // if (s.Length == parser.nSet) + // { + // console.DXLevel = n; + // return ""; + // } + // else if (s.Length == parser.nGet) + // { + // return AddLeadingZeros((int)console.DXLevel); + // } + // else + // { + // return parser.Error1; + // } + + //} + /// /// Reads or sets the RX equalizer. /// The CAT suffix string is 36 characters constant. @@ -2662,17 +2675,17 @@ public string ZZFA(string s) f -= Convert.ToInt32(console.SetupForm.RttyOffsetHigh); else if(console.RX1DSPMode == DSPMode.DIGL) f += Convert.ToInt32(console.SetupForm.RttyOffsetLow); - s = AddLeadingZeros(f, 11); // [2.10.3.12]MW0LGE -- addleadingzeros uses parser.nAns which will be 0 as we might not be - // parsing anything here, ie being called directly from midi - // Changed to pass optional padding length, use 11 + s = AddLeadingZeros(f, 11); // [2.10.3.12]MW0LGE -- addleadingzeros uses parser.nAns which will be 0 as we might not be + // parsing anything here, ie being called directly from midi + // Changed to pass optional padding length, use 11 s = s.Insert(5, separator); } else - s = s.Insert(5, separator); - - if (!isMidi && console.CATChangesCenterFreq) // MW0LGE changed to take into consideration the flag - { - console.UpdateCenterFreq = true; + s = s.Insert(5, separator); + + if (!isMidi && console.CATChangesCenterFreq) // MW0LGE changed to take into consideration the flag + { + console.UpdateCenterFreq = true; } console.VFOAFreq = double.Parse(s); @@ -2703,8 +2716,8 @@ public string ZZFB(string s) { if(s.Length == parser.nSet) { - DSPMode vfoBmode = console.RX2Enabled ? console.RX2DSPMode : console.RX1DSPMode; //[2.10.3.12]MW0LGE might be a good idea to use RX2 mode if RX2 enabled. - //probably other places in this cat command code with similar issues + DSPMode vfoBmode = console.RX2Enabled ? console.RX2DSPMode : console.RX1DSPMode; //[2.10.3.12]MW0LGE might be a good idea to use RX2 mode if RX2 enabled. + //probably other places in this cat command code with similar issues if (console.SetupForm.RttyOffsetEnabledB && (vfoBmode == DSPMode.DIGU || vfoBmode == DSPMode.DIGL)) { @@ -2712,26 +2725,26 @@ public string ZZFB(string s) if(vfoBmode == DSPMode.DIGU) f -= Convert.ToInt32(console.SetupForm.RttyOffsetHigh); else if(vfoBmode == DSPMode.DIGL) - f += Convert.ToInt32(console.SetupForm.RttyOffsetLow); - s = AddLeadingZeros(f, 11); // [2.10.3.12]MW0LGE -- addleadingzeros uses parser.nAns which will be 0, as we might not be - // parsing anything here, ie being called directly from midi - // Changed to pass optional padding length, use 11 + f += Convert.ToInt32(console.SetupForm.RttyOffsetLow); + s = AddLeadingZeros(f, 11); // [2.10.3.12]MW0LGE -- addleadingzeros uses parser.nAns which will be 0, as we might not be + // parsing anything here, ie being called directly from midi + // Changed to pass optional padding length, use 11 s = s.Insert(5, separator); } else - s = s.Insert(5, separator); - - if (!isMidi2 && console.CATChangesCenterFreq) // MW0LGE changed to take into consideration the flag - { - console.UpdateRX2CenterFreq = true; + s = s.Insert(5, separator); + + if (!isMidi2 && console.CATChangesCenterFreq) // MW0LGE changed to take into consideration the flag + { + console.UpdateRX2CenterFreq = true; } console.VFOBFreq = double.Parse(s); return ""; } else if(s.Length == parser.nGet) - { - DSPMode vfoBmode = console.RX2Enabled ? console.RX2DSPMode : console.RX1DSPMode; //[2.10.3.12]MW0LGE as above + { + DSPMode vfoBmode = console.RX2Enabled ? console.RX2DSPMode : console.RX1DSPMode; //[2.10.3.12]MW0LGE as above if (console.SetupForm.RttyOffsetEnabledB && (vfoBmode == DSPMode.DIGU || vfoBmode == DSPMode.DIGL)) @@ -2748,8 +2761,8 @@ public string ZZFB(string s) } else return parser.Error1; - } - //Sets or reads TX frequency + } + //Sets or reads TX frequency public string ZZFT(string s) { if (s.Length == parser.nSet) @@ -2765,9 +2778,9 @@ public string ZZFT(string s) else return parser.Error1; - } - - //Selects or reads the FM deviation radio button + } + + //Selects or reads the FM deviation radio button public string ZZFD(string s) { if (s.Length == parser.nSet) @@ -4067,10 +4080,10 @@ public string ZZZU(string s) } else return parser.Error1; - } - - //Andromeda front panel s/w version - //write only + } + + //Andromeda front panel s/w version + //write only public string ZZZS(string s) { if (s.Length == parser.nSet) @@ -4135,11 +4148,11 @@ public string ZZZA(string s) } else return parser.Error1; - } - - // - //ARIES ATU tune state message - //write only + } + + // + //ARIES ATU tune state message + //write only public string ZZOX(string s) { if (s.Length == parser.nSet) @@ -4155,9 +4168,9 @@ public string ZZOX(string s) return parser.Error1; } - // - //ARIES ATU erase state message - //write only + // + //ARIES ATU erase state message + //write only public string ZZOZ(string s) { if (s.Length == parser.nSet) @@ -4451,30 +4464,30 @@ public string ZZMZ(string s) { try { - MemoryRecord oldrec = GetChannelRecord(s); - MemoryRecord newrec = new MemoryRecord - { - Group = oldrec.Group, - RXFreq = console.VFOAFreq, - Name = oldrec.Name, - DSPMode = console.RX1DSPMode, - Scan = oldrec.Scan, - TuneStep = console.TuneStepList[console.TuneStepIndex].Name, - RPTR = console.CurrentFMTXMode, - RPTROffset = console.FMTXOffsetMHz, - CTCSSOn = console.radio.GetDSPTX(0).CTCSSFlag, - CTCSSFreq = console.radio.GetDSPTX(0).CTCSSFreqHz, - Power = console.PWR, - Deviation = (int)console.radio.GetDSPTX(0).TXFMDeviation, - Split = console.VFOSplit, - TXFreq = console.TXFreq, - RXFilter = console.RX1Filter, - RXFilterLow = console.RX1FilterLow, - RXFilterHigh = console.RX1FilterHigh, - Comments = oldrec.Comments, - AGCMode = console.radio.GetDSPRX(0, 0).RXAGCMode, - AGCT = console.RF - }; + MemoryRecord oldrec = GetChannelRecord(s); + MemoryRecord newrec = new MemoryRecord + { + Group = oldrec.Group, + RXFreq = console.VFOAFreq, + Name = oldrec.Name, + DSPMode = console.RX1DSPMode, + Scan = oldrec.Scan, + TuneStep = console.TuneStepList[console.TuneStepIndex].Name, + RPTR = console.CurrentFMTXMode, + RPTROffset = console.FMTXOffsetMHz, + CTCSSOn = console.radio.GetDSPTX(0).CTCSSFlag, + CTCSSFreq = console.radio.GetDSPTX(0).CTCSSFreqHz, + Power = console.PWR, + Deviation = (int)console.radio.GetDSPTX(0).TXFMDeviation, + Split = console.VFOSplit, + TXFreq = console.TXFreq, + RXFilter = console.RX1Filter, + RXFilterLow = console.RX1FilterLow, + RXFilterHigh = console.RX1FilterHigh, + Comments = oldrec.Comments, + AGCMode = console.radio.GetDSPRX(0, 0).RXAGCMode, + AGCT = console.RF + }; console.MemoryList.List.Remove(oldrec); console.MemoryList.List.Add(newrec); return ""; @@ -6880,7 +6893,8 @@ public string ZZTP(string s) // Reads the Flex 5000 temperature sensor public string ZZTS() { - if (HardwareSpecific.Model == HPSDRModel.HERMES) + if ((HardwareSpecific.Model == HPSDRModel.HERMES) || + (HardwareSpecific.Model == HPSDRModel.HERMESLITE)) // MI0BOT: HL2 { int val = 0; float volts = 0.0f; @@ -9952,45 +9966,53 @@ public string Mode2String(DSPMode pMode) // converts Kenwood single digit mode code to SDR mode public void KString2Mode(string pIndex) { + // MI0BOT: Redirect CAT to VFO B string s = pIndex; + DSPMode newMode; switch(s) { case "1": if (console.SetupForm.DigUIsUSB) - console.RX1DSPMode = DSPMode.DIGL; + newMode = DSPMode.DIGL; else - console.RX1DSPMode = DSPMode.LSB; + newMode = DSPMode.LSB; break; case "2": if (console.SetupForm.DigUIsUSB) - console.RX1DSPMode = DSPMode.DIGU; + newMode = DSPMode.DIGU; else - console.RX1DSPMode = DSPMode.USB; + newMode = DSPMode.USB; break; case "3": - console.RX1DSPMode = DSPMode.CWU; + newMode = DSPMode.CWU; break; case "4": - console.RX1DSPMode = DSPMode.FM; + newMode = DSPMode.FM; break; case "5": - console.RX1DSPMode = DSPMode.AM; + newMode = DSPMode.AM; break; case "6": - console.RX1DSPMode = DSPMode.DIGL; + newMode = DSPMode.DIGL; break; case "7": - console.RX1DSPMode = DSPMode.CWL; + newMode = DSPMode.CWL; break; case "9": - console.RX1DSPMode = DSPMode.DIGU; + newMode = DSPMode.DIGU; break; default: - console.RX1DSPMode = DSPMode.USB; + newMode = DSPMode.USB; break; } - } + + // MI0BOT: Redirect CAT to VFO B + if (console.CATtoVFOB && HardwareSpecific.Model == HPSDRModel.HERMESLITE) + console.RX2DSPMode = newMode; + else + console.RX1DSPMode = newMode; + } // converts SDR mode to Kenwood single digit mode code public string Mode2KString(DSPMode pMode) diff --git a/Project Files/Source/Console/CAT/CATParser.cs b/Project Files/Source/Console/CAT/CATParser.cs index 4c8e02fa..876d0325 100644 --- a/Project Files/Source/Console/CAT/CATParser.cs +++ b/Project Files/Source/Console/CAT/CATParser.cs @@ -184,7 +184,15 @@ public string Get(string pCmdString) case "EX": break; case "FA": - rtncmd = cmdlist.FA(suffix); + // MI0BOT: Redirect CAT to VFO B + if (console.CATtoVFOB && HardwareSpecific.Model == HPSDRModel.HERMESLITE) + { + rtncmd = cmdlist.FB(suffix); + } + else + { + rtncmd = cmdlist.FA(suffix); + } break; case "FB": rtncmd = cmdlist.FB(suffix); @@ -777,7 +785,15 @@ private string ParseExtended() rtncmd = cmdlist.ZZET(suffix); break; case "ZZFA": - rtncmd = cmdlist.ZZFA(suffix); + // MI0BOT: Redirect CAT to VFO B + if (console.CATtoVFOB && HardwareSpecific.Model == HPSDRModel.HERMESLITE) + { + rtncmd = cmdlist.ZZFB(suffix); + } + else + { + rtncmd = cmdlist.ZZFA(suffix); + } break; case "ZZFB": rtncmd = cmdlist.ZZFB(suffix); @@ -801,10 +817,26 @@ private string ParseExtended() rtncmd = cmdlist.ZZFJ(suffix); break; case "ZZFL": - rtncmd = cmdlist.ZZFL(suffix); + // MI0BOT: Redirect CAT to VFO B + if (console.CATtoVFOB && HardwareSpecific.Model == HPSDRModel.HERMESLITE) + { + rtncmd = cmdlist.ZZFR(suffix); + } + else + { + rtncmd = cmdlist.ZZFL(suffix); + } break; case "ZZFH": - rtncmd = cmdlist.ZZFH(suffix); + // MI0BOT: Redirect CAT to VFO B + if (console.CATtoVFOB && HardwareSpecific.Model == HPSDRModel.HERMESLITE) + { + rtncmd = cmdlist.ZZFS(suffix); + } + else + { + rtncmd = cmdlist.ZZFH(suffix); + } break; case "ZZFM": rtncmd = cmdlist.ZZFM(); @@ -924,7 +956,15 @@ private string ParseExtended() rtncmd = cmdlist.ZZMB(suffix); break; case "ZZMD": - rtncmd = cmdlist.ZZMD(suffix); + // MI0BOT: Redirect CAT to VFO B + if (console.CATtoVFOB && HardwareSpecific.Model == HPSDRModel.HERMESLITE) + { + rtncmd = cmdlist.ZZME(suffix); + } + else + { + rtncmd = cmdlist.ZZMD(suffix); + } break; case "ZZME": rtncmd = cmdlist.ZZME(suffix); diff --git a/Project Files/Source/Console/HPSDR/Alex.cs b/Project Files/Source/Console/HPSDR/Alex.cs index 6c4b4639..1df369a0 100644 --- a/Project Files/Source/Console/HPSDR/Alex.cs +++ b/Project Files/Source/Console/HPSDR/Alex.cs @@ -22,7 +22,7 @@ // namespace Thetis -{ +{ /// /// Summary description for Penny. /// @@ -56,24 +56,24 @@ private Alex() private byte[] TxAnt = new byte[12]; private byte[] RxAnt = new byte[12]; - private byte[] RxOnlyAnt = new byte[12]; // 1 = rx1, 2 = rx2, 3 = xv, 0 = none selected - private bool LimitTXRXAntenna = false; // when set, antennas should stay on 1 (for external Aries ATU) + private byte[] RxOnlyAnt = new byte[12]; // 1 = rx1, 2 = rx2, 3 = xv, 0 = none selected + private bool LimitTXRXAntenna = false; // when set, antennas should stay on 1 (for external Aries ATU) public static bool RxOutOnTx = false; public static bool Ext1OutOnTx = false; public static bool Ext2OutOnTx = false; public static bool init_update = false; public static bool rx_out_override = false; - public static bool TRxAnt = false; + public static bool TRxAnt = false; // Flag, set true to identify that the transmit antenna is being used for reception public static bool trx_ant_different { set; get; } // // SetAntennasTo1 causes RX, TX antennas to be set to 1 // the various RX "bypass" unaffected - public void SetAntennasTo1(bool IsSetTo1) - { - LimitTXRXAntenna = IsSetTo1; - + public void SetAntennasTo1(bool IsSetTo1) + { + LimitTXRXAntenna = IsSetTo1; + } public void setRxAnt(Band band, byte ant) { @@ -104,55 +104,55 @@ public void setTxAnt(Band band, byte ant) int idx = (int)band - (int)Band.B160M; TxAnt[idx] = ant; } - - public static Band AntBandFromFreq(double freq) - { - Band result; - 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; - } + + public static Band AntBandFromFreq(double freq) + { + Band result; + 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; + } public static Band AntBandFromFreq(bool tx) { Band result; @@ -162,72 +162,72 @@ public static Band AntBandFromFreq(bool tx) { System.Console.WriteLine("no console"); return Band.LAST; - } - - //[2.10.3.6]MW0LGE - double freq;// = Console.getConsole().VFOAFreq; //was = 0.0 Vk4xv Txvr fix. + } + + //[2.10.3.6]MW0LGE + double freq;// = Console.getConsole().VFOAFreq; //was = 0.0 Vk4xv Txvr fix. if (tx) - { - if (c.VFOATX) - freq = c.VFOAFreq; - else - freq = c.VFOBFreq; - } - else - freq = c.VFOAFreq; + { + if (c.VFOATX) + freq = c.VFOAFreq; + else + freq = c.VFOBFreq; + } + else + freq = c.VFOAFreq; if (c.RX1XVTRIndex >= 0) - freq = c.XVTRForm.TranslateFreq(freq); - //[2.10.3.6]MW0LGE else freq = Console.getConsole().VFOAFreq; - + freq = c.XVTRForm.TranslateFreq(freq); + //[2.10.3.6]MW0LGE else freq = Console.getConsole().VFOAFreq; + System.Console.WriteLine("Freq is: " + freq); result = AntBandFromFreq(freq); - //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; - // } - // } - //} - - System.Console.WriteLine("Band is: " + result); + //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; + // } + // } + //} + + System.Console.WriteLine("Band is: " + result); return result; } @@ -306,34 +306,43 @@ public void UpdateAlexAntSelection(Band band, bool tx, bool xvtr) private int m_nOld_tx_ant = -99; private int m_nOld_rx_out = -99; private bool m_bOld_tx = false; - private bool m_bOld_alex_enabled = false; + private bool m_bOld_alex_enabled = false; public void UpdateAlexAntSelection(Band band, bool tx, bool alex_enabled, bool xvtr) { if ( !alex_enabled ) - { - NetworkIO.SetAntBits(0, 0, 0, 0, false); - m_bOld_alex_enabled = alex_enabled; + { + NetworkIO.SetAntBits(0, 0, 0, 0, false); + m_bOld_alex_enabled = alex_enabled; return; - } + } + + Console c = Console.getConsole(); - int rx_only_ant; + if (c == null) + { + System.Console.WriteLine("no console"); + } + + int rx_only_ant; // Holds the current receive only port based on the current band selected int trx_ant; int tx_ant; - int rx_out; + int rx_out; // Flag to identify if one of the rx only ports should be used while transmitting int idx = (int)band - (int)Band.B160M; - if ( idx < 0 || idx > 11 ) - { + if (idx < 0 || idx > 11) + { band = AntBandFromFreq(tx); - idx = (int)band - (int)Band.B160M; - if ( idx < 0 || idx > 11 ) - { - System.Console.WriteLine("No good ant!"); - return; - } - } + idx = (int)band - (int)Band.B160M; + if (idx < 0 || idx > 11) + { + System.Console.WriteLine("No good ant!"); + return; + } + } + + //System.Console.WriteLine("Ant idx: " + idx); //moved into different check down below tx_ant = TxAnt[idx]; if ( tx ) @@ -350,8 +359,21 @@ public void UpdateAlexAntSelection(Band band, bool tx, bool alex_enabled, bool x rx_only_ant = RxOnlyAnt[idx]; if (xvtr) { - if (rx_only_ant >= 3) rx_only_ant = 3; - else rx_only_ant = 0; + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + { + int xvtrAnt = c.XVTRForm.GetRXAntenna(c.RX1XVTRIndex); + + if (xvtrAnt == 4 || // MI0BOT: Alt RX has been requested or TX and Rx are not the same + TRxAnt == false) + rx_only_ant = 1; + else + rx_only_ant = 0; + } + else + { + if (rx_only_ant >= 3) rx_only_ant = 3; + else rx_only_ant = 0; + } } else { @@ -361,8 +383,17 @@ public void UpdateAlexAntSelection(Band band, bool tx, bool alex_enabled, bool x rx_out = rx_only_ant != 0 ? 1 : 0; if (TRxAnt) trx_ant = TxAnt[idx]; - else trx_ant = RxAnt[idx]; - trx_ant_different = RxAnt[idx] != TxAnt[idx]; + else trx_ant = RxAnt[idx]; + + if ((RxAnt[idx] != TxAnt[idx]) || + (0 != rx_only_ant && HardwareSpecific.Model == HPSDRModel.HERMESLITE)) // MI0BOT: Antenna not the same is valid + { // for receive only aerial as well + trx_ant_different = true; + } + else + { + trx_ant_different = false; + } } if (rx_out_override && rx_out == 1) @@ -372,58 +403,69 @@ public void UpdateAlexAntSelection(Band band, bool tx, bool alex_enabled, bool x if (tx) // override override rx_out = RxOutOnTx || Ext1OutOnTx || Ext2OutOnTx ? 1 : 0; else rx_out = 0; // disable Rx_Bypass_Out relay - } - // - // G8NJJ support for external Aries ATU on antenna port 1 - // force TX and RX antenna to 1 if selected - // this is only enabled if "external Aries" selected in setup - // + } + // + // G8NJJ support for external Aries ATU on antenna port 1 + // force TX and RX antenna to 1 if selected + // this is only enabled if "external Aries" selected in setup + // if ((trx_ant != 4) && (LimitTXRXAntenna == true)) - trx_ant = 1; - // - //if (init_update) - //{ - // if (rx_out == 0) xrx_out = 1; // workaround for Hermes - // else xrx_out = 0; - // NetworkIO.SetAlexAntBits(rx_only_ant, trx_ant, xrx_out); - // init_update = false; - // Thread.Sleep(10); - //} - - //MW0LGE_21k9d only set bits if different + trx_ant = 1; + // + //if (init_update) + //{ + // if (rx_out == 0) xrx_out = 1; // workaround for Hermes + // else xrx_out = 0; + // NetworkIO.SetAlexAntBits(rx_only_ant, trx_ant, xrx_out); + // init_update = false; + // Thread.Sleep(10); + //} + + if (TRxAnt && HardwareSpecific.Model == HPSDRModel.HERMESLITE && !xvtr) + { + // MI0BOT: Transmit antenna is being used for reception in split aerial operation + // so switch of the rx only aerial but not with transverter operation + + rx_only_ant = 0; + } + + //MW0LGE_21k9d only set bits if different if (m_nOld_rx_only_ant != rx_only_ant || m_nOld_trx_ant != trx_ant || m_nOld_tx_ant != tx_ant || m_nOld_rx_out != rx_out || - m_bOld_tx != tx || - m_bOld_alex_enabled != alex_enabled) - { - NetworkIO.SetAntBits(rx_only_ant, trx_ant, tx_ant, rx_out, tx); - - System.Console.WriteLine("Ant idx: " + idx + "(" + ((Band)idx + (int)Band.B160M).ToString() + ")"); - System.Console.WriteLine("Ant Rx Only {0} , TRx Ant {1}, Tx Ant {2}, Rx Out {3}, TX {4}", rx_only_ant.ToString(), trx_ant.ToString(), tx_ant.ToString(), rx_out.ToString(), tx.ToString()); - - //store old - m_nOld_rx_only_ant = rx_only_ant; - m_nOld_trx_ant = trx_ant; - m_nOld_tx_ant = tx_ant; - m_nOld_rx_out = rx_out; - m_bOld_tx = tx; - m_bOld_alex_enabled = alex_enabled; - } - - // don't allow changing antenna selections when mox is activated - /* if ( tx ) - { - AlexEnableSavedState = Console.getConsole().SetupForm.SetAlexAntEnabled(false); - AlexEnableIsStateSaved = true; - } - else if ( AlexEnableIsStateSaved ) - { - Console.getConsole().SetupForm.SetAlexAntEnabled(AlexEnableSavedState); - AlexEnableIsStateSaved = false; - } */ - + m_bOld_tx != tx || + m_bOld_alex_enabled != alex_enabled) + { + NetworkIO.SetAntBits(rx_only_ant, trx_ant, tx_ant, rx_out, tx); + + System.Console.WriteLine("Ant idx: " + idx + "(" + ((Band)idx + (int)Band.B160M).ToString() + ")"); + System.Console.WriteLine("Ant Rx Only {0} , TRx Ant {1}, Tx Ant {2}, Rx Out {3}, TX {4}", rx_only_ant.ToString(), trx_ant.ToString(), tx_ant.ToString(), rx_out.ToString(), tx.ToString()); + + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + c.SetIOBoardAerialPorts(rx_only_ant, trx_ant - 1, tx_ant - 1, tx); // MI0BOT: Sets the aerial controls on the I/O board + + //store old + m_nOld_rx_only_ant = rx_only_ant; + m_nOld_trx_ant = trx_ant; + m_nOld_tx_ant = tx_ant; + m_nOld_rx_out = rx_out; + m_bOld_tx = tx; + m_bOld_alex_enabled = alex_enabled; + } + + // don't allow changing antenna selections when mox is activated + /* if ( tx ) + { + AlexEnableSavedState = Console.getConsole().SetupForm.SetAlexAntEnabled(false); + AlexEnableIsStateSaved = true; + } + else if ( AlexEnableIsStateSaved ) + { + Console.getConsole().SetupForm.SetAlexAntEnabled(AlexEnableSavedState); + AlexEnableIsStateSaved = false; + } */ + return; } diff --git a/Project Files/Source/Console/HPSDR/IoBoardHl2.cs b/Project Files/Source/Console/HPSDR/IoBoardHl2.cs new file mode 100644 index 00000000..d0a2a908 --- /dev/null +++ b/Project Files/Source/Console/HPSDR/IoBoardHl2.cs @@ -0,0 +1,204 @@ +/* +* +* Copyright (C) 2025 Reid Campbell, MI0BOT, mi0bot@trom.uk +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +// This module contains code to support the I/O Board used in the Hermes Lite 2 +// +// + +using System; +using System.Threading; +using System.Threading.Tasks; +using Thetis; + +namespace Thetis +{ + /// + /// Summary description for I/O Board + /// + using System.Diagnostics; + using Microsoft.Win32; + using static Thetis.IOBoard; + + public class IOBoard + { + public enum Registers + { + HardwareVersion = -1, + REG_TX_FREQ_BYTE4 = 0, + REG_TX_FREQ_BYTE3 = 1, + REG_TX_FREQ_BYTE2 = 2, + REG_TX_FREQ_BYTE1 = 3, + REG_TX_FREQ_BYTE0 = 4, + REG_CONTROL = 5, + REG_INPUT_PINS = 6, + REG_ANTENNA_TUNER = 7, + REG_FAULT = 8, + REG_FIRMWARE_MAJOR = 9, + REG_FIRMWARE_MINOR = 10, + REG_RF_INPUTS = 11, + REG_FAN_SPEED = 12, + REG_FCODE_RX1 = 13, + REG_FCODE_RX2 = 14, + REG_FCODE_RX3 = 15, + REG_FCODE_RX4 = 16, + REG_FCODE_RX5 = 17, + REG_FCODE_RX6 = 18, + REG_FCODE_RX7 = 19, + REG_FCODE_RX8 = 20, + REG_FCODE_RX9 = 21, + REG_FCODE_RX10 = 22, + REG_FCODE_RX11 = 23, + REG_FCODE_RX12 = 24, + REG_ADC0_MSB = 25, + REG_ADC0_LSB = 26, + REG_ADC1_MSB = 27, + REG_ADC1_LSB = 28, + REG_ADC2_MSB = 29, + REG_ADC2_LSB = 30, + REG_ANTENNA = 31, + REG_OP_MODE = 32, + + REG_STATUS = 167, + REG_IN_PINS = 168, + REG_OUT_PINS = 169, + GPIO_DIRECT_BASE = 170 + } + + public enum HardwareVersion + { + Version_1 = 0xf1, + } + + private static IOBoard theSingleton = null; + private static Console console; + public byte hardwareVersion { set; get; } = 0; + + private byte[] registers = new byte[256]; + private int lastReadRequest = 0; + private long currentFreq = 0; + + + public static IOBoard getIOBoard(Console c) + { + lock ( typeof(IOBoard) ) + { + if ( theSingleton == null ) + { + theSingleton = new IOBoard(); + console = c; + } + } + return theSingleton; + } + public static IOBoard getIOBoard() + { + lock ( typeof(IOBoard) ) + { + if ( theSingleton == null ) + { + theSingleton = new IOBoard(); + } + } + return theSingleton; + } + + private IOBoard() + { + for (int i = 0; i < 256; i++) + { + registers[i] = 0; + } + } + + + public byte readRequest(Registers readRequest) + { + byte returnCode = 0; + + if (readRequest == Registers.HardwareVersion) + { + returnCode = (byte)NetworkIO.I2CReadInitiate(1, 0x41, 0); // Hardware version is stored at a different address + } // in register 0 + else + { + returnCode = (byte)NetworkIO.I2CReadInitiate(1, 0x1d, (int)readRequest); + } + + if (returnCode == 0) + lastReadRequest = (int) readRequest; + + return returnCode; + } + + public byte readResponse() + { + byte[] read_data = new byte[4]; + + byte returnCode = (byte) NetworkIO.I2CResponse(read_data); + + if( returnCode == 0) + { + if (lastReadRequest == (int)Registers.HardwareVersion) + { + hardwareVersion = read_data[3]; + } + else + { + registers[lastReadRequest+0] = read_data[3]; + registers[lastReadRequest+1] = read_data[2]; + registers[lastReadRequest+2] = read_data[1]; + registers[lastReadRequest+3] = read_data[0]; + } + } + + return returnCode; + } + public byte readRegister(Registers readRequest) + { + return registers[(int)readRequest]; + } + + public void writeRequest(Registers writeRequest, byte writeData) + { + registers[(int) writeRequest] = writeData; + + NetworkIO.I2CWrite(1, 0x1d, (int) writeRequest, writeData); + } + + public void setFrequency(long frequency) + { + if(currentFreq != frequency) + { + // Write frequency on bus 2 at address 0x1d into the five registers + registers[(int)IOBoard.Registers.REG_TX_FREQ_BYTE4] = (byte)(frequency >> 32); + registers[(int)IOBoard.Registers.REG_TX_FREQ_BYTE3] = (byte)(frequency >> 24); + registers[(int)IOBoard.Registers.REG_TX_FREQ_BYTE2] = (byte)(frequency >> 16); + registers[(int)IOBoard.Registers.REG_TX_FREQ_BYTE1] = (byte)(frequency >> 08); + registers[(int)IOBoard.Registers.REG_TX_FREQ_BYTE0] = (byte)(frequency >> 00); + + NetworkIO.I2CWrite(1, 0x1d, (int) IOBoard.Registers.REG_TX_FREQ_BYTE4, registers[(int)IOBoard.Registers.REG_TX_FREQ_BYTE4]); + NetworkIO.I2CWrite(1, 0x1d, (int) IOBoard.Registers.REG_TX_FREQ_BYTE3, registers[(int)IOBoard.Registers.REG_TX_FREQ_BYTE3]); + NetworkIO.I2CWrite(1, 0x1d, (int) IOBoard.Registers.REG_TX_FREQ_BYTE2, registers[(int)IOBoard.Registers.REG_TX_FREQ_BYTE2]); + NetworkIO.I2CWrite(1, 0x1d, (int) IOBoard.Registers.REG_TX_FREQ_BYTE1, registers[(int)IOBoard.Registers.REG_TX_FREQ_BYTE1]); + NetworkIO.I2CWrite(1, 0x1d, (int) IOBoard.Registers.REG_TX_FREQ_BYTE0, registers[(int)IOBoard.Registers.REG_TX_FREQ_BYTE0]); + + currentFreq = frequency; + } + } + } +} diff --git a/Project Files/Source/Console/HPSDR/NetworkIO.cs b/Project Files/Source/Console/HPSDR/NetworkIO.cs index bff691d7..abe3bc62 100644 --- a/Project Files/Source/Console/HPSDR/NetworkIO.cs +++ b/Project Files/Source/Console/HPSDR/NetworkIO.cs @@ -1,1173 +1,1173 @@ -using System; -using System.Collections.Generic; -using System.Net; -using System.Net.Sockets; -using System.Net.NetworkInformation; -using System.Windows.Forms; - -namespace Thetis -{ - partial class NetworkIO - { - public NetworkIO() - { - } - - public static HPSDRHW BoardID { get; set; } = HPSDRHW.Hermes; - public static RadioProtocol CurrentRadioProtocol { get; set; } = RadioProtocol.ETH; - public static RadioProtocol SelectedRadioProtocol { get; set; } = RadioProtocol.ETH; - public static byte BetaVersion { get; set; } = 0; - public static byte FWCodeVersion { get; set; } = 0; - public static byte Protocol2VersionSupported { get; set; } = 0; - public static bool FWVersionsChecked { get; set; } = false; - public static string GetFWVersionErrorMsg { get; set; } = ""; - public static string BoardMismatch { get; set; } = ""; - - public static int InitRadio() - { - int ret = -1; - // 0 everything fine - // some other non zero not listed below initWSA issue - // -4 dest ip invalid - // 1 socket() still returns wsa not initialised - // (SOCKET)(~0) or -1, invalid socet - // -101 invalid firmware - // -102 unknown protocol - // -103 invalid radio IP - // -104 invalid host IP - // -105 no nic currently selected - // -106 no radio currently selected - - Console c = Console.getConsole(); - if (c.IsSetupFormNull) return -1; - if (c.SetupForm.SelectedRadioList == null) return -1; - ucRadioList rl = c.SetupForm.SelectedRadioList; - if (rl == null) return -1; - - bool perform_search = true; - if (rl.IsFirstRadioFoundSelected) - { - // we need to do a scan here, and use the first found - c.SetupForm.ScanForFirstFoundRadio(); - perform_search = false; // we dont want to search again - } - - NicRadioScanResult nic = rl.SelectedNICDetails; - RadioInfo ri = rl.SelectedRadioDetails; - - if(nic == null) - { - return -105; // no nic currently selected - } - if(ri == null) - { - return -106; // no radio currently selected - } - - string radioIP = ri.IpAddress.ToString(); - int ratioPort = ri.DiscoveryPortBase; - string hostIP = nic.LocalIPv4.ToString(); - int hostPort = c.SetupForm.ListenToRadioOnUDPPort; // will be any os available port if 0, or specific if set - int model_id = (int)HardwareSpecific.Model; - int protocol = ri.Protocol == RadioDiscoveryRadioProtocol.P1 ? 0 : 1; - - if (!ri.IsCustom && perform_search) - { - RadioDiscoveryOptions options = new RadioDiscoveryOptions(); - - options.IgnoreSubnetCheck = true; - options.IncludeEthernet = true; - options.IncludeWireless = true; - options.IncludeOtherInterfaceTypes = !c.SetupForm.LimitInterfacesToEthernetWifi; - options.AllowLoopback = false; - options.AllowAPIPA = true; - options.IncludeGeneralBroadcast = true; - - options.DiscoveryPortBase = ratioPort; - options.BindLocalPort = hostPort; - - options.ScanPerformance = c.SetupForm.SelectedDiscoveryProfile; - - IPAddress ip; - if (IPAddress.TryParse(radioIP, out ip)) - { - options.FixedTargetIp = ip; - } - else - { - return -103; - } - if (IPAddress.TryParse(hostIP, out ip)) - { - options.FixedLocalIp = ip; - } - else - { - return -104; - } - - if (c.SetupForm.NetworkProtocolMustMatch) - { - switch (protocol) - { - case 0://P1 - options.ProtocolMode = RadioDiscoveryProtocolMode.P1Only; // search for p1 only - break; - case 1://P2 - options.ProtocolMode = RadioDiscoveryProtocolMode.P2Only; // search for p2 only - break; - default: - return -102; // unknown protocol (never happen, but here incase more are added) - } - } - else - { - options.ProtocolMode = RadioDiscoveryProtocolMode.Auto; // search for both - } - - // check via a single nic that matches where we expect the radio to be - RadioDiscoveryService svc = new RadioDiscoveryService(); - NicRadioScanResult scan_result = svc.DiscoverUsingSingleNic(options, options.FixedLocalIp); - - if (scan_result == null || scan_result.Radios == null || scan_result.Radios.Count != 1) return -1; - ri = scan_result.Radios[0]; // the one we found - protocol = ri.Protocol == RadioDiscoveryRadioProtocol.P1 ? 0 : 1; // update to the result (for auto) - - if (ri.DeviceType == HPSDRHW.HermesII) - { - if (ri.CodeVersion < 103) - { - GetFWVersionErrorMsg = "Invalid Firmware!\nRequires 10.3 or greater. "; - return -101; - } - } - - // update the radio select list - rl.UpdateSelectedDetails(scan_result, scan_result.Radios[0]); - } - - ret = nativeInitMetis(radioIP, ratioPort, hostIP, hostPort, protocol, model_id); - - if(ret == 0) - { - // connected ok - BoardID = ri.DeviceType; - CurrentRadioProtocol = (RadioProtocol)protocol; - FWCodeVersion = ri.CodeVersion; - BetaVersion = ri.BetaVersion; - Protocol2VersionSupported = ri.Protocol2Supported; - - //[2.10.3.9]MW0LGE added board check, issue icon shown in setup - bool board_is_expected_for_model; - switch (HardwareSpecific.Model) - { - case HPSDRModel.REDPITAYA: - board_is_expected_for_model = BoardID == HPSDRHW.Hermes || BoardID == HPSDRHW.OrionMKII; // can be these two - break; - case HPSDRModel.ANAN10: - case HPSDRModel.ANAN10E: - case HPSDRModel.ANAN100: - case HPSDRModel.ANAN100B: - board_is_expected_for_model = BoardID == HPSDRHW.Hermes || BoardID == HPSDRHW.HermesII; // can be these two - break; - default: - board_is_expected_for_model = BoardID == HardwareSpecific.Hardware; - break; - } - - if (!board_is_expected_for_model) - { - // the board returned in the packet, does not match the expected board for the Model selected - BoardMismatch = $"The board returned from network query was: {BoardID.ToString()}\nExpected board for model selected is: {HardwareSpecific.Hardware.ToString()}\n\nIf this is expected you can ignore this warning"; - } - else - { - BoardMismatch = ""; - } - } - - return ret; - } - - private static float _swr_protect = 1.0f; - public static float SWRProtect - { - get { return _swr_protect; } - set { _swr_protect = value; } - } - - public static void SetOutputPower(float f) - { - if (f < 0.0) - { - f = 0.0F; - } - if (f >= 1.0) - { - f = 1.0F; - } - - int i = (int)(255 * f * _swr_protect); - SetOutputPowerFactor(i); - } - - private static double[][] _lastVFOfreq = new double[2][] { new double[] { 0.0, 0.0, 0.0, 0.0 }, new double[] { 0.0 } }; - unsafe public static void VFOfreq(int id, double f, int tx) - { - _lastVFOfreq[tx][id] = f; - int f_freq; - f_freq = (int)((f * 1e6) * _freq_correction_factor); - if (f_freq >= 0) - if (CurrentRadioProtocol == RadioProtocol.USB) - SetVFOfreq(id, f_freq, tx); // sending freq Hz to firmware - else SetVFOfreq(id, Freq2PhaseWord(f_freq), tx); // sending phaseword to firmware - } - - private static double _freq_correction_factor = 1.0; - public static double FreqCorrectionFactor - { - get { return _freq_correction_factor; } - set - { - _freq_correction_factor = value; - FreqCorrectionChanged(); - } - } - - public static void FreqCorrectionChanged() - { - if (!Console.FreqCalibrationRunning) // we can't be applying freq correction when cal is running - { - VFOfreq(0, _lastVFOfreq[0][0], 0); - VFOfreq(1, _lastVFOfreq[0][1], 0); - VFOfreq(2, _lastVFOfreq[0][2], 0); - VFOfreq(3, _lastVFOfreq[0][3], 0); - VFOfreq(0, _lastVFOfreq[1][0], 1); - } - } - - public static int Freq2PhaseWord(int freq) // freq to phaseword conversion - { - long pw = (long)Math.Pow(2, 32) * freq / 122880000; - return (int)pw; - } - - private static double _low_freq_offset; - public static double LowFreqOffset - { - get { return _low_freq_offset; } - set - { - _low_freq_offset = value; - } - } - - private static double _high_freq_offset; - public static double HighFreqOffset - { - get { return _high_freq_offset; } - set - { - _high_freq_offset = value; - } - } - } -} - +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Sockets; +using System.Net.NetworkInformation; +using System.Windows.Forms; + +namespace Thetis +{ + partial class NetworkIO + { + public NetworkIO() + { + } + + public static HPSDRHW BoardID { get; set; } = HPSDRHW.Hermes; + public static RadioProtocol CurrentRadioProtocol { get; set; } = RadioProtocol.ETH; + public static RadioProtocol SelectedRadioProtocol { get; set; } = RadioProtocol.ETH; + public static byte BetaVersion { get; set; } = 0; + public static byte FWCodeVersion { get; set; } = 0; + public static byte Protocol2VersionSupported { get; set; } = 0; + public static bool FWVersionsChecked { get; set; } = false; + public static string GetFWVersionErrorMsg { get; set; } = ""; + public static string BoardMismatch { get; set; } = ""; + + public static int InitRadio() + { + int ret = -1; + // 0 everything fine + // some other non zero not listed below initWSA issue + // -4 dest ip invalid + // 1 socket() still returns wsa not initialised + // (SOCKET)(~0) or -1, invalid socet + // -101 invalid firmware + // -102 unknown protocol + // -103 invalid radio IP + // -104 invalid host IP + // -105 no nic currently selected + // -106 no radio currently selected + + Console c = Console.getConsole(); + if (c.IsSetupFormNull) return -1; + if (c.SetupForm.SelectedRadioList == null) return -1; + ucRadioList rl = c.SetupForm.SelectedRadioList; + if (rl == null) return -1; + + bool perform_search = true; + if (rl.IsFirstRadioFoundSelected) + { + // we need to do a scan here, and use the first found + c.SetupForm.ScanForFirstFoundRadio(); + perform_search = false; // we dont want to search again + } + + NicRadioScanResult nic = rl.SelectedNICDetails; + RadioInfo ri = rl.SelectedRadioDetails; + + if(nic == null) + { + return -105; // no nic currently selected + } + if(ri == null) + { + return -106; // no radio currently selected + } + + string radioIP = ri.IpAddress.ToString(); + int ratioPort = ri.DiscoveryPortBase; + string hostIP = nic.LocalIPv4.ToString(); + int hostPort = c.SetupForm.ListenToRadioOnUDPPort; // will be any os available port if 0, or specific if set + int model_id = (int)HardwareSpecific.Model; + int protocol = ri.Protocol == RadioDiscoveryRadioProtocol.P1 ? 0 : 1; + + if (!ri.IsCustom && perform_search) + { + RadioDiscoveryOptions options = new RadioDiscoveryOptions(); + + options.IgnoreSubnetCheck = true; + options.IncludeEthernet = true; + options.IncludeWireless = true; + options.IncludeOtherInterfaceTypes = !c.SetupForm.LimitInterfacesToEthernetWifi; + options.AllowLoopback = false; + options.AllowAPIPA = true; + options.IncludeGeneralBroadcast = true; + + options.DiscoveryPortBase = ratioPort; + options.BindLocalPort = hostPort; + + options.ScanPerformance = c.SetupForm.SelectedDiscoveryProfile; + + IPAddress ip; + if (IPAddress.TryParse(radioIP, out ip)) + { + options.FixedTargetIp = ip; + } + else + { + return -103; + } + if (IPAddress.TryParse(hostIP, out ip)) + { + options.FixedLocalIp = ip; + } + else + { + return -104; + } + + if (c.SetupForm.NetworkProtocolMustMatch) + { + switch (protocol) + { + case 0://P1 + options.ProtocolMode = RadioDiscoveryProtocolMode.P1Only; // search for p1 only + break; + case 1://P2 + options.ProtocolMode = RadioDiscoveryProtocolMode.P2Only; // search for p2 only + break; + default: + return -102; // unknown protocol (never happen, but here incase more are added) + } + } + else + { + options.ProtocolMode = RadioDiscoveryProtocolMode.Auto; // search for both + } + + // check via a single nic that matches where we expect the radio to be + RadioDiscoveryService svc = new RadioDiscoveryService(); + NicRadioScanResult scan_result = svc.DiscoverUsingSingleNic(options, options.FixedLocalIp); + + if (scan_result == null || scan_result.Radios == null || scan_result.Radios.Count != 1) return -1; + ri = scan_result.Radios[0]; // the one we found + protocol = ri.Protocol == RadioDiscoveryRadioProtocol.P1 ? 0 : 1; // update to the result (for auto) + + if (ri.DeviceType == HPSDRHW.HermesII) + { + if (ri.CodeVersion < 103) + { + GetFWVersionErrorMsg = "Invalid Firmware!\nRequires 10.3 or greater. "; + return -101; + } + } + + // update the radio select list + rl.UpdateSelectedDetails(scan_result, scan_result.Radios[0]); + } + + ret = nativeInitMetis(radioIP, ratioPort, hostIP, hostPort, protocol, model_id); + + if(ret == 0) + { + // connected ok + BoardID = ri.DeviceType; + CurrentRadioProtocol = (RadioProtocol)protocol; + FWCodeVersion = ri.CodeVersion; + BetaVersion = ri.BetaVersion; + Protocol2VersionSupported = ri.Protocol2Supported; + + //[2.10.3.9]MW0LGE added board check, issue icon shown in setup + bool board_is_expected_for_model; + switch (HardwareSpecific.Model) + { + case HPSDRModel.REDPITAYA: + board_is_expected_for_model = BoardID == HPSDRHW.Hermes || BoardID == HPSDRHW.OrionMKII; // can be these two + break; + case HPSDRModel.ANAN10: + case HPSDRModel.ANAN10E: + case HPSDRModel.ANAN100: + case HPSDRModel.ANAN100B: + board_is_expected_for_model = BoardID == HPSDRHW.Hermes || BoardID == HPSDRHW.HermesII; // can be these two + break; + default: + board_is_expected_for_model = BoardID == HardwareSpecific.Hardware; + break; + } + + if (!board_is_expected_for_model) + { + // the board returned in the packet, does not match the expected board for the Model selected + BoardMismatch = $"The board returned from network query was: {BoardID.ToString()}\nExpected board for model selected is: {HardwareSpecific.Hardware.ToString()}\n\nIf this is expected you can ignore this warning"; + } + else + { + BoardMismatch = ""; + } + } + + return ret; + } + + private static float _swr_protect = 1.0f; + public static float SWRProtect + { + get { return _swr_protect; } + set { _swr_protect = value; } + } + + public static void SetOutputPower(float f) + { + if (f < 0.0) + { + f = 0.0F; + } + if (f >= 1.0) + { + f = 1.0F; + } + + int i = (int)(255 * f * _swr_protect); + SetOutputPowerFactor(i); + } + + private static double[][] _lastVFOfreq = new double[2][] { new double[] { 0.0, 0.0, 0.0, 0.0 }, new double[] { 0.0 } }; + unsafe public static void VFOfreq(int id, double f, int tx) + { + _lastVFOfreq[tx][id] = f; + int f_freq; + f_freq = (int)((f * 1e6) * _freq_correction_factor); + if (f_freq >= 0) + if (CurrentRadioProtocol == RadioProtocol.USB) + SetVFOfreq(id, f_freq, tx); // sending freq Hz to firmware + else SetVFOfreq(id, Freq2PhaseWord(f_freq), tx); // sending phaseword to firmware + } + + private static double _freq_correction_factor = 1.0; + public static double FreqCorrectionFactor + { + get { return _freq_correction_factor; } + set + { + _freq_correction_factor = value; + FreqCorrectionChanged(); + } + } + + public static void FreqCorrectionChanged() + { + if (!Console.FreqCalibrationRunning) // we can't be applying freq correction when cal is running + { + VFOfreq(0, _lastVFOfreq[0][0], 0); + VFOfreq(1, _lastVFOfreq[0][1], 0); + VFOfreq(2, _lastVFOfreq[0][2], 0); + VFOfreq(3, _lastVFOfreq[0][3], 0); + VFOfreq(0, _lastVFOfreq[1][0], 1); + } + } + + public static int Freq2PhaseWord(int freq) // freq to phaseword conversion + { + long pw = (long)Math.Pow(2, 32) * freq / 122880000; + return (int)pw; + } + + private static double _low_freq_offset; + public static double LowFreqOffset + { + get { return _low_freq_offset; } + set + { + _low_freq_offset = value; + } + } + + private static double _high_freq_offset; + public static double HighFreqOffset + { + get { return _high_freq_offset; } + set + { + _high_freq_offset = value; + } + } + } +} + ///* -//* -//* Copyright (C) 2006 Bill Tracey, KD5TFD, bill@ewjt.com -//* Copyright (C) 2010-2020 Doug Wigley -//* -//* This program is free software; you can redistribute it and/or modify -//* it under the terms of the GNU General Public License as published by -//* the Free Software Foundation; either version 2 of the License, or -//* (at your option) any later version. -//* -//* This program is distributed in the hope that it will be useful, -//* but WITHOUT ANY WARRANTY; without even the implied warranty of -//* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//* GNU General Public License for more details. -//* -//* You should have received a copy of the GNU General Public License -//* along with this program; if not, write to the Free Software -//* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//*/ - -//namespace Thetis -//{ -// using System; -// using System.Collections.Generic; -// using System.Net; -// using System.Net.Sockets; -// using System.Net.NetworkInformation; -// using System.Windows.Forms; - -// partial class NetworkIO -// { -// public NetworkIO() -// { -// } - - -// public static bool isFirmwareLoaded = false; - -// private static float swr_protect = 1.0f; -// public static float SWRProtect -// { -// get { return swr_protect; } -// set { swr_protect = value; } -// } - -// public static void SetOutputPower(float f) -// { -// if (f < 0.0) -// { -// f = 0.0F; -// } -// if (f >= 1.0) -// { -// f = 1.0F; -// } - -// int i = (int)(255 * f * swr_protect); -// //System.Console.WriteLine("output power i: " + i); -// SetOutputPowerFactor(i); -// } - -// // get the name of this PC and, using it, the IP address of the first adapter -// //static string strHostName = Dns.GetHostName(); -// // public static IPAddress[] addr = Dns.GetHostEntry(Dns.GetHostName()).AddressList; -// // get a socket to send and receive on -// static Socket socket; // = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); -// // set an endpoint -// static IPEndPoint iep; -// static byte[] data = new byte[1444]; -// const int DiscoveryPort = 1024; -// const int LocalPort = 0; -// public static bool enableStaticIP { get; set; } = false; -// public static uint static_host_network { get; set; } = 0; -// public static bool FastConnect { get; set; } = false; -// public static HPSDRHW BoardID { get; set; } = HPSDRHW.Hermes; -// public static byte FWCodeVersion { get; set; } = 0; -// public static byte BetaVersion { get; set; } = 0; -// public static byte ProtocolSupported { get; set; } = 0; -// public static string EthernetHostIPAddress { get; set; } = ""; -// public static int EthernetHostPort { get; set; } = 0; -// public static string HpSdrHwIpAddress { get; set; } = ""; -// public static string HpSdrHwMacAddress { get; set; } = ""; -// public static byte NumRxs { get; set; } = 0; -// public static RadioProtocol CurrentRadioProtocol { get; set; } = RadioProtocol.ETH; -// public static RadioProtocol RadioProtocolSelected { get; set; } = RadioProtocol.ETH; - -// private const int IP_SUCCESS = 0; -// private const short VERSION = 0x202;//2; //MW0LGE_22b -// public static int initRadio() -// { -// int rc; -// // System.Console.WriteLine("Static IP: " + Console.getConsole().HPSDRNetworkIPAddr); -// int adapterIndex = adapterSelected - 1; -// IPAddress[] addr = null; -// bool cleanup = false; - -// try -// { -// addr = Dns.GetHostAddresses(Dns.GetHostName()); -// } -// catch (SocketException) -// { -// Win32.WSAData data = new Win32.WSAData(); -// int result = 0; - -// result = Win32.WSAStartup(VERSION, out data); -// if (result != IP_SUCCESS) -// { -// System.Console.WriteLine(data.description); -// Win32.WSACleanup(); -// } - -// addr = Dns.GetHostAddresses(Dns.GetHostName()); -// cleanup = true; -// // System.Console.WriteLine("SocketException caught!!!"); -// // System.Console.WriteLine("Source : " + e.Source); -// // System.Console.WriteLine("Message : " + e.Message); -// } -// catch (Exception e) -// { -// System.Console.WriteLine("Exception caught!!!"); -// System.Console.WriteLine("Source : " + e.Source); -// System.Console.WriteLine("Message : " + e.Message); -// } - -// GetNetworkInterfaces(); - -// List addrList = new List(); - -// // make a list of all the adapters that we found in Dns.GetHostEntry(strHostName).AddressList -// foreach (IPAddress a in addr) -// { -// // make sure to get only IPV4 addresses! -// // test added because Erik Anderson noted an issue on Windows 7. May have been in the socket -// // construction or binding below. -// if (a.AddressFamily == AddressFamily.InterNetwork) -// { -// addrList.Add(a); -// } -// } - -// bool foundRadio = false; -// List hpsdrd = new List(); - -// if (enableStaticIP) -// { -// HpSdrHwIpAddress = Console.getConsole().HPSDRNetworkIPAddr; - -// IPAddress remoteIp = IPAddress.Parse(HpSdrHwIpAddress); -// IPEndPoint remoteEndPoint = new IPEndPoint(remoteIp, 0); -// Socket sock = new Socket( -// AddressFamily.InterNetwork, -// SocketType.Dgram, -// ProtocolType.Udp); -// IPEndPoint localEndPoint = QueryRoutingInterface(sock, remoteEndPoint); -// if (localEndPoint != null) //[2.10.3.7]MW0LGE null check added, and changed to tryparse -// { -// if (IPAddress.TryParse(localEndPoint.Address.ToString(), out IPAddress ep_ip)) -// { -// EthernetHostIPAddress = ep_ip.ToString(); -// } -// } - -// sock.Close(); -// sock = null; - -// // if success set foundRadio to true, and fill in ONE hpsdrd entry. -// IPAddress targetIP; -// IPAddress hostIP; -// if (IPAddress.TryParse(EthernetHostIPAddress, out hostIP) && IPAddress.TryParse(HpSdrHwIpAddress, out targetIP)) -// { -// System.Console.WriteLine(String.Format("Attempting connect to host adapter {0}, Static IP {1}", EthernetHostIPAddress, HpSdrHwIpAddress)); - -// if (DiscoverRadioOnPort(ref hpsdrd, hostIP, targetIP)) -// { -// foundRadio = true; - -// // make sure that there is only one entry in the list! -// if (hpsdrd.Count > 0) -// { -// // remove the extra ones that don't match! -// HPSDRDevice m2 = null; -// foreach (var m in hpsdrd) -// { -// if (m.IPAddress.CompareTo(HpSdrHwIpAddress) == 0) -// { -// m2 = m; -// } -// } - -// // clear the list and put our single element in it, if we found it. -// hpsdrd.Clear(); -// if (m2 != null) -// { -// hpsdrd.Add(m2); -// } -// else -// { -// foundRadio = false; -// } -// } -// } -// } -// } - -// if (FastConnect && (EthernetHostIPAddress.Length > 0) && (HpSdrHwIpAddress.Length > 0)) -// { -// // if success set foundRadio to true, and fill in ONE hpsdrd entry. -// IPAddress targetIP; -// IPAddress hostIP; -// if (IPAddress.TryParse(EthernetHostIPAddress, out hostIP) && IPAddress.TryParse(HpSdrHwIpAddress, out targetIP)) -// { -// System.Console.WriteLine(String.Format("Attempting fast re-connect to host adapter {0}, IP {1}", EthernetHostIPAddress, HpSdrHwIpAddress)); - -// if (DiscoverRadioOnPort(ref hpsdrd, hostIP, targetIP)) -// { -// foundRadio = true; - -// // make sure that there is only one entry in the list! -// if (hpsdrd.Count > 0) -// { -// // remove the extra ones that don't match! -// HPSDRDevice m2 = null; -// foreach (var m in hpsdrd) -// { -// if (m.IPAddress.CompareTo(HpSdrHwIpAddress) == 0) -// { -// m2 = m; -// } -// } - -// // clear the list and put our single element in it, if we found it. -// hpsdrd.Clear(); -// if (m2 != null) -// { -// hpsdrd.Add(m2); -// } -// else -// { -// foundRadio = false; -// } -// } -// } -// } -// } - -// if (!foundRadio) -// { -// foreach (IPAddress ipa in addrList) -// { -// if (DiscoverRadioOnPort(ref hpsdrd, ipa, null)) -// { -// foundRadio = true; -// } -// } -// } - -// if (!foundRadio) -// { -// if (cleanup) -// Win32.WSACleanup(); -// return -1; -// } - -// int chosenDevice = 0; - -// BoardID = hpsdrd[chosenDevice].deviceType; -// FWCodeVersion = hpsdrd[chosenDevice].codeVersion; -// BetaVersion = hpsdrd[chosenDevice].betaVersion; -// ProtocolSupported = hpsdrd[chosenDevice].protocolSupported; -// HpSdrHwIpAddress = hpsdrd[chosenDevice].IPAddress; -// HpSdrHwMacAddress = hpsdrd[chosenDevice].MACAddress; -// EthernetHostIPAddress = hpsdrd[chosenDevice].hostPortIPAddress.ToString(); -// EthernetHostPort = hpsdrd[chosenDevice].localPort; -// NumRxs = hpsdrd[chosenDevice].numRxs; - -// if (BoardID == HPSDRHW.HermesII) -// { -// if (FWCodeVersion < 103) -// { -// fwVersionMsg = "Invalid Firmware!\nRequires 10.3 or greater. "; -// return -101; -// } -// } - -// //[2.10.3.9]MW0LGE added board check, issue icon shown in setup -// bool board_is_expected_for_model; -// switch (HardwareSpecific.Model) -// { -// case HPSDRModel.REDPITAYA: -// board_is_expected_for_model = BoardID == HPSDRHW.Hermes || BoardID == HPSDRHW.OrionMKII; // can be these two -// break; -// case HPSDRModel.ANAN10: -// case HPSDRModel.ANAN10E: -// case HPSDRModel.ANAN100: -// case HPSDRModel.ANAN100B: -// board_is_expected_for_model = BoardID == HPSDRHW.Hermes || BoardID == HPSDRHW.HermesII; // can be these two -// break; -// default: -// board_is_expected_for_model = BoardID == HardwareSpecific.Hardware; -// break; -// } - -// if(!board_is_expected_for_model) -// { -// // the board returned in the packet, does not match the expected board for the Model selected -// _board_mismatch = $"The board returned from network query was:\n\n{BoardID.ToString()}\n\nExpected board for model selected is:\n\n{HardwareSpecific.Hardware.ToString()}\n\nIf this is expected you can ignore this warning"; -// } -// else -// { -// _board_mismatch = ""; -// } -// // - -// rc = nativeInitMetis(HpSdrHwIpAddress, EthernetHostIPAddress, EthernetHostPort, (int)CurrentRadioProtocol, (int)HardwareSpecific.Model); -// return -rc; -// } - -// private static string _board_mismatch = ""; -// public static string BoardMismatch -// { -// get { return _board_mismatch; } -// } - -// public static bool fwVersionsChecked = false; -// private static string fwVersionMsg = null; - -// public static string getFWVersionErrorMsg() -// { -// return fwVersionMsg; -// } - -// public static bool forceFWGood = false; - -// private static bool legacyDotDashPTT = false; - -// // checks if the firmware versions are consistent - returns false if they are not -// // and set fwVersionmsg to point to an appropriate message -// private static bool fwVersionsGood() -// { -// return true; -// } - -// // returns -101 for firmware version error -// unsafe public static int StartAudio() -// { -// if (initRadio() != 0) -// { -// return 1; -// } - -// int result = StartAudioNative(); - -// if (result == 0 && !fwVersionsChecked) -// { -// if (!fwVersionsGood()) -// { -// result = -101; -// } -// else -// { -// fwVersionsChecked = true; -// } -// } - -// return result; -// } - -// unsafe public static int GetDotDashPTT() -// { -// int bits = nativeGetDotDashPTT(); -// if (legacyDotDashPTT) // old style dot and ptt overloaded on 0x1 bit, new style dot on 0x4, ptt on 0x1 -// { -// if ((bits & 0x1) != 0) -// { -// bits |= 0x4; -// } -// } -// return bits; -// } - -// private static double freq_correction_factor = 1.0; -// public static double FreqCorrectionFactor -// { -// get { return freq_correction_factor; } -// set -// { -// freq_correction_factor = value; -// freqCorrectionChanged(); -// } -// } - -// public static void freqCorrectionChanged() -// { -// if (!Console.FreqCalibrationRunning) // we can't be applying freq correction when cal is running -// { -// VFOfreq(0, lastVFOfreq[0][0], 0); -// VFOfreq(1, lastVFOfreq[0][1], 0); -// VFOfreq(2, lastVFOfreq[0][2], 0); -// VFOfreq(3, lastVFOfreq[0][3], 0); -// VFOfreq(0, lastVFOfreq[1][0], 1); -// } -// } - -// private static double[][] lastVFOfreq = new double[2][] { new double[] { 0.0, 0.0, 0.0, 0.0 }, new double[] { 0.0 } }; -// unsafe public static void VFOfreq(int id, double f, int tx) -// { -// lastVFOfreq[tx][id] = f; -// int f_freq; -// f_freq = (int)((f * 1e6) * freq_correction_factor); -// if (f_freq >= 0) -// if(CurrentRadioProtocol == RadioProtocol.USB) -// SetVFOfreq(id, f_freq, tx); // sending freq Hz to firmware -// else SetVFOfreq(id, Freq2PW(f_freq), tx); // sending phaseword to firmware -// } - -// public static int Freq2PW(int freq) // freq to phaseword conversion -// { -// long pw = (long)Math.Pow(2, 32) * freq / 122880000; -// return (int)pw; -// } - -// private static double low_freq_offset; -// public static double LowFreqOffset -// { -// get { return low_freq_offset; } -// set -// { -// low_freq_offset = value; -// } -// } - -// private static double high_freq_offset; -// public static double HighFreqOffset -// { -// get { return high_freq_offset; } -// set -// { -// high_freq_offset = value; -// } -// } - -// // Taken from: KISS Konsole -// public static List foundNics = new List(); -// public static List nicProperties = new List(); -// public static string numberOfIPAdapters; -// public static string Network_interfaces = null; // holds a list with the description of each Network Adapter -// public static int adapterSelected = 1; // from Setup form, the number of the Network Adapter to use - -// public static void GetNetworkInterfaces() -// { -// // creat a string that contains the name and speed of each Network adapter -// NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces(); - -// foundNics.Clear(); -// nicProperties.Clear(); - -// Network_interfaces = ""; -// int adapterNumber = 1; - -// foreach (var netInterface in nics) -// { -// if ((netInterface.OperationalStatus == OperationalStatus.Up || -// netInterface.OperationalStatus == OperationalStatus.Unknown) && -// (netInterface.NetworkInterfaceType == NetworkInterfaceType.Wireless80211 || -// netInterface.NetworkInterfaceType == NetworkInterfaceType.Ethernet)) -// { -// foreach (var addrInfo in netInterface.GetIPProperties().UnicastAddresses) -// { -// if (addrInfo.Address.AddressFamily == AddressFamily.InterNetwork) -// { -// NicProperties np = new NicProperties(); -// np.ipv4Address = addrInfo.Address; -// np.ipv4Mask = addrInfo.IPv4Mask; -// nicProperties.Add(np); -// } -// } -// } - -// // if the length of the network adapter name is > 31 characters then trim it, if shorter then pad to 31. -// // Need to use fixed width font - Courier New -// string speed = " " + (netInterface.Speed / 1000000).ToString() + "T"; -// if (netInterface.Description.Length > 31) -// { -// Network_interfaces += adapterNumber++.ToString() + ". " + netInterface.Description.Remove(31) + speed + "\n"; -// } -// else -// { -// Network_interfaces += adapterNumber++.ToString() + ". " + netInterface.Description.PadRight(31, ' ') + speed + "\n"; -// } - -// foundNics.Add(netInterface); -// } - - -// System.Console.WriteLine(Network_interfaces); - -// // display number of adapters on Setup form -// numberOfIPAdapters = (adapterNumber - 1).ToString(); -// } - -// private static bool DiscoverRadioOnPort(ref List hpsdrdList, IPAddress HostIP, IPAddress targetIP) -// { -// bool result = false; - -// // configure a new socket object for each Ethernet port we're scanning -// socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); - -// // Listen to data on this PC's IP address. Allow the program to allocate a free port. -// iep = new IPEndPoint(HostIP, LocalPort); // was iep = new IPEndPoint(ipa, 0); - -// try -// { -// // bind to socket and Port -// socket.Bind(iep); -// // socket.ReceiveBufferSize = 0xFFFFF; // no lost frame counts at 192kHz with this setting -// socket.Blocking = true; - -// IPEndPoint localEndPoint = (IPEndPoint)socket.LocalEndPoint; -// System.Console.WriteLine("Looking for radio using host adapter IP {0}, port {1}", localEndPoint.Address, localEndPoint.Port); - -// if (Discovery(ref hpsdrdList, iep, targetIP)) -// { -// result = true; -// } - -// } -// catch (System.Exception ex) -// { -// System.Console.WriteLine("Caught an exception while binding a socket to endpoint {0}. Exception was: {1} ", iep.ToString(), ex.ToString()); -// result = false; -// } -// finally -// { -// socket.Close(); -// socket = null; -// } - -// return result; -// } - - -// private static bool Discovery(ref List hpsdrdList, IPEndPoint iep, IPAddress targetIP) -// { -// // set up HPSDR discovery packet -// string MAC; -// byte[] DiscoveryPacketP1 = new byte[63]; -// Array.Clear(DiscoveryPacketP1, 0, DiscoveryPacketP1.Length); -// DiscoveryPacketP1[0] = 0xef; -// DiscoveryPacketP1[1] = 0xfe; -// DiscoveryPacketP1[2] = 0x02; -// byte[] DiscoveryPacketP2 = new byte[60]; -// Array.Clear(DiscoveryPacketP2, 0, DiscoveryPacketP2.Length); -// DiscoveryPacketP2[4] = 0x02; - -// bool radio_found = false; // true when we find a radio -// bool static_ip_ok = true; -// int time_out = 0; - -// // set socket option so that broadcast is allowed. -// socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, 1); - -// // need this so we can Broadcast on the socket -// IPEndPoint broadcast;// = new IPEndPoint(IPAddress.Broadcast, DiscoveryPort); -// string receivedIP; // the IP address Metis obtains; assigned, from DHCP or APIPA (169.254.x.y) - -// IPAddress hostPortIPAddress = iep.Address; -// IPAddress hostPortMask = IPAddress.Broadcast; - -// // find the subnet mask that goes with this host port -// foreach (NicProperties n in nicProperties) -// { -// if (hostPortIPAddress.Equals(n.ipv4Address)) -// { -// hostPortMask = n.ipv4Mask; -// break; -// } -// } - -// // send every second until we either find a radio or exceed the number of attempts -// while (!radio_found) // #### djm should loop for a while in case there are multiple radios -// { -// // send a broadcast to port 1024 -// // try target ip address 1 time if static -// if (enableStaticIP && static_ip_ok) -// broadcast = new IPEndPoint(targetIP, DiscoveryPort); -// else -// // try directed broadcast address -// broadcast = new IPEndPoint(IPAddressExtensions.GetBroadcastAddress(hostPortIPAddress, hostPortMask), DiscoveryPort); - -// if (RadioProtocolSelected == RadioProtocol.Auto || RadioProtocolSelected == RadioProtocol.USB) -// socket.SendTo(DiscoveryPacketP1, broadcast); -// if (RadioProtocolSelected == RadioProtocol.Auto || RadioProtocolSelected == RadioProtocol.ETH) -// socket.SendTo(DiscoveryPacketP2, broadcast); - -// // now listen on send port for any radio -// System.Console.WriteLine("Ready to receive.... "); -// int recv; -// byte[] data = new byte[100]; - -// bool data_available; - -// // await possibly multiple replies, if there are multiple radios on this port, -// // which MIGHT be the 'any' port, 0.0.0.0 -// do -// { -// // Poll the port to see if data is available -// data_available = socket.Poll(100000, SelectMode.SelectRead); // wait 100 msec for time out - -// if (data_available) -// { -// EndPoint remoteEP = new IPEndPoint(IPAddress.None, 0); -// recv = socket.ReceiveFrom(data, ref remoteEP); // recv has number of bytes we received -// //string stringData = Encoding.ASCII.GetString(data, 0, recv); // use this to print the received data - -// System.Console.WriteLine("RAW Discovery data = " + BitConverter.ToString(data, 0, recv)); -// // see what port this came from at the remote end -// // IPEndPoint remoteIpEndPoint = socket.RemoteEndPoint as IPEndPoint; -// // System.Console.WriteLine(" Remote Port # = ", remoteIpEndPoint.Port); - -// string junk = Convert.ToString(remoteEP); // see code in DataLoop -// string[] words = junk.Split(':'); -// System.Console.Write(words[1]); - -// //[2.10.3.5]MW0LGE sigh, MAC address in P1 is NOT at data[5], but at data[3] -// //// get MAC address from the payload -// //byte[] mac = { 0, 0, 0, 0, 0, 0 }; -// //Array.Copy(data, 5, mac, 0, 6); -// //MAC = BitConverter.ToString(mac); - -// byte[] mac = { 0, 0, 0, 0, 0, 0 }; -// if ((data[0] == 0xef) && // Protocol-USB (P1) -// (data[1] == 0xfe) && -// ((data[2] == 0x2) || (data[2] == 0x3))) -// { -// Array.Copy(data, 3, mac, 0, 6); -// } -// else if ((data[0] == 0x0) && // Protocol-ETH (P2) -// (data[1] == 0x0) && -// (data[2] == 0x0) && -// (data[3] == 0x0) && -// ((data[4] == 0x2) || (data[4] == 0x3))) -// { -// Array.Copy(data, 5, mac, 0, 6); -// } -// MAC = BitConverter.ToString(mac); - -// // check for HPSDR frame ID and type 2 (not currently streaming data, which also means 'not yet in use') -// // changed to filter a proper discovery packet from the radio, even if already in use! This prevents the need to power-cycle the radio. -// if (((data[0] == 0xef) && // Protocol-USB (P1) Busy -// (data[1] == 0xfe) && -// (data[2] == 0x3)) || -// ((data[0] == 0x0) && // Protocol-ETH (P2) Busy -// (data[1] == 0x0) && -// (data[2] == 0x0) && -// (data[3] == 0x0) && -// (data[4] == 0x3))) -// { -// System.Console.WriteLine("Radio Busy"); -// return false; -// } - -// if (((data[0] == 0xef) && // Protocol-USB (P1) -// (data[1] == 0xfe) && -// (data[2] == 0x2)) || -// ((data[0] == 0x0) && // Protocol-ETH (P2) -// (data[1] == 0x0) && -// (data[2] == 0x0) && -// (data[3] == 0x0) && -// (data[4] == 0x2))) -// { -// if (data[2] == 0x2) CurrentRadioProtocol = RadioProtocol.USB; -// else CurrentRadioProtocol = RadioProtocol.ETH; -// freqCorrectionChanged(); - -// System.Console.WriteLine("\nFound a radio on the network. Checking whether it qualifies"); - -// // get IP address from the IPEndPoint passed to ReceiveFrom. -// IPEndPoint ripep = (IPEndPoint)remoteEP; -// IPAddress receivedIPAddr = ripep.Address; -// receivedIP = receivedIPAddr.ToString(); -// IPEndPoint localEndPoint = (IPEndPoint)socket.LocalEndPoint; -// System.Console.WriteLine("Looking for radio using host adapter IP {0}, port {1}", localEndPoint.Address, localEndPoint.Port); - -// System.Console.WriteLine("IP from IP Header = " + receivedIP); -// System.Console.WriteLine("MAC address from payload = " + MAC); - -// if (!SameSubnet(receivedIPAddr, hostPortIPAddress, hostPortMask)) -// { -// // device is NOT on the subnet that this port actually services. Do NOT add to list! -// System.Console.WriteLine("Not on subnet of host adapter! Adapter IP {0}, Adapter mask {1}", -// hostPortIPAddress.ToString(), hostPortMask.ToString()); -// } -// else if (MAC.Equals("00-00-00-00-00-00")) -// { -// System.Console.WriteLine("Rejected: contains bogus MAC address of all-zeroes"); -// } -// else -// { -// HPSDRDevice hpsdrd = new HPSDRDevice -// { -// IPAddress = receivedIP, -// MACAddress = MAC, -// deviceType = CurrentRadioProtocol == RadioProtocol.USB ? (HPSDRHW)data[10] : (HPSDRHW)data[11], -// protocolSupported = CurrentRadioProtocol == RadioProtocol.USB ? (byte)0 : data[12], -// codeVersion = CurrentRadioProtocol == RadioProtocol.USB ? data[9] : data[13], -// hostPortIPAddress = hostPortIPAddress, -// localPort = localEndPoint.Port, -// MercuryVersion_0 = data[14], -// MercuryVersion_1 = data[15], -// MercuryVersion_2 = data[16], -// MercuryVersion_3 = data[17], -// PennyVersion = data[18], -// MetisVersion = data[19], -// numRxs = data[20], -// betaVersion = CurrentRadioProtocol == RadioProtocol.USB ? (byte)0 : data[23], -// protocol = CurrentRadioProtocol -// }; - -// // Map P1 device types to P2 -// if (CurrentRadioProtocol == RadioProtocol.USB) -// { -// switch(data[10]) -// { -// case 0: -// hpsdrd.deviceType = HPSDRHW.Atlas; -// break; -// case 1: -// hpsdrd.deviceType = HPSDRHW.Hermes; -// break; -// case 2: -// hpsdrd.deviceType = HPSDRHW.HermesII; -// break; -// case 4: -// hpsdrd.deviceType = HPSDRHW.Angelia; -// break; -// case 5: -// hpsdrd.deviceType = HPSDRHW.Orion; -// break; -// case 10: // a G2 will clash here if ever uses P1 and uses 10 for board_id (as it does for P2) -// hpsdrd.deviceType = HPSDRHW.OrionMKII; -// break; -// } -// } - -// if (targetIP != null) -// { -// if (hpsdrd.IPAddress.CompareTo(targetIP.ToString()) == 0) -// { -// radio_found = true; -// hpsdrdList.Add(hpsdrd); -// return true; -// } -// } -// else -// { -// radio_found = true; -// hpsdrdList.Add(hpsdrd); -// } -// } -// } -// } -// else -// { -// System.Console.WriteLine("No data from Port = "); -// if ((++time_out) > 5) -// { -// System.Console.WriteLine("Time out!"); -// return false; -// } -// static_ip_ok = false; -// } -// } while (data_available); -// } - -// return radio_found; -// } - -// /// -// /// Determines whether the board and hostAdapter IPAddresses are on the same subnet, -// /// using subnetMask to make the determination. All addresses are IPV4 addresses -// /// -// /// IP address of the remote device -// /// IP address of the ethernet adapter -// /// subnet mask to use to determine if the above 2 IPAddresses are on the same subnet -// /// true if same subnet, false otherwise -// public static bool SameSubnet(IPAddress board, IPAddress hostAdapter, IPAddress subnetMask) -// { -// byte[] boardBytes = board.GetAddressBytes(); -// byte[] hostAdapterBytes = hostAdapter.GetAddressBytes(); -// byte[] subnetMaskBytes = subnetMask.GetAddressBytes(); - -// if (boardBytes.Length != hostAdapterBytes.Length) -// { -// return false; -// } -// if (subnetMaskBytes.Length != hostAdapterBytes.Length) -// { -// return false; -// } - -// for (int i = 0; i < boardBytes.Length; ++i) -// { -// byte boardByte = (byte)(boardBytes[i] & subnetMaskBytes[i]); -// byte hostAdapterByte = (byte)(hostAdapterBytes[i] & subnetMaskBytes[i]); -// if (boardByte != hostAdapterByte) -// { -// return false; -// } -// } -// return true; -// } - -// // Taken From: https://searchcode.com/codesearch/view/7464800/ -// private static IPEndPoint QueryRoutingInterface( -// Socket socket, -// IPEndPoint remoteEndPoint) -// { -// try -// { -// SocketAddress address = remoteEndPoint.Serialize(); - -// byte[] remoteAddrBytes = new byte[address.Size]; -// for (int i = 0; i < address.Size; i++) -// { -// remoteAddrBytes[i] = address[i]; -// } - -// byte[] outBytes = new byte[remoteAddrBytes.Length]; -// socket.IOControl( -// IOControlCode.RoutingInterfaceQuery, -// remoteAddrBytes, -// outBytes); -// for (int i = 0; i < address.Size; i++) -// { -// address[i] = outBytes[i]; -// } - -// EndPoint ep = remoteEndPoint.Create(address); -// return (IPEndPoint)ep; -// } -// catch -// { -// return null; //[2.10.3.7]MW0LGE added try catch -// } -// } - -// } - -// // Taken from: http://blogs.msdn.com/b/knom/archive/2008/12/31/ip-address-calculations-with-c-subnetmasks-networks.aspx -// public static class IPAddressExtensions -// { -// public static IPAddress GetBroadcastAddress(this IPAddress address, IPAddress subnetMask) -// { -// byte[] ipAdressBytes = address.GetAddressBytes(); -// byte[] subnetMaskBytes = subnetMask.GetAddressBytes(); - -// if (ipAdressBytes.Length != subnetMaskBytes.Length) -// throw new ArgumentException("Lengths of IP address and subnet mask do not match."); - -// byte[] broadcastAddress = new byte[ipAdressBytes.Length]; -// for (int i = 0; i < broadcastAddress.Length; i++) -// { -// broadcastAddress[i] = (byte)(ipAdressBytes[i] | (subnetMaskBytes[i] ^ 255)); -// } -// return new IPAddress(broadcastAddress); -// } -// } - -// public class HPSDRDevice -// { -// public HPSDRHW deviceType; // which type of device -// public byte codeVersion; // reported code version type -// public string IPAddress; // IPV4 address -// public string MACAddress; // physical (MAC) address -// public IPAddress hostPortIPAddress; -// public int localPort; -// public byte MercuryVersion_0; -// public byte MercuryVersion_1; -// public byte MercuryVersion_2; -// public byte MercuryVersion_3; -// public byte PennyVersion; -// public byte MetisVersion; -// public byte numRxs; -// public RadioProtocol protocol; -// public byte betaVersion; // byte[23] from P2 discovery packet. MW0LGE_21d -// public byte protocolSupported; // byte[12] from P2 discovery packet. MW0LGE_21d -// } - -// public class NicProperties -// { -// public IPAddress ipv4Address; -// public IPAddress ipv4Mask; -// } - - -//} +//* +//* Copyright (C) 2006 Bill Tracey, KD5TFD, bill@ewjt.com +//* Copyright (C) 2010-2020 Doug Wigley +//* +//* This program is free software; you can redistribute it and/or modify +//* it under the terms of the GNU General Public License as published by +//* the Free Software Foundation; either version 2 of the License, or +//* (at your option) any later version. +//* +//* This program is distributed in the hope that it will be useful, +//* but WITHOUT ANY WARRANTY; without even the implied warranty of +//* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +//* GNU General Public License for more details. +//* +//* You should have received a copy of the GNU General Public License +//* along with this program; if not, write to the Free Software +//* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +//*/ + +//namespace Thetis +//{ +// using System; +// using System.Collections.Generic; +// using System.Net; +// using System.Net.Sockets; +// using System.Net.NetworkInformation; +// using System.Windows.Forms; + +// partial class NetworkIO +// { +// public NetworkIO() +// { +// } + + +// public static bool isFirmwareLoaded = false; + +// private static float swr_protect = 1.0f; +// public static float SWRProtect +// { +// get { return swr_protect; } +// set { swr_protect = value; } +// } + +// public static void SetOutputPower(float f) +// { +// if (f < 0.0) +// { +// f = 0.0F; +// } +// if (f >= 1.0) +// { +// f = 1.0F; +// } + +// int i = (int)(255 * f * swr_protect); +// //System.Console.WriteLine("output power i: " + i); +// SetOutputPowerFactor(i); +// } + +// // get the name of this PC and, using it, the IP address of the first adapter +// //static string strHostName = Dns.GetHostName(); +// // public static IPAddress[] addr = Dns.GetHostEntry(Dns.GetHostName()).AddressList; +// // get a socket to send and receive on +// static Socket socket; // = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); +// // set an endpoint +// static IPEndPoint iep; +// static byte[] data = new byte[1444]; +// const int DiscoveryPort = 1024; +// const int LocalPort = 0; +// public static bool enableStaticIP { get; set; } = false; +// public static uint static_host_network { get; set; } = 0; +// public static bool FastConnect { get; set; } = false; +// public static HPSDRHW BoardID { get; set; } = HPSDRHW.Hermes; +// public static byte FWCodeVersion { get; set; } = 0; +// public static byte BetaVersion { get; set; } = 0; +// public static byte ProtocolSupported { get; set; } = 0; +// public static string EthernetHostIPAddress { get; set; } = ""; +// public static int EthernetHostPort { get; set; } = 0; +// public static string HpSdrHwIpAddress { get; set; } = ""; +// public static string HpSdrHwMacAddress { get; set; } = ""; +// public static byte NumRxs { get; set; } = 0; +// public static RadioProtocol CurrentRadioProtocol { get; set; } = RadioProtocol.ETH; +// public static RadioProtocol RadioProtocolSelected { get; set; } = RadioProtocol.ETH; + +// private const int IP_SUCCESS = 0; +// private const short VERSION = 0x202;//2; //MW0LGE_22b +// public static int initRadio() +// { +// int rc; +// // System.Console.WriteLine("Static IP: " + Console.getConsole().HPSDRNetworkIPAddr); +// int adapterIndex = adapterSelected - 1; +// IPAddress[] addr = null; +// bool cleanup = false; + +// try +// { +// addr = Dns.GetHostAddresses(Dns.GetHostName()); +// } +// catch (SocketException) +// { +// Win32.WSAData data = new Win32.WSAData(); +// int result = 0; + +// result = Win32.WSAStartup(VERSION, out data); +// if (result != IP_SUCCESS) +// { +// System.Console.WriteLine(data.description); +// Win32.WSACleanup(); +// } + +// addr = Dns.GetHostAddresses(Dns.GetHostName()); +// cleanup = true; +// // System.Console.WriteLine("SocketException caught!!!"); +// // System.Console.WriteLine("Source : " + e.Source); +// // System.Console.WriteLine("Message : " + e.Message); +// } +// catch (Exception e) +// { +// System.Console.WriteLine("Exception caught!!!"); +// System.Console.WriteLine("Source : " + e.Source); +// System.Console.WriteLine("Message : " + e.Message); +// } + +// GetNetworkInterfaces(); + +// List addrList = new List(); + +// // make a list of all the adapters that we found in Dns.GetHostEntry(strHostName).AddressList +// foreach (IPAddress a in addr) +// { +// // make sure to get only IPV4 addresses! +// // test added because Erik Anderson noted an issue on Windows 7. May have been in the socket +// // construction or binding below. +// if (a.AddressFamily == AddressFamily.InterNetwork) +// { +// addrList.Add(a); +// } +// } + +// bool foundRadio = false; +// List hpsdrd = new List(); + +// if (enableStaticIP) +// { +// HpSdrHwIpAddress = Console.getConsole().HPSDRNetworkIPAddr; + +// IPAddress remoteIp = IPAddress.Parse(HpSdrHwIpAddress); +// IPEndPoint remoteEndPoint = new IPEndPoint(remoteIp, 0); +// Socket sock = new Socket( +// AddressFamily.InterNetwork, +// SocketType.Dgram, +// ProtocolType.Udp); +// IPEndPoint localEndPoint = QueryRoutingInterface(sock, remoteEndPoint); +// if (localEndPoint != null) //[2.10.3.7]MW0LGE null check added, and changed to tryparse +// { +// if (IPAddress.TryParse(localEndPoint.Address.ToString(), out IPAddress ep_ip)) +// { +// EthernetHostIPAddress = ep_ip.ToString(); +// } +// } + +// sock.Close(); +// sock = null; + +// // if success set foundRadio to true, and fill in ONE hpsdrd entry. +// IPAddress targetIP; +// IPAddress hostIP; +// if (IPAddress.TryParse(EthernetHostIPAddress, out hostIP) && IPAddress.TryParse(HpSdrHwIpAddress, out targetIP)) +// { +// System.Console.WriteLine(String.Format("Attempting connect to host adapter {0}, Static IP {1}", EthernetHostIPAddress, HpSdrHwIpAddress)); + +// if (DiscoverRadioOnPort(ref hpsdrd, hostIP, targetIP)) +// { +// foundRadio = true; + +// // make sure that there is only one entry in the list! +// if (hpsdrd.Count > 0) +// { +// // remove the extra ones that don't match! +// HPSDRDevice m2 = null; +// foreach (var m in hpsdrd) +// { +// if (m.IPAddress.CompareTo(HpSdrHwIpAddress) == 0) +// { +// m2 = m; +// } +// } + +// // clear the list and put our single element in it, if we found it. +// hpsdrd.Clear(); +// if (m2 != null) +// { +// hpsdrd.Add(m2); +// } +// else +// { +// foundRadio = false; +// } +// } +// } +// } +// } + +// if (FastConnect && (EthernetHostIPAddress.Length > 0) && (HpSdrHwIpAddress.Length > 0)) +// { +// // if success set foundRadio to true, and fill in ONE hpsdrd entry. +// IPAddress targetIP; +// IPAddress hostIP; +// if (IPAddress.TryParse(EthernetHostIPAddress, out hostIP) && IPAddress.TryParse(HpSdrHwIpAddress, out targetIP)) +// { +// System.Console.WriteLine(String.Format("Attempting fast re-connect to host adapter {0}, IP {1}", EthernetHostIPAddress, HpSdrHwIpAddress)); + +// if (DiscoverRadioOnPort(ref hpsdrd, hostIP, targetIP)) +// { +// foundRadio = true; + +// // make sure that there is only one entry in the list! +// if (hpsdrd.Count > 0) +// { +// // remove the extra ones that don't match! +// HPSDRDevice m2 = null; +// foreach (var m in hpsdrd) +// { +// if (m.IPAddress.CompareTo(HpSdrHwIpAddress) == 0) +// { +// m2 = m; +// } +// } + +// // clear the list and put our single element in it, if we found it. +// hpsdrd.Clear(); +// if (m2 != null) +// { +// hpsdrd.Add(m2); +// } +// else +// { +// foundRadio = false; +// } +// } +// } +// } +// } + +// if (!foundRadio) +// { +// foreach (IPAddress ipa in addrList) +// { +// if (DiscoverRadioOnPort(ref hpsdrd, ipa, null)) +// { +// foundRadio = true; +// } +// } +// } + +// if (!foundRadio) +// { +// if (cleanup) +// Win32.WSACleanup(); +// return -1; +// } + +// int chosenDevice = 0; + +// BoardID = hpsdrd[chosenDevice].deviceType; +// FWCodeVersion = hpsdrd[chosenDevice].codeVersion; +// BetaVersion = hpsdrd[chosenDevice].betaVersion; +// ProtocolSupported = hpsdrd[chosenDevice].protocolSupported; +// HpSdrHwIpAddress = hpsdrd[chosenDevice].IPAddress; +// HpSdrHwMacAddress = hpsdrd[chosenDevice].MACAddress; +// EthernetHostIPAddress = hpsdrd[chosenDevice].hostPortIPAddress.ToString(); +// EthernetHostPort = hpsdrd[chosenDevice].localPort; +// NumRxs = hpsdrd[chosenDevice].numRxs; + +// if (BoardID == HPSDRHW.HermesII) +// { +// if (FWCodeVersion < 103) +// { +// fwVersionMsg = "Invalid Firmware!\nRequires 10.3 or greater. "; +// return -101; +// } +// } + +// //[2.10.3.9]MW0LGE added board check, issue icon shown in setup +// bool board_is_expected_for_model; +// switch (HardwareSpecific.Model) +// { +// case HPSDRModel.REDPITAYA: +// board_is_expected_for_model = BoardID == HPSDRHW.Hermes || BoardID == HPSDRHW.OrionMKII; // can be these two +// break; +// case HPSDRModel.ANAN10: +// case HPSDRModel.ANAN10E: +// case HPSDRModel.ANAN100: +// case HPSDRModel.ANAN100B: +// board_is_expected_for_model = BoardID == HPSDRHW.Hermes || BoardID == HPSDRHW.HermesII; // can be these two +// break; +// default: +// board_is_expected_for_model = BoardID == HardwareSpecific.Hardware; +// break; +// } + +// if(!board_is_expected_for_model) +// { +// // the board returned in the packet, does not match the expected board for the Model selected +// _board_mismatch = $"The board returned from network query was:\n\n{BoardID.ToString()}\n\nExpected board for model selected is:\n\n{HardwareSpecific.Hardware.ToString()}\n\nIf this is expected you can ignore this warning"; +// } +// else +// { +// _board_mismatch = ""; +// } +// // + +// rc = nativeInitMetis(HpSdrHwIpAddress, EthernetHostIPAddress, EthernetHostPort, (int)CurrentRadioProtocol, (int)HardwareSpecific.Model); +// return -rc; +// } + +// private static string _board_mismatch = ""; +// public static string BoardMismatch +// { +// get { return _board_mismatch; } +// } + +// public static bool fwVersionsChecked = false; +// private static string fwVersionMsg = null; + +// public static string getFWVersionErrorMsg() +// { +// return fwVersionMsg; +// } + +// public static bool forceFWGood = false; + +// private static bool legacyDotDashPTT = false; + +// // checks if the firmware versions are consistent - returns false if they are not +// // and set fwVersionmsg to point to an appropriate message +// private static bool fwVersionsGood() +// { +// return true; +// } + +// // returns -101 for firmware version error +// unsafe public static int StartAudio() +// { +// if (initRadio() != 0) +// { +// return 1; +// } + +// int result = StartAudioNative(); + +// if (result == 0 && !fwVersionsChecked) +// { +// if (!fwVersionsGood()) +// { +// result = -101; +// } +// else +// { +// fwVersionsChecked = true; +// } +// } + +// return result; +// } + +// unsafe public static int GetDotDashPTT() +// { +// int bits = nativeGetDotDashPTT(); +// if (legacyDotDashPTT) // old style dot and ptt overloaded on 0x1 bit, new style dot on 0x4, ptt on 0x1 +// { +// if ((bits & 0x1) != 0) +// { +// bits |= 0x4; +// } +// } +// return bits; +// } + +// private static double freq_correction_factor = 1.0; +// public static double FreqCorrectionFactor +// { +// get { return freq_correction_factor; } +// set +// { +// freq_correction_factor = value; +// freqCorrectionChanged(); +// } +// } + +// public static void freqCorrectionChanged() +// { +// if (!Console.FreqCalibrationRunning) // we can't be applying freq correction when cal is running +// { +// VFOfreq(0, lastVFOfreq[0][0], 0); +// VFOfreq(1, lastVFOfreq[0][1], 0); +// VFOfreq(2, lastVFOfreq[0][2], 0); +// VFOfreq(3, lastVFOfreq[0][3], 0); +// VFOfreq(0, lastVFOfreq[1][0], 1); +// } +// } + +// private static double[][] lastVFOfreq = new double[2][] { new double[] { 0.0, 0.0, 0.0, 0.0 }, new double[] { 0.0 } }; +// unsafe public static void VFOfreq(int id, double f, int tx) +// { +// lastVFOfreq[tx][id] = f; +// int f_freq; +// f_freq = (int)((f * 1e6) * freq_correction_factor); +// if (f_freq >= 0) +// if(CurrentRadioProtocol == RadioProtocol.USB) +// SetVFOfreq(id, f_freq, tx); // sending freq Hz to firmware +// else SetVFOfreq(id, Freq2PW(f_freq), tx); // sending phaseword to firmware +// } + +// public static int Freq2PW(int freq) // freq to phaseword conversion +// { +// long pw = (long)Math.Pow(2, 32) * freq / 122880000; +// return (int)pw; +// } + +// private static double low_freq_offset; +// public static double LowFreqOffset +// { +// get { return low_freq_offset; } +// set +// { +// low_freq_offset = value; +// } +// } + +// private static double high_freq_offset; +// public static double HighFreqOffset +// { +// get { return high_freq_offset; } +// set +// { +// high_freq_offset = value; +// } +// } + +// // Taken from: KISS Konsole +// public static List foundNics = new List(); +// public static List nicProperties = new List(); +// public static string numberOfIPAdapters; +// public static string Network_interfaces = null; // holds a list with the description of each Network Adapter +// public static int adapterSelected = 1; // from Setup form, the number of the Network Adapter to use + +// public static void GetNetworkInterfaces() +// { +// // creat a string that contains the name and speed of each Network adapter +// NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces(); + +// foundNics.Clear(); +// nicProperties.Clear(); + +// Network_interfaces = ""; +// int adapterNumber = 1; + +// foreach (var netInterface in nics) +// { +// if ((netInterface.OperationalStatus == OperationalStatus.Up || +// netInterface.OperationalStatus == OperationalStatus.Unknown) && +// (netInterface.NetworkInterfaceType == NetworkInterfaceType.Wireless80211 || +// netInterface.NetworkInterfaceType == NetworkInterfaceType.Ethernet)) +// { +// foreach (var addrInfo in netInterface.GetIPProperties().UnicastAddresses) +// { +// if (addrInfo.Address.AddressFamily == AddressFamily.InterNetwork) +// { +// NicProperties np = new NicProperties(); +// np.ipv4Address = addrInfo.Address; +// np.ipv4Mask = addrInfo.IPv4Mask; +// nicProperties.Add(np); +// } +// } +// } + +// // if the length of the network adapter name is > 31 characters then trim it, if shorter then pad to 31. +// // Need to use fixed width font - Courier New +// string speed = " " + (netInterface.Speed / 1000000).ToString() + "T"; +// if (netInterface.Description.Length > 31) +// { +// Network_interfaces += adapterNumber++.ToString() + ". " + netInterface.Description.Remove(31) + speed + "\n"; +// } +// else +// { +// Network_interfaces += adapterNumber++.ToString() + ". " + netInterface.Description.PadRight(31, ' ') + speed + "\n"; +// } + +// foundNics.Add(netInterface); +// } + + +// System.Console.WriteLine(Network_interfaces); + +// // display number of adapters on Setup form +// numberOfIPAdapters = (adapterNumber - 1).ToString(); +// } + +// private static bool DiscoverRadioOnPort(ref List hpsdrdList, IPAddress HostIP, IPAddress targetIP) +// { +// bool result = false; + +// // configure a new socket object for each Ethernet port we're scanning +// socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); + +// // Listen to data on this PC's IP address. Allow the program to allocate a free port. +// iep = new IPEndPoint(HostIP, LocalPort); // was iep = new IPEndPoint(ipa, 0); + +// try +// { +// // bind to socket and Port +// socket.Bind(iep); +// // socket.ReceiveBufferSize = 0xFFFFF; // no lost frame counts at 192kHz with this setting +// socket.Blocking = true; + +// IPEndPoint localEndPoint = (IPEndPoint)socket.LocalEndPoint; +// System.Console.WriteLine("Looking for radio using host adapter IP {0}, port {1}", localEndPoint.Address, localEndPoint.Port); + +// if (Discovery(ref hpsdrdList, iep, targetIP)) +// { +// result = true; +// } + +// } +// catch (System.Exception ex) +// { +// System.Console.WriteLine("Caught an exception while binding a socket to endpoint {0}. Exception was: {1} ", iep.ToString(), ex.ToString()); +// result = false; +// } +// finally +// { +// socket.Close(); +// socket = null; +// } + +// return result; +// } + + +// private static bool Discovery(ref List hpsdrdList, IPEndPoint iep, IPAddress targetIP) +// { +// // set up HPSDR discovery packet +// string MAC; +// byte[] DiscoveryPacketP1 = new byte[63]; +// Array.Clear(DiscoveryPacketP1, 0, DiscoveryPacketP1.Length); +// DiscoveryPacketP1[0] = 0xef; +// DiscoveryPacketP1[1] = 0xfe; +// DiscoveryPacketP1[2] = 0x02; +// byte[] DiscoveryPacketP2 = new byte[60]; +// Array.Clear(DiscoveryPacketP2, 0, DiscoveryPacketP2.Length); +// DiscoveryPacketP2[4] = 0x02; + +// bool radio_found = false; // true when we find a radio +// bool static_ip_ok = true; +// int time_out = 0; + +// // set socket option so that broadcast is allowed. +// socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, 1); + +// // need this so we can Broadcast on the socket +// IPEndPoint broadcast;// = new IPEndPoint(IPAddress.Broadcast, DiscoveryPort); +// string receivedIP; // the IP address Metis obtains; assigned, from DHCP or APIPA (169.254.x.y) + +// IPAddress hostPortIPAddress = iep.Address; +// IPAddress hostPortMask = IPAddress.Broadcast; + +// // find the subnet mask that goes with this host port +// foreach (NicProperties n in nicProperties) +// { +// if (hostPortIPAddress.Equals(n.ipv4Address)) +// { +// hostPortMask = n.ipv4Mask; +// break; +// } +// } + +// // send every second until we either find a radio or exceed the number of attempts +// while (!radio_found) // #### djm should loop for a while in case there are multiple radios +// { +// // send a broadcast to port 1024 +// // try target ip address 1 time if static +// if (enableStaticIP && static_ip_ok) +// broadcast = new IPEndPoint(targetIP, DiscoveryPort); +// else +// // try directed broadcast address +// broadcast = new IPEndPoint(IPAddressExtensions.GetBroadcastAddress(hostPortIPAddress, hostPortMask), DiscoveryPort); + +// if (RadioProtocolSelected == RadioProtocol.Auto || RadioProtocolSelected == RadioProtocol.USB) +// socket.SendTo(DiscoveryPacketP1, broadcast); +// if (RadioProtocolSelected == RadioProtocol.Auto || RadioProtocolSelected == RadioProtocol.ETH) +// socket.SendTo(DiscoveryPacketP2, broadcast); + +// // now listen on send port for any radio +// System.Console.WriteLine("Ready to receive.... "); +// int recv; +// byte[] data = new byte[100]; + +// bool data_available; + +// // await possibly multiple replies, if there are multiple radios on this port, +// // which MIGHT be the 'any' port, 0.0.0.0 +// do +// { +// // Poll the port to see if data is available +// data_available = socket.Poll(100000, SelectMode.SelectRead); // wait 100 msec for time out + +// if (data_available) +// { +// EndPoint remoteEP = new IPEndPoint(IPAddress.None, 0); +// recv = socket.ReceiveFrom(data, ref remoteEP); // recv has number of bytes we received +// //string stringData = Encoding.ASCII.GetString(data, 0, recv); // use this to print the received data + +// System.Console.WriteLine("RAW Discovery data = " + BitConverter.ToString(data, 0, recv)); +// // see what port this came from at the remote end +// // IPEndPoint remoteIpEndPoint = socket.RemoteEndPoint as IPEndPoint; +// // System.Console.WriteLine(" Remote Port # = ", remoteIpEndPoint.Port); + +// string junk = Convert.ToString(remoteEP); // see code in DataLoop +// string[] words = junk.Split(':'); +// System.Console.Write(words[1]); + +// //[2.10.3.5]MW0LGE sigh, MAC address in P1 is NOT at data[5], but at data[3] +// //// get MAC address from the payload +// //byte[] mac = { 0, 0, 0, 0, 0, 0 }; +// //Array.Copy(data, 5, mac, 0, 6); +// //MAC = BitConverter.ToString(mac); + +// byte[] mac = { 0, 0, 0, 0, 0, 0 }; +// if ((data[0] == 0xef) && // Protocol-USB (P1) +// (data[1] == 0xfe) && +// ((data[2] == 0x2) || (data[2] == 0x3))) +// { +// Array.Copy(data, 3, mac, 0, 6); +// } +// else if ((data[0] == 0x0) && // Protocol-ETH (P2) +// (data[1] == 0x0) && +// (data[2] == 0x0) && +// (data[3] == 0x0) && +// ((data[4] == 0x2) || (data[4] == 0x3))) +// { +// Array.Copy(data, 5, mac, 0, 6); +// } +// MAC = BitConverter.ToString(mac); + +// // check for HPSDR frame ID and type 2 (not currently streaming data, which also means 'not yet in use') +// // changed to filter a proper discovery packet from the radio, even if already in use! This prevents the need to power-cycle the radio. +// if (((data[0] == 0xef) && // Protocol-USB (P1) Busy +// (data[1] == 0xfe) && +// (data[2] == 0x3)) || +// ((data[0] == 0x0) && // Protocol-ETH (P2) Busy +// (data[1] == 0x0) && +// (data[2] == 0x0) && +// (data[3] == 0x0) && +// (data[4] == 0x3))) +// { +// System.Console.WriteLine("Radio Busy"); +// return false; +// } + +// if (((data[0] == 0xef) && // Protocol-USB (P1) +// (data[1] == 0xfe) && +// (data[2] == 0x2)) || +// ((data[0] == 0x0) && // Protocol-ETH (P2) +// (data[1] == 0x0) && +// (data[2] == 0x0) && +// (data[3] == 0x0) && +// (data[4] == 0x2))) +// { +// if (data[2] == 0x2) CurrentRadioProtocol = RadioProtocol.USB; +// else CurrentRadioProtocol = RadioProtocol.ETH; +// freqCorrectionChanged(); + +// System.Console.WriteLine("\nFound a radio on the network. Checking whether it qualifies"); + +// // get IP address from the IPEndPoint passed to ReceiveFrom. +// IPEndPoint ripep = (IPEndPoint)remoteEP; +// IPAddress receivedIPAddr = ripep.Address; +// receivedIP = receivedIPAddr.ToString(); +// IPEndPoint localEndPoint = (IPEndPoint)socket.LocalEndPoint; +// System.Console.WriteLine("Looking for radio using host adapter IP {0}, port {1}", localEndPoint.Address, localEndPoint.Port); + +// System.Console.WriteLine("IP from IP Header = " + receivedIP); +// System.Console.WriteLine("MAC address from payload = " + MAC); + +// if (!SameSubnet(receivedIPAddr, hostPortIPAddress, hostPortMask)) +// { +// // device is NOT on the subnet that this port actually services. Do NOT add to list! +// System.Console.WriteLine("Not on subnet of host adapter! Adapter IP {0}, Adapter mask {1}", +// hostPortIPAddress.ToString(), hostPortMask.ToString()); +// } +// else if (MAC.Equals("00-00-00-00-00-00")) +// { +// System.Console.WriteLine("Rejected: contains bogus MAC address of all-zeroes"); +// } +// else +// { +// HPSDRDevice hpsdrd = new HPSDRDevice +// { +// IPAddress = receivedIP, +// MACAddress = MAC, +// deviceType = CurrentRadioProtocol == RadioProtocol.USB ? (HPSDRHW)data[10] : (HPSDRHW)data[11], +// protocolSupported = CurrentRadioProtocol == RadioProtocol.USB ? (byte)0 : data[12], +// codeVersion = CurrentRadioProtocol == RadioProtocol.USB ? data[9] : data[13], +// hostPortIPAddress = hostPortIPAddress, +// localPort = localEndPoint.Port, +// MercuryVersion_0 = data[14], +// MercuryVersion_1 = data[15], +// MercuryVersion_2 = data[16], +// MercuryVersion_3 = data[17], +// PennyVersion = data[18], +// MetisVersion = data[19], +// numRxs = data[20], +// betaVersion = CurrentRadioProtocol == RadioProtocol.USB ? (byte)0 : data[23], +// protocol = CurrentRadioProtocol +// }; + +// // Map P1 device types to P2 +// if (CurrentRadioProtocol == RadioProtocol.USB) +// { +// switch(data[10]) +// { +// case 0: +// hpsdrd.deviceType = HPSDRHW.Atlas; +// break; +// case 1: +// hpsdrd.deviceType = HPSDRHW.Hermes; +// break; +// case 2: +// hpsdrd.deviceType = HPSDRHW.HermesII; +// break; +// case 4: +// hpsdrd.deviceType = HPSDRHW.Angelia; +// break; +// case 5: +// hpsdrd.deviceType = HPSDRHW.Orion; +// break; +// case 10: // a G2 will clash here if ever uses P1 and uses 10 for board_id (as it does for P2) +// hpsdrd.deviceType = HPSDRHW.OrionMKII; +// break; +// } +// } + +// if (targetIP != null) +// { +// if (hpsdrd.IPAddress.CompareTo(targetIP.ToString()) == 0) +// { +// radio_found = true; +// hpsdrdList.Add(hpsdrd); +// return true; +// } +// } +// else +// { +// radio_found = true; +// hpsdrdList.Add(hpsdrd); +// } +// } +// } +// } +// else +// { +// System.Console.WriteLine("No data from Port = "); +// if ((++time_out) > 5) +// { +// System.Console.WriteLine("Time out!"); +// return false; +// } +// static_ip_ok = false; +// } +// } while (data_available); +// } + +// return radio_found; +// } + +// /// +// /// Determines whether the board and hostAdapter IPAddresses are on the same subnet, +// /// using subnetMask to make the determination. All addresses are IPV4 addresses +// /// +// /// IP address of the remote device +// /// IP address of the ethernet adapter +// /// subnet mask to use to determine if the above 2 IPAddresses are on the same subnet +// /// true if same subnet, false otherwise +// public static bool SameSubnet(IPAddress board, IPAddress hostAdapter, IPAddress subnetMask) +// { +// byte[] boardBytes = board.GetAddressBytes(); +// byte[] hostAdapterBytes = hostAdapter.GetAddressBytes(); +// byte[] subnetMaskBytes = subnetMask.GetAddressBytes(); + +// if (boardBytes.Length != hostAdapterBytes.Length) +// { +// return false; +// } +// if (subnetMaskBytes.Length != hostAdapterBytes.Length) +// { +// return false; +// } + +// for (int i = 0; i < boardBytes.Length; ++i) +// { +// byte boardByte = (byte)(boardBytes[i] & subnetMaskBytes[i]); +// byte hostAdapterByte = (byte)(hostAdapterBytes[i] & subnetMaskBytes[i]); +// if (boardByte != hostAdapterByte) +// { +// return false; +// } +// } +// return true; +// } + +// // Taken From: https://searchcode.com/codesearch/view/7464800/ +// private static IPEndPoint QueryRoutingInterface( +// Socket socket, +// IPEndPoint remoteEndPoint) +// { +// try +// { +// SocketAddress address = remoteEndPoint.Serialize(); + +// byte[] remoteAddrBytes = new byte[address.Size]; +// for (int i = 0; i < address.Size; i++) +// { +// remoteAddrBytes[i] = address[i]; +// } + +// byte[] outBytes = new byte[remoteAddrBytes.Length]; +// socket.IOControl( +// IOControlCode.RoutingInterfaceQuery, +// remoteAddrBytes, +// outBytes); +// for (int i = 0; i < address.Size; i++) +// { +// address[i] = outBytes[i]; +// } + +// EndPoint ep = remoteEndPoint.Create(address); +// return (IPEndPoint)ep; +// } +// catch +// { +// return null; //[2.10.3.7]MW0LGE added try catch +// } +// } + +// } + +// // Taken from: http://blogs.msdn.com/b/knom/archive/2008/12/31/ip-address-calculations-with-c-subnetmasks-networks.aspx +// public static class IPAddressExtensions +// { +// public static IPAddress GetBroadcastAddress(this IPAddress address, IPAddress subnetMask) +// { +// byte[] ipAdressBytes = address.GetAddressBytes(); +// byte[] subnetMaskBytes = subnetMask.GetAddressBytes(); + +// if (ipAdressBytes.Length != subnetMaskBytes.Length) +// throw new ArgumentException("Lengths of IP address and subnet mask do not match."); + +// byte[] broadcastAddress = new byte[ipAdressBytes.Length]; +// for (int i = 0; i < broadcastAddress.Length; i++) +// { +// broadcastAddress[i] = (byte)(ipAdressBytes[i] | (subnetMaskBytes[i] ^ 255)); +// } +// return new IPAddress(broadcastAddress); +// } +// } + +// public class HPSDRDevice +// { +// public HPSDRHW deviceType; // which type of device +// public byte codeVersion; // reported code version type +// public string IPAddress; // IPV4 address +// public string MACAddress; // physical (MAC) address +// public IPAddress hostPortIPAddress; +// public int localPort; +// public byte MercuryVersion_0; +// public byte MercuryVersion_1; +// public byte MercuryVersion_2; +// public byte MercuryVersion_3; +// public byte PennyVersion; +// public byte MetisVersion; +// public byte numRxs; +// public RadioProtocol protocol; +// public byte betaVersion; // byte[23] from P2 discovery packet. MW0LGE_21d +// public byte protocolSupported; // byte[12] from P2 discovery packet. MW0LGE_21d +// } + +// public class NicProperties +// { +// public IPAddress ipv4Address; +// public IPAddress ipv4Mask; +// } + + +//} diff --git a/Project Files/Source/Console/HPSDR/NetworkIOImports.cs b/Project Files/Source/Console/HPSDR/NetworkIOImports.cs index 0d8873a2..a0f669f4 100644 --- a/Project Files/Source/Console/HPSDR/NetworkIOImports.cs +++ b/Project Files/Source/Console/HPSDR/NetworkIOImports.cs @@ -41,10 +41,10 @@ unsafe partial class NetworkIO [DllImport("ChannelMaster.dll", CallingConvention = CallingConvention.Cdecl)] public static extern bool getSeqInDelta(bool bInit, int rx, int[] deltas, StringBuilder dateTimeStamp, out uint received_seqnum, out uint last_seqnum); - + [DllImport("ChannelMaster.dll", CallingConvention = CallingConvention.Cdecl)] - public static extern void clearSnapshots(); - + public static extern void clearSnapshots(); + [DllImport("ChannelMaster.dll", EntryPoint = "create_rnet", CallingConvention = CallingConvention.Cdecl)] public static extern void CreateRNet(); @@ -54,14 +54,14 @@ unsafe partial class NetworkIO [DllImport("ChannelMaster.dll", CallingConvention = CallingConvention.Cdecl)] public static extern int GetMetisIPAddr(); - [DllImport("ChannelMaster.dll", CallingConvention = CallingConvention.Cdecl)] - public static extern void GetMACAddr(byte[] addr_bytes); + //[DllImport("ChannelMaster.dll", CallingConvention = CallingConvention.Cdecl)] + //public static extern void GetMACAddr(byte[] addr_bytes); - [DllImport("ChannelMaster.dll", CallingConvention = CallingConvention.Cdecl)] - public static extern void GetCodeVersion(byte[] addr_bytes); + //[DllImport("ChannelMaster.dll", CallingConvention = CallingConvention.Cdecl)] + //public static extern void GetCodeVersion(byte[] addr_bytes); - [DllImport("ChannelMaster.dll", CallingConvention = CallingConvention.Cdecl)] - public static extern void GetBoardID(byte[] addr_bytes); + //[DllImport("ChannelMaster.dll", CallingConvention = CallingConvention.Cdecl)] + //public static extern void GetBoardID(byte[] addr_bytes); [DllImport("ChannelMaster.dll", CallingConvention = CallingConvention.Cdecl)] public static extern int StartAudioNative(); @@ -270,11 +270,11 @@ unsafe partial class NetworkIO public static extern int getHermesDCVoltage(); [DllImport("ChannelMaster.dll", CallingConvention = CallingConvention.Cdecl)] - public static extern void EnableCWKeyer(int enable); - + public static extern void EnableCWKeyer(int enable); + [DllImport("ChannelMaster.dll", CallingConvention = CallingConvention.Cdecl)] - public static extern void SetSidetoneRun(int id, int enable); - + public static extern void SetSidetoneRun(int id, int enable); + [DllImport("ChannelMaster.dll", CallingConvention = CallingConvention.Cdecl)] public static extern void SetSidetoneVolume(int id, double volume); @@ -317,6 +317,9 @@ unsafe partial class NetworkIO [DllImport("ChannelMaster.dll", CallingConvention = CallingConvention.Cdecl)] public static extern void SetCWX(int bit); + [DllImport("ChannelMaster.dll", CallingConvention = CallingConvention.Cdecl)] + public static extern void SetCWXPTT(int bit); // MI0BOT: Pass PTT for CWX + [DllImport("ChannelMaster.dll", CallingConvention = CallingConvention.Cdecl)] public static extern void SetCWIambic(int bit); @@ -351,8 +354,8 @@ unsafe partial class NetworkIO public static extern void SetADC_cntrl2(int g); [DllImport("ChannelMaster.dll", CallingConvention = CallingConvention.Cdecl)] - public static extern int GetADC_cntrl2(); - + public static extern int GetADC_cntrl2(); + [DllImport("ChannelMaster.dll", CallingConvention = CallingConvention.Cdecl)] public static extern void SetADC_cntrl_P1(int g); @@ -372,15 +375,39 @@ unsafe partial class NetworkIO public static extern int SendStopToMetis(); [DllImport("ChannelMaster.dll", CallingConvention = CallingConvention.Cdecl)] - public static extern void LRAudioSwap(int swap); - + public static extern void LRAudioSwap(int swap); + [DllImport("ChannelMaster.dll", CallingConvention = CallingConvention.Cdecl)] - public static extern void SetCATPort(int port); - - //bandwdith monitoring + public static extern void SetCATPort(int port); + [DllImport("ChannelMaster.dll", CallingConvention = CallingConvention.Cdecl)] - public static extern double GetInboundBps(); - + public static extern void SetTxLatency(int txLatency); // MI0BIT: Pass hardware TX latency to HL2 + + [DllImport("ChannelMaster.dll", CallingConvention = CallingConvention.Cdecl)] + public static extern void SetPttHang(int pttHang); // MI0BIT: Pass hardware PTT hang to HL2 + + [DllImport("ChannelMaster.dll", CallingConvention = CallingConvention.Cdecl)] + public static extern void SetResetOnDisconnect(int bit); // MI0BIT: Control reset on network disconnect + + [DllImport("ChannelMaster.dll", CallingConvention = CallingConvention.Cdecl)] + public static extern void SwapAudioChannels(int bit); // MI0BIT: Control to swap the left and right audio channels send over P1 + + [DllImport("ChannelMaster.dll", CallingConvention = CallingConvention.Cdecl)] + public static extern int I2CReadInitiate(int bus, int address, int control); // MI0BIT: I2C read start for HL2 + + [DllImport("ChannelMaster.dll", CallingConvention = CallingConvention.Cdecl)] + public static extern int I2CWriteInitiate(int bus, int address, int control, int data); // MI0BIT: I2C write start for HL2 + + [DllImport("ChannelMaster.dll", CallingConvention = CallingConvention.Cdecl)] + public static extern int I2CWrite(int bus, int address, int control, int data); // MI0BIT: I2C write for HL2 + + [DllImport("ChannelMaster.dll", CallingConvention = CallingConvention.Cdecl)] + public static extern int I2CResponse(byte[] read_data); // MI0BIT: I2C read response for HL2 + + //bandwdith monitoring + [DllImport("ChannelMaster.dll", CallingConvention = CallingConvention.Cdecl)] + public static extern double GetInboundBps(); + [DllImport("ChannelMaster.dll", CallingConvention = CallingConvention.Cdecl)] public static extern double GetOutboundBps(); } diff --git a/Project Files/Source/Console/HPSDR/Penny.cs b/Project Files/Source/Console/HPSDR/Penny.cs index eaf5d724..1f0b488a 100644 --- a/Project Files/Source/Console/HPSDR/Penny.cs +++ b/Project Files/Source/Console/HPSDR/Penny.cs @@ -171,11 +171,31 @@ public int UpdateExtCtrl(Band band, Band bandb, bool tx, bool tune, bool twoTone } else { - if (tx && VFOBTX) - bits = TXABitMasks[idxb]; - else if (tx) - bits = TXABitMasks[idx]; - else bits = RXABitMasks[idx]; + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) // MI0BOT: Select correct LPF for 2 receivers + { + if (tx) + { + if (VFOBTX) + bits = TXABitMasks[idxb]; + else + bits = TXABitMasks[idx]; + } + else + { + if (Console.getConsole().RX2Enabled && (idxb > idx)) // MI0BOT: Select the filter for the high band + bits = RXABitMasks[idxb]; + else + bits = RXABitMasks[idx]; + } + } + else + { + if (tx && VFOBTX) + bits = TXABitMasks[idxb]; + else if (tx) + bits = TXABitMasks[idx]; + else bits = RXABitMasks[idx]; + } } } diff --git a/Project Files/Source/Console/HPSDR/clsRadioDiscovery.cs b/Project Files/Source/Console/HPSDR/clsRadioDiscovery.cs index a34ec314..0659f2ab 100644 --- a/Project Files/Source/Console/HPSDR/clsRadioDiscovery.cs +++ b/Project Files/Source/Console/HPSDR/clsRadioDiscovery.cs @@ -511,9 +511,12 @@ public sealed class RadioInfo { public RadioDiscoveryRadioProtocol Protocol { get; set; } public IPAddress IpAddress { get; set; } + public string IpAddressFixedHL2 { get; set; } // MI0BOT: Extra info from discovery for HL2 public string MacAddress { get; set; } public HPSDRHW DeviceType { get; set; } public byte CodeVersion { get; set; } + public byte EeConfigHL2{ get; set; } // MI0BOT: Extra info from discovery for HL2 + public byte EeConfigReservedHL2{ get; set; } // MI0BOT: Extra info from discovery for HL2 public byte BetaVersion { get; set; } public byte Protocol2Supported { get; set; } public byte NumRxs { get; set; } @@ -1059,6 +1062,11 @@ private List discoverOnNic(IPAddress localIPv4, IPAddress localMaskIP info.PortCount = parsed.Protocol == RadioDiscoveryRadioProtocol.P2 ? P2DefaultPortCount : P1DefaultPortCount; info.IsApipaRadio = isApipa(rep.Address); + info.IpAddressFixedHL2 = parsed.FixedIpHL2; // MI0BOT: Extra info from discovery for HL2 + info.EeConfigHL2 = parsed.EeConfigHL2; + info.EeConfigReservedHL2 = parsed.EeConfigReservedHL2; + + info.IsCustom = false; info.CustomGuid = ""; @@ -1106,6 +1114,9 @@ private sealed class DiscoveryParseResult public bool IsBusy { get; set; } public RadioDiscoveryRadioProtocol Protocol { get; set; } public string MacAddress { get; set; } + public string FixedIpHL2 { get; set; } // MI0BOT: Extra info from discovery for HL2 + public byte EeConfigHL2 { get; set; } // MI0BOT: Extra info from discovery for HL2 + public byte EeConfigReservedHL2 { get; set; } // MI0BOT: Extra info from discovery for HL2 public HPSDRHW DeviceType { get; set; } public byte CodeVersion { get; set; } public byte BetaVersion { get; set; } @@ -1151,9 +1162,27 @@ private DiscoveryParseResult parseDiscoveryReply(byte[] data, int len, IPAddress r.MacAddress = BitConverter.ToString(mac); r.DeviceType = mapP1DeviceType(data[10]); + + switch (r.DeviceType) + { + case HPSDRHW.HermesLite: + byte[] fixedIp = new byte[4]; // MI0BOT: Extra info from discovery for HL2 + Array.Copy(data, 13, fixedIp, 0, 4); + Array.Reverse(fixedIp); + r.FixedIpHL2 = BitConverter.ToString(fixedIp); + r.EeConfigHL2 = data[11]; + r.EeConfigReservedHL2 = data[12]; + r.BetaVersion = data[21]; + r.NumRxs = data[19]; + break; + + default: + r.BetaVersion = 0; + break; + } + r.ProtocolSupported = 0; r.CodeVersion = data[9]; - r.BetaVersion = 0; if (len > 20) { @@ -1207,6 +1236,7 @@ private HPSDRHW mapP1DeviceType(byte boardId) if (boardId == 2) return HPSDRHW.HermesII; if (boardId == 4) return HPSDRHW.Angelia; if (boardId == 5) return HPSDRHW.Orion; + if (boardId == 6) return HPSDRHW.HermesLite; // MI0BOT: HL2 added if (boardId == 10) return HPSDRHW.OrionMKII; return (HPSDRHW)boardId; } diff --git a/Project Files/Source/Console/Midi2CatCommands.cs b/Project Files/Source/Console/Midi2CatCommands.cs index b6aed552..9a98e7d4 100644 --- a/Project Files/Source/Console/Midi2CatCommands.cs +++ b/Project Files/Source/Console/Midi2CatCommands.cs @@ -6377,6 +6377,34 @@ public CmdState ExternalPAOnOff(int msg, MidiDevice device) } return CmdState.NoChange; } + + public void CWXKey(int msg, MidiDevice device) //MI0BOT: CW keying via MIDI + { + if (127 == msg) + { + NetworkIO.SetCWX(1); + } + else + { + NetworkIO.SetCWX(0); + } + + return; + } + + public void CWXPTT(int msg, MidiDevice device) //MI0BOT: CW PTT via MIDI + { + if (127 == msg) + { + NetworkIO.SetCWXPTT(1); + } + else + { + NetworkIO.SetCWXPTT(0); + } + + return; + } //MW0LGE_21k9d public void ZoomToBandRecall(int msg, MidiDevice device) diff --git a/Project Files/Source/Console/PSForm.cs b/Project Files/Source/Console/PSForm.cs index 31aa2275..61f343be 100644 --- a/Project Files/Source/Console/PSForm.cs +++ b/Project Files/Source/Console/PSForm.cs @@ -24,7 +24,7 @@ You should have received a copy of the GNU General Public License The author can be reached by email at mw0lge@grange-lane.co.uk -*/ +*/ // //============================================================================================// // Dual-Licensing Statement (Applies Only to Author's Contributions, Richard Samphire MW0LGE) // @@ -38,38 +38,38 @@ The author can be reached by email at // its original terms and is not affected by this dual-licensing statement in any way. // // Richard Samphire can be reached by email at : mw0lge@grange-lane.co.uk // //============================================================================================// - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Windows.Forms; -using System.Runtime.InteropServices; -using System.Threading; -using System.Threading.Tasks; -using System.Diagnostics; - -namespace Thetis -{ - public partial class PSForm : Form - { - #region constructor - - private Console console; - - public PSForm(Console c) - { - Debug.Print(DateTime.UtcNow.Ticks.ToString() + " PSForm: Constructor Start"); - - InitializeComponent(); - Common.DoubleBufferAll(this, true); - - txtPSpeak.Text = ""; - - console = c; // MW0LGE moved above restore, so that we actaully have console when control events fire because of restore form + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using System.Runtime.InteropServices; +using System.Threading; +using System.Threading.Tasks; +using System.Diagnostics; + +namespace Thetis +{ + public partial class PSForm : Form + { + #region constructor + + private Console console; + + public PSForm(Console c) + { + Debug.Print(DateTime.UtcNow.Ticks.ToString() + " PSForm: Constructor Start"); + + InitializeComponent(); + Common.DoubleBufferAll(this, true); + + txtPSpeak.Text = ""; + + console = c; // MW0LGE moved above restore, so that we actaully have console when control events fire because of restore form Common.RestoreForm(this, "PureSignal", false); // will also restore txtPSpeak //MW0LGE_21k9rc5 @@ -81,33 +81,33 @@ public PSForm(Console c) _power = console.PowerOn; startPSThread(); // MW0LGE_21k8 removed the winform timers, now using dedicated thread - } - - #endregion - - #region variables - - private int _gcolor = (0xFF << 24) | (0xFF << 8); - private static bool _autoON = false; - private static bool _singlecalON = false; - private static bool _restoreON = false; - private static bool _OFF = true; - //private int oldCalCount = 0; - //private int red, green, blue; - private eAAState _autoAttenuateState = eAAState.Monitor; - private static double _PShwpeak; - private static double _GetPSpeakval; - - public static AmpView ampv = null; - public static Thread ampvThread = null; - - //private int oldCalCount2 = 0; - private int _save_autoON = 0; - private int _save_singlecalON = 0; - private int _deltadB = 0; - - private bool _power; - + } + + #endregion + + #region variables + + private int _gcolor = (0xFF << 24) | (0xFF << 8); + private static bool _autoON = false; + private static bool _singlecalON = false; + private static bool _restoreON = false; + private static bool _OFF = true; + //private int oldCalCount = 0; + //private int red, green, blue; + private eAAState _autoAttenuateState = eAAState.Monitor; + private static double _PShwpeak; + private static double _GetPSpeakval; + + public static AmpView ampv = null; + public static Thread ampvThread = null; + + //private int oldCalCount2 = 0; + private int _save_autoON = 0; + private int _save_singlecalON = 0; + private int _deltadB = 0; + + private bool _power; + private enum eCMDState { OFF = 0, @@ -118,22 +118,22 @@ private enum eCMDState StayON = 5, TurnOFF = 6, IntiateRestoredCorrection = 7 - } + } private enum eAAState { Monitor = 0, SetNewValues = 1, RestoreOperation = 2 - } - - private static eCMDState _cmdstate = eCMDState.OFF; - private static bool _topmost = false; - - private Thread _ps_thread = null; - #endregion - - #region properties - + } + + private static eCMDState _cmdstate = eCMDState.OFF; + private static bool _topmost = false; + + private Thread _ps_thread = null; + #endregion + + #region properties + private void startPSThread() { if (_ps_thread == null || !_ps_thread.IsAlive) @@ -146,9 +146,9 @@ private void startPSThread() }; _ps_thread.Start(); } - } - - private bool m_bQuckAttenuate = false; + } + + private bool m_bQuckAttenuate = false; public bool QuickAttenuate { get { return m_bQuckAttenuate; } @@ -160,7 +160,7 @@ public ToolTip ToolTip //[2.10.3.9]MW0LGE used by finder { return toolTip1; } - } + } public void StopPSThread() { _ps_closing = true; @@ -174,18 +174,18 @@ public void StopPSThread() console.PowerChangeHanders -= onPowerOn; console.ConsoleClosingHandlersAsync -= onConsoleClosingAsync; } - } - private async Task onConsoleClosingAsync() - { - _ps_closing = true; - await Task.Delay(100); - } - private void onPowerOn(bool oldPower, bool newPower) - { - _power = newPower; - } - private volatile bool _bPSRunning = false; - private volatile bool _ps_closing = false; + } + private async Task onConsoleClosingAsync() + { + _ps_closing = true; + await Task.Delay(100); + } + private void onPowerOn(bool oldPower, bool newPower) + { + _power = newPower; + } + private volatile bool _bPSRunning = false; + private volatile bool _ps_closing = false; private void PSLoop() { _bPSRunning = true; @@ -219,155 +219,155 @@ private void PSLoop() Thread.Sleep(sleepDuration); } Debug.Print(DateTime.UtcNow.Ticks.ToString() + " PSForm: Exiting PS Thread"); - } - - //private volatile bool _dismissAmpv = false; - //public bool DismissAmpv - //{ - // get { return _dismissAmpv; } - // set - // { - // _dismissAmpv = value; - // } - //} - - private static bool _psenabled = false; - public bool PSEnabled - { - get { return _psenabled; } - set - { + } + + //private volatile bool _dismissAmpv = false; + //public bool DismissAmpv + //{ + // get { return _dismissAmpv; } + // set + // { + // _dismissAmpv = value; + // } + //} + + private static bool _psenabled = false; + public bool PSEnabled + { + get { return _psenabled; } + set + { _psenabled = value; - if (_psenabled) - { - // Set the system to supply feedback. - console.UpdateDDCs(console.RX2Enabled); + if (_psenabled) + { + // Set the system to supply feedback. + console.UpdateDDCs(console.RX2Enabled); NetworkIO.SetPureSignal(1); NetworkIO.SendHighPriority(1); // send the HP packet - //console.UpdateRXADCCtrl(); - console.UpdateAAudioMixerStates(); - unsafe { cmaster.LoadRouterControlBit((void*)0, 0, 0, 1); } - console.radio.GetDSPTX(0).PSRunCal = true; - } - else - { - // Set the system to turn-off feedback. - console.UpdateDDCs(console.RX2Enabled); + //console.UpdateRXADCCtrl(); + console.UpdateAAudioMixerStates(); + unsafe { cmaster.LoadRouterControlBit((void*)0, 0, 0, 1); } + console.radio.GetDSPTX(0).PSRunCal = true; + } + else + { + // Set the system to turn-off feedback. + console.UpdateDDCs(console.RX2Enabled); NetworkIO.SetPureSignal(0); NetworkIO.SendHighPriority(1); // send the HP packet - //console.UpdateRXADCCtrl(); - console.UpdateAAudioMixerStates(); - unsafe { cmaster.LoadRouterControlBit((void*)0, 0, 0, 0); } - console.radio.GetDSPTX(0).PSRunCal = false; - } + //console.UpdateRXADCCtrl(); + console.UpdateAAudioMixerStates(); + unsafe { cmaster.LoadRouterControlBit((void*)0, 0, 0, 0); } + console.radio.GetDSPTX(0).PSRunCal = false; + } // console.EnableDup(); - if (console.path_Illustrator != null) - console.path_Illustrator.pi_Changed(); - } - } - - private static bool _autocal_enabled = false; - public bool AutoCalEnabled - { - get { return _autocal_enabled; } - set - { - _autocal_enabled = value; - if (_autocal_enabled) - { - _autoON = true; - console.PSState = true; - } - else - { - _OFF = true; - console.PSState = false; - } - } - } - - private static bool _autoattenuate = true; - public bool AutoAttenuate - { - get { return _autoattenuate; } - set - { - _autoattenuate = value; - if (_autoattenuate) - { - console.ATTOnTX = _autoattenuate; - } - else - { - // restore setting direct from setupform - if (!console.IsSetupFormNull) - { - console.ATTOnTX = console.SetupForm.ATTOnTXChecked; - } - else - { - console.ATTOnTX = _autoattenuate; - } - } - } - } - - private static bool _ttgenON = false; - public bool TTgenON - { - get { return _ttgenON; } - set - { - _ttgenON = value; - if (_ttgenON) - btnPSTwoToneGen.BackColor = Color.FromArgb(_gcolor); - else - btnPSTwoToneGen.BackColor = SystemColors.Control; - } - } - - private static int _txachannel = WDSP.id(1, 0); - public int TXAchannel - { - get { return _txachannel; } - set { _txachannel = value; } - } - - private readonly Object _objLocker = new Object(); - - private static bool _mox = false; - public bool Mox - { - get { return _mox; } - set - { + if (console.path_Illustrator != null) + console.path_Illustrator.pi_Changed(); + } + } + + private static bool _autocal_enabled = false; + public bool AutoCalEnabled + { + get { return _autocal_enabled; } + set + { + _autocal_enabled = value; + if (_autocal_enabled) + { + _autoON = true; + console.PSState = true; + } + else + { + _OFF = true; + console.PSState = false; + } + } + } + + private static bool _autoattenuate = true; + public bool AutoAttenuate + { + get { return _autoattenuate; } + set + { + _autoattenuate = value; + if (_autoattenuate) + { + console.ATTOnTX = _autoattenuate; + } + else + { + // restore setting direct from setupform + if (!console.IsSetupFormNull) + { + console.ATTOnTX = console.SetupForm.ATTOnTXChecked; + } + else + { + console.ATTOnTX = _autoattenuate; + } + } + } + } + + private static bool _ttgenON = false; + public bool TTgenON + { + get { return _ttgenON; } + set + { + _ttgenON = value; + if (_ttgenON) + btnPSTwoToneGen.BackColor = Color.FromArgb(_gcolor); + else + btnPSTwoToneGen.BackColor = SystemColors.Control; + } + } + + private static int _txachannel = WDSP.id(1, 0); + public int TXAchannel + { + get { return _txachannel; } + set { _txachannel = value; } + } + + private readonly Object _objLocker = new Object(); + + private static bool _mox = false; + public bool Mox + { + get { return _mox; } + set + { _mox = value; puresignal.SetPSMox(_txachannel, value); - } - } - - private int _ints = 16; - public int Ints - { - get { return _ints; } - set - { - _ints = value; - } - } - - private int _spi = 256; - public int Spi - { - get { return _spi; } - set - { - _spi = value; - } - } - + } + } + + private int _ints = 16; + public int Ints + { + get { return _ints; } + set + { + _ints = value; + } + } + + private int _spi = 256; + public int Spi + { + get { return _spi; } + set + { + _spi = value; + } + } + private void psdefpeak(double value) { // note : PSpeak_TextChanged will fire if db recovers value into text box @@ -380,17 +380,17 @@ private void psdefpeak(double value) UpdateWarningSetPk(); } - #endregion + #endregion #region event handlers - private void PSForm_Load(object sender, EventArgs e) - { + private void PSForm_Load(object sender, EventArgs e) + { SetupForm(); - } - + } + public void SetupForm()//EventArgs e) //MW0LGE_[2.9.0.7] { - if (_ttgenON == true) + if (_ttgenON == true) btnPSTwoToneGen.BackColor = Color.FromArgb(_gcolor); unsafe @@ -402,26 +402,26 @@ public void SetupForm()//EventArgs e) //MW0LGE_[2.9.0.7] txtPSpeak.Text = _PShwpeak.ToString(); setAdvancedView(); //MW0LGE_[2.9.0.7] - } - - private void PSForm_Closing(object sender, FormClosingEventArgs e) - { - //[2.10.3.4]]MW0LGE leave it there until thetis closes - //if (ampv != null) - //{ - // _dismissAmpv = true; - // ampvThread.Join(); - // ampv.Close(); - // ampv = null; - //} - //_advancedON = true;//MW0LGE_[2.9.0.7] - //btnPSAdvanced_Click(this, e); //MW0LGE_[2.9.0.7] - this.Hide(); - e.Cancel = true; - Common.SaveForm(this, "PureSignal"); - } - - private readonly ManualResetEventSlim _ampViewDone = new ManualResetEventSlim(false); + } + + private void PSForm_Closing(object sender, FormClosingEventArgs e) + { + //[2.10.3.4]]MW0LGE leave it there until thetis closes + //if (ampv != null) + //{ + // _dismissAmpv = true; + // ampvThread.Join(); + // ampv.Close(); + // ampv = null; + //} + //_advancedON = true;//MW0LGE_[2.9.0.7] + //btnPSAdvanced_Click(this, e); //MW0LGE_[2.9.0.7] + this.Hide(); + e.Cancel = true; + Common.SaveForm(this, "PureSignal"); + } + + private readonly ManualResetEventSlim _ampViewDone = new ManualResetEventSlim(false); public void CloseAmpView() { if (ampv != null) @@ -442,114 +442,114 @@ public void CloseAmpView() ampvThread = null; ampv = null; } - } - public void RunAmpv() - { - ampv = new AmpView(this); - ampv.Opacity = 0f; + } + public void RunAmpv() + { + ampv = new AmpView(this); + ampv.Opacity = 0f; Application.Run(ampv); - _ampViewDone.Set(); - } - - private void btnPSAmpView_Click(object sender, EventArgs e) - { - if (ampv == null || (ampv != null && ampv.IsDisposed)) - { - //_dismissAmpv = false; - ampvThread = new Thread(RunAmpv); - ampvThread.SetApartmentState(ApartmentState.STA); - ampvThread.Name = "Ampv Thread"; - ampvThread.Start(); - } - } - - private void btnPSCalibrate_Click(object sender, EventArgs e) - { + _ampViewDone.Set(); + } + + private void btnPSAmpView_Click(object sender, EventArgs e) + { + if (ampv == null || (ampv != null && ampv.IsDisposed)) + { + //_dismissAmpv = false; + ampvThread = new Thread(RunAmpv); + ampvThread.SetApartmentState(ApartmentState.STA); + ampvThread.Name = "Ampv Thread"; + ampvThread.Start(); + } + } + + private void btnPSCalibrate_Click(object sender, EventArgs e) + { if (_singlecalON) { // need this incase single cal is unable to complete do to bad feedback level // state machine will drop out if this is the case _singlecalON = false; return; - } - console.ForcePureSignalAutoCalDisable(); - _singlecalON = true; - console.PSState = false; - } - - //-W2PA Adds capability for CAT control via console - public void SingleCalrun() - { - btnPSCalibrate_Click(this, EventArgs.Empty); - } - - private void btnPSReset_Click(object sender, EventArgs e) - { - console.ForcePureSignalAutoCalDisable(); - if (!_OFF) _OFF = true; - console.PSState = false; - } - - private void udPSMoxDelay_ValueChanged(object sender, EventArgs e) - { + } + console.ForcePureSignalAutoCalDisable(); + _singlecalON = true; + console.PSState = false; + } + + //-W2PA Adds capability for CAT control via console + public void SingleCalrun() + { + btnPSCalibrate_Click(this, EventArgs.Empty); + } + + private void btnPSReset_Click(object sender, EventArgs e) + { + console.ForcePureSignalAutoCalDisable(); + if (!_OFF) _OFF = true; + console.PSState = false; + } + + private void udPSMoxDelay_ValueChanged(object sender, EventArgs e) + { puresignal.SetPSMoxDelay(_txachannel, (double)udPSMoxDelay.Value); - } - - private void udPSCalWait_ValueChanged(object sender, EventArgs e) - { + } + + private void udPSCalWait_ValueChanged(object sender, EventArgs e) + { puresignal.SetPSLoopDelay(_txachannel, (double)udPSCalWait.Value); - } - - private void udPSPhnum_ValueChanged(object sender, EventArgs e) - { + } + + private void udPSPhnum_ValueChanged(object sender, EventArgs e) + { double actual_delay = puresignal.SetPSTXDelay(_txachannel, (double)udPSPhnum.Value * 1.0e-09); - } - - private void btnPSTwoToneGen_Click(object sender, EventArgs e) - { - if (_ttgenON == false) - { - btnPSTwoToneGen.BackColor = Color.FromArgb(_gcolor); - _ttgenON = true; - console.SetupForm.TTgenrun = true; - } - else - { - btnPSTwoToneGen.BackColor = SystemColors.Control; - _ttgenON = false; - console.SetupForm.TTgenrun = false; - } - } - - private void btnPSSave_Click(object sender, EventArgs e) - { - System.IO.Directory.CreateDirectory(console.AppDataPath + "PureSignal\\"); - SaveFileDialog savefile1 = new SaveFileDialog(); - savefile1.InitialDirectory = console.AppDataPath + "PureSignal\\"; - savefile1.RestoreDirectory = true; + } + + private void btnPSTwoToneGen_Click(object sender, EventArgs e) + { + if (_ttgenON == false) + { + btnPSTwoToneGen.BackColor = Color.FromArgb(_gcolor); + _ttgenON = true; + console.SetupForm.TTgenrun = true; + } + else + { + btnPSTwoToneGen.BackColor = SystemColors.Control; + _ttgenON = false; + console.SetupForm.TTgenrun = false; + } + } + + private void btnPSSave_Click(object sender, EventArgs e) + { + System.IO.Directory.CreateDirectory(console.AppDataPath + "PureSignal\\"); + SaveFileDialog savefile1 = new SaveFileDialog(); + savefile1.InitialDirectory = console.AppDataPath + "PureSignal\\"; + savefile1.RestoreDirectory = true; if (savefile1.ShowDialog() == DialogResult.OK) puresignal.PSSaveCorr(_txachannel, savefile1.FileName); - } - - private void btnPSRestore_Click(object sender, EventArgs e) - { - OpenFileDialog openfile1 = new OpenFileDialog(); - openfile1.InitialDirectory = console.AppDataPath + "PureSignal\\"; - openfile1.RestoreDirectory = true; - if (openfile1.ShowDialog() == DialogResult.OK) - { - console.ForcePureSignalAutoCalDisable(); - _OFF = false; + } + + private void btnPSRestore_Click(object sender, EventArgs e) + { + OpenFileDialog openfile1 = new OpenFileDialog(); + openfile1.InitialDirectory = console.AppDataPath + "PureSignal\\"; + openfile1.RestoreDirectory = true; + if (openfile1.ShowDialog() == DialogResult.OK) + { + console.ForcePureSignalAutoCalDisable(); + _OFF = false; puresignal.PSRestoreCorr(_txachannel, openfile1.FileName); - _restoreON = true; - } + _restoreON = true; + } } public void SetDefaultPeaks() { psdefpeak(HardwareSpecific.PSDefaultPeak); } - #region PSLoops - + #region PSLoops + private bool _performing_single_cal = false; private int _performing_single_cal_retries = 0; private void timer1code() @@ -624,7 +624,7 @@ private void timer1code() puresignal.GetPSMaxTX(_txachannel, ptr); } string s = _GetPSpeakval.ToString(); - if (GetPSpeak.Text != s) GetPSpeak.Text = s; + if(txtGetPSpeak.Text != s) txtGetPSpeak.Text = s; // Command State-Machine switch (_cmdstate) @@ -724,7 +724,7 @@ private void timer1code() _cmdstate = eCMDState.StayON;//5; break; } - } + } private void timer2code() { if (!_bPSRunning) return; @@ -732,8 +732,10 @@ private void timer2code() switch (_autoAttenuateState) { case eAAState.Monitor:// 0: // monitor - if (_autoattenuate && puresignal.CalibrationAttemptsChanged - && puresignal.NeedToRecalibrate(console.SetupForm.ATTOnTX)) + if (_autoattenuate && + puresignal.CalibrationAttemptsChanged && + ((HPSDRModel.HERMESLITE != HardwareSpecific.Model && puresignal.NeedToRecalibrate(console.SetupForm.ATTOnTX)) || + (HPSDRModel.HERMESLITE == HardwareSpecific.Model && puresignal.NeedToRecalibrate_HL2(console.SetupForm.ATTOnTX)))) { if (!console.ATTOnTX) AutoAttenuate = true; //MW0LGE @@ -743,12 +745,28 @@ private void timer2code() if (puresignal.IsFeedbackLevelOK) { ddB = 20.0 * Math.Log10((double)puresignal.FeedbackLevel / 152.293); - if (Double.IsNaN(ddB)) ddB = 31.1; - if (ddB < -100.0) ddB = -100.0; - if (ddB > +100.0) ddB = +100.0; + + + if (HPSDRModel.HERMESLITE != HardwareSpecific.Model) + { + if (Double.IsNaN(ddB)) ddB = 31.1; + if (ddB < -100.0) ddB = -100.0; + if (ddB > +100.0) ddB = +100.0; + } + else + { + if (Double.IsNaN(ddB)) ddB = 10.0; // MI0BOT: Handle the Not A Number situation + if (ddB < -100.0) ddB = -10.0; // MI0BOT: Handle - infinity + if (ddB > +100.0) ddB = 10.0; // MI0BOT: Handle + infinity + } } else - ddB = 31.1; + { + if (HPSDRModel.HERMESLITE == HardwareSpecific.Model) + ddB = 10.0; + else + ddB = 31.1; + } //_deltadB = Convert.ToInt32(ddB); _deltadB = (int)Math.Round(ddB, MidpointRounding.AwayFromZero); //[2.10.3.12]MW0LGE use rounding, to fix Banker's rounding issue @@ -764,11 +782,21 @@ private void timer2code() _autoAttenuateState = eAAState.RestoreOperation;//2; int newAtten; int oldAtten = console.SetupForm.ATTOnTX; - if ((oldAtten + _deltadB) > 0) - newAtten = oldAtten + _deltadB; + + if (HPSDRModel.HERMESLITE == HardwareSpecific.Model) + { + newAtten = oldAtten + _deltadB; //MI0BOT: HL2 can handle negative up to -28, just let it be handled in ATTOnTx section + } else - newAtten = 0; + { + if ((oldAtten + _deltadB) > 0) + newAtten = oldAtten + _deltadB; + else + newAtten = 0; + } + if (oldAtten/*console.SetupForm.ATTOnTX*/ != newAtten) + { console.SetupForm.ATTOnTX = newAtten; @@ -782,12 +810,12 @@ private void timer2code() break; } } - #endregion - - private void PSpeak_TextChanged(object sender, EventArgs e) - { - bool bOk = double.TryParse(txtPSpeak.Text, out double tmp); - + #endregion + + private void PSpeak_TextChanged(object sender, EventArgs e) + { + bool bOk = double.TryParse(txtPSpeak.Text, out double tmp); + if (bOk) { _PShwpeak = tmp; @@ -796,27 +824,27 @@ private void PSpeak_TextChanged(object sender, EventArgs e) //double set_pk = GetDefaultPeak(); UpdateWarningSetPk(); } - } + } public void UpdateWarningSetPk() { pbWarningSetPk.Visible = _PShwpeak != HardwareSpecific.PSDefaultPeak; //[2.10.3.7]MW0LGE show a warning if the setpk is different to what we expect for this hardware - } - - private void chkPSRelaxPtol_CheckedChanged(object sender, EventArgs e) - { + } + + private void chkPSRelaxPtol_CheckedChanged(object sender, EventArgs e) + { if (chkPSRelaxPtol.Checked) puresignal.SetPSPtol(_txachannel, 0.400); else puresignal.SetPSPtol(_txachannel, 0.800); - } - - private void chkPSAutoAttenuate_CheckedChanged(object sender, EventArgs e) - { - AutoAttenuate = chkPSAutoAttenuate.Checked; //MW0LGE use property - } - - private void checkLoopback_CheckedChanged(object sender, EventArgs e) - { + } + + private void chkPSAutoAttenuate_CheckedChanged(object sender, EventArgs e) + { + AutoAttenuate = chkPSAutoAttenuate.Checked; //MW0LGE use property + } + + private void checkLoopback_CheckedChanged(object sender, EventArgs e) + { if(checkLoopback.Checked && (console.SampleRateRX1 != 192000 || console.SampleRateRX2 != 192000)) { DialogResult dr = MessageBox.Show("This feature can only be used with sample rates set to 192KHz.", @@ -826,35 +854,35 @@ private void checkLoopback_CheckedChanged(object sender, EventArgs e) checkLoopback.Checked = false; return; - } - cmaster.PSLoopback = checkLoopback.Checked; - } - - private void chkPSPin_CheckedChanged(object sender, EventArgs e) - { + } + cmaster.PSLoopback = checkLoopback.Checked; + } + + private void chkPSPin_CheckedChanged(object sender, EventArgs e) + { if (chkPSPin.Checked) puresignal.SetPSPinMode(_txachannel, 1); else puresignal.SetPSPinMode(_txachannel, 0); - } - - private void chkPSMap_CheckedChanged(object sender, EventArgs e) - { + } + + private void chkPSMap_CheckedChanged(object sender, EventArgs e) + { if (chkPSMap.Checked) puresignal.SetPSMapMode(_txachannel, 1); else puresignal.SetPSMapMode(_txachannel, 0); - } - - private void chkPSStbl_CheckedChanged(object sender, EventArgs e) - { + } + + private void chkPSStbl_CheckedChanged(object sender, EventArgs e) + { if (chkPSStbl.Checked) puresignal.SetPSStabilize(_txachannel, 1); else puresignal.SetPSStabilize(_txachannel, 0); - } - - private void comboPSTint_SelectedIndexChanged(object sender, EventArgs e) + } + + private void comboPSTint_SelectedIndexChanged(object sender, EventArgs e) { switch (comboPSTint.SelectedIndex) { @@ -883,77 +911,77 @@ private void comboPSTint_SelectedIndexChanged(object sender, EventArgs e) btnPSSave.Enabled = btnPSRestore.Enabled = true; break; } - } - - private bool _advancedON = false; //MW0LGE_[2.9.0.7] - private void btnPSAdvanced_Click(object sender, EventArgs e) - { - _advancedON = !_advancedON; - setAdvancedView(); - } + } + + private bool _advancedON = false; //MW0LGE_[2.9.0.7] + private void btnPSAdvanced_Click(object sender, EventArgs e) + { + _advancedON = !_advancedON; + setAdvancedView(); + } private void setAdvancedView() { - if (_advancedON) - console.psform.ClientSize = new System.Drawing.Size(560, 60); - else - console.psform.ClientSize = new System.Drawing.Size(560, 300); - + if (_advancedON) + console.psform.ClientSize = new System.Drawing.Size(560, 60); + else + console.psform.ClientSize = new System.Drawing.Size(560, 300); + chkAdvancedViewHidden.Checked = _advancedON; - } - private void chkPSOnTop_CheckedChanged(object sender, EventArgs e) - { - _topmost = chkPSOnTop.Checked; - - this.TopMost = _topmost; //MW0LGE - } + } + private void chkPSOnTop_CheckedChanged(object sender, EventArgs e) + { + _topmost = chkPSOnTop.Checked; + + this.TopMost = _topmost; //MW0LGE + } public void ShowAtStartup_LinearityForm() { this.Opacity = 0f; this.SetupForm(); this.Show(); Common.FadeIn(this); - } + } public void ShowAtStartup_AmpViewForm() { btnPSAmpView_Click(this, EventArgs.Empty); - } - #endregion - - #region methods - - public void ForcePS() - { - EventArgs e = EventArgs.Empty; + } + #endregion + + #region methods + + public void ForcePS() + { + EventArgs e = EventArgs.Empty; if (!_autoON) { puresignal.SetPSControl(_txachannel, 1, 0, 0, 0); - } + } else { puresignal.SetPSControl(_txachannel, 0, 0, 1, 0); - } - if (!_ttgenON) - WDSP.SetTXAPostGenRun(_txachannel, 0); - else - { - WDSP.SetTXAPostGenMode(_txachannel, 1); - WDSP.SetTXAPostGenRun(_txachannel, 1); - } - udPSCalWait_ValueChanged(this, e); - udPSPhnum_ValueChanged(this, e); - udPSMoxDelay_ValueChanged(this, e); - chkPSRelaxPtol_CheckedChanged(this, e); - chkPSAutoAttenuate_CheckedChanged(this, e); - chkPSPin_CheckedChanged(this, e); - chkPSMap_CheckedChanged(this, e); - chkPSStbl_CheckedChanged(this, e); - comboPSTint_SelectedIndexChanged(this, e); - chkPSOnTop_CheckedChanged(this, e); - chkQuickAttenuate_CheckedChanged(this, e); - chkShow2ToneMeasurements_CheckedChanged(this, e); - } - - #endregion + } + if (!_ttgenON) + WDSP.SetTXAPostGenRun(_txachannel, 0); + else + { + WDSP.SetTXAPostGenMode(_txachannel, 1); + WDSP.SetTXAPostGenRun(_txachannel, 1); + } + udPSCalWait_ValueChanged(this, e); + udPSPhnum_ValueChanged(this, e); + udPSMoxDelay_ValueChanged(this, e); + chkPSRelaxPtol_CheckedChanged(this, e); + chkPSAutoAttenuate_CheckedChanged(this, e); + chkPSPin_CheckedChanged(this, e); + chkPSMap_CheckedChanged(this, e); + chkPSStbl_CheckedChanged(this, e); + comboPSTint_SelectedIndexChanged(this, e); + chkPSOnTop_CheckedChanged(this, e); + chkQuickAttenuate_CheckedChanged(this, e); + chkShow2ToneMeasurements_CheckedChanged(this, e); + } + + #endregion private void chkQuickAttenuate_CheckedChanged(object sender, EventArgs e) { @@ -977,90 +1005,90 @@ public void FixAmpViewOnTop() ampv.FixOnTop(); } } - } - - unsafe static class puresignal - { - #region DllImport - Main - - [DllImport("wdsp.dll", EntryPoint = "SetPSRunCal", CallingConvention = CallingConvention.Cdecl)] - public static extern void SetPSRunCal(int channel, bool run); - - [DllImport("wdsp.dll", EntryPoint = "SetPSMox", CallingConvention = CallingConvention.Cdecl)] - public static extern void SetPSMox(int channel, bool mox); - - [DllImport("wdsp.dll", EntryPoint = "GetPSInfo", CallingConvention = CallingConvention.Cdecl)] - public static extern void GetPSInfo(int channel, int* info); - - [DllImport("wdsp.dll", EntryPoint = "SetPSReset", CallingConvention = CallingConvention.Cdecl)] - public static extern void SetPSReset(int channel, int reset); - - [DllImport("wdsp.dll", EntryPoint = "SetPSMancal", CallingConvention = CallingConvention.Cdecl)] - public static extern void SetPSMancal(int channel, int mancal); - - [DllImport("wdsp.dll", EntryPoint = "SetPSAutomode", CallingConvention = CallingConvention.Cdecl)] - public static extern void SetPSAutomode(int channel, int automode); - - [DllImport("wdsp.dll", EntryPoint = "SetPSTurnon", CallingConvention = CallingConvention.Cdecl)] - public static extern void SetPSTurnon(int channel, int turnon); - - [DllImport("wdsp.dll", EntryPoint = "SetPSControl", CallingConvention = CallingConvention.Cdecl)] - public static extern void SetPSControl(int channel, int reset, int mancal, int automode, int turnon); - - [DllImport("wdsp.dll", EntryPoint = "SetPSLoopDelay", CallingConvention = CallingConvention.Cdecl)] - public static extern void SetPSLoopDelay(int channel, double delay); - - [DllImport("wdsp.dll", EntryPoint = "SetPSMoxDelay", CallingConvention = CallingConvention.Cdecl)] - public static extern void SetPSMoxDelay(int channel, double delay); - - [DllImport("wdsp.dll", EntryPoint = "SetPSTXDelay", CallingConvention = CallingConvention.Cdecl)] - public static extern double SetPSTXDelay(int channel, double delay); - - [DllImport("wdsp.dll", EntryPoint = "psccF", CallingConvention = CallingConvention.Cdecl)] - public static extern void psccF(int channel, int size, float* Itxbuff, float* Qtxbuff, float* Irxbuff, float* Qrxbuff, bool mox, bool solidmox); - - [DllImport("wdsp.dll", EntryPoint = "PSSaveCorr", CallingConvention = CallingConvention.Cdecl)] - public static extern void PSSaveCorr(int channel, string filename); - - [DllImport("wdsp.dll", EntryPoint = "PSRestoreCorr", CallingConvention = CallingConvention.Cdecl)] - public static extern void PSRestoreCorr(int channel, string filename); - - [DllImport("wdsp.dll", EntryPoint = "SetPSHWPeak", CallingConvention = CallingConvention.Cdecl)] - public static extern void SetPSHWPeak(int channel, double peak); - - [DllImport("wdsp.dll", EntryPoint = "GetPSHWPeak", CallingConvention = CallingConvention.Cdecl)] - public static extern void GetPSHWPeak(int channel, double* peak); - - [DllImport("wdsp.dll", EntryPoint = "GetPSMaxTX", CallingConvention = CallingConvention.Cdecl)] - public static extern void GetPSMaxTX(int channel, double* maxtx); - - [DllImport("wdsp.dll", EntryPoint = "SetPSPtol", CallingConvention = CallingConvention.Cdecl)] - public static extern void SetPSPtol(int channel, double ptol); - - [DllImport("wdsp.dll", EntryPoint = "GetPSDisp", CallingConvention = CallingConvention.Cdecl)] - public static extern void GetPSDisp(int channel, IntPtr x, IntPtr ym, IntPtr yc, IntPtr ys, IntPtr cm, IntPtr cc, IntPtr cs); - - [DllImport("wdsp.dll", EntryPoint = "SetPSFeedbackRate", CallingConvention = CallingConvention.Cdecl)] - public static extern void SetPSFeedbackRate(int channel, int rate); - - [DllImport("wdsp.dll", EntryPoint = "SetPSPinMode", CallingConvention = CallingConvention.Cdecl)] - public static extern void SetPSPinMode(int channel, int pin); - - [DllImport("wdsp.dll", EntryPoint = "SetPSMapMode", CallingConvention = CallingConvention.Cdecl)] - public static extern void SetPSMapMode(int channel, int map); - - [DllImport("wdsp.dll", EntryPoint = "SetPSStabilize", CallingConvention = CallingConvention.Cdecl)] - public static extern void SetPSStabilize(int channel, int stbl); - - [DllImport("wdsp.dll", EntryPoint = "SetPSIntsAndSpi", CallingConvention = CallingConvention.Cdecl)] - public static extern void SetPSIntsAndSpi(int channel, int ints, int spi); - - #endregion - - #region public methods - private static int[] _info = new int[16]; - private static int[] _oldInfo = new int[16]; - private static bool _bInvertRedBlue = false; + } + + unsafe static class puresignal + { + #region DllImport - Main + + [DllImport("wdsp.dll", EntryPoint = "SetPSRunCal", CallingConvention = CallingConvention.Cdecl)] + public static extern void SetPSRunCal(int channel, bool run); + + [DllImport("wdsp.dll", EntryPoint = "SetPSMox", CallingConvention = CallingConvention.Cdecl)] + public static extern void SetPSMox(int channel, bool mox); + + [DllImport("wdsp.dll", EntryPoint = "GetPSInfo", CallingConvention = CallingConvention.Cdecl)] + public static extern void GetPSInfo(int channel, int* info); + + [DllImport("wdsp.dll", EntryPoint = "SetPSReset", CallingConvention = CallingConvention.Cdecl)] + public static extern void SetPSReset(int channel, int reset); + + [DllImport("wdsp.dll", EntryPoint = "SetPSMancal", CallingConvention = CallingConvention.Cdecl)] + public static extern void SetPSMancal(int channel, int mancal); + + [DllImport("wdsp.dll", EntryPoint = "SetPSAutomode", CallingConvention = CallingConvention.Cdecl)] + public static extern void SetPSAutomode(int channel, int automode); + + [DllImport("wdsp.dll", EntryPoint = "SetPSTurnon", CallingConvention = CallingConvention.Cdecl)] + public static extern void SetPSTurnon(int channel, int turnon); + + [DllImport("wdsp.dll", EntryPoint = "SetPSControl", CallingConvention = CallingConvention.Cdecl)] + public static extern void SetPSControl(int channel, int reset, int mancal, int automode, int turnon); + + [DllImport("wdsp.dll", EntryPoint = "SetPSLoopDelay", CallingConvention = CallingConvention.Cdecl)] + public static extern void SetPSLoopDelay(int channel, double delay); + + [DllImport("wdsp.dll", EntryPoint = "SetPSMoxDelay", CallingConvention = CallingConvention.Cdecl)] + public static extern void SetPSMoxDelay(int channel, double delay); + + [DllImport("wdsp.dll", EntryPoint = "SetPSTXDelay", CallingConvention = CallingConvention.Cdecl)] + public static extern double SetPSTXDelay(int channel, double delay); + + [DllImport("wdsp.dll", EntryPoint = "psccF", CallingConvention = CallingConvention.Cdecl)] + public static extern void psccF(int channel, int size, float* Itxbuff, float* Qtxbuff, float* Irxbuff, float* Qrxbuff, bool mox, bool solidmox); + + [DllImport("wdsp.dll", EntryPoint = "PSSaveCorr", CallingConvention = CallingConvention.Cdecl)] + public static extern void PSSaveCorr(int channel, string filename); + + [DllImport("wdsp.dll", EntryPoint = "PSRestoreCorr", CallingConvention = CallingConvention.Cdecl)] + public static extern void PSRestoreCorr(int channel, string filename); + + [DllImport("wdsp.dll", EntryPoint = "SetPSHWPeak", CallingConvention = CallingConvention.Cdecl)] + public static extern void SetPSHWPeak(int channel, double peak); + + [DllImport("wdsp.dll", EntryPoint = "GetPSHWPeak", CallingConvention = CallingConvention.Cdecl)] + public static extern void GetPSHWPeak(int channel, double* peak); + + [DllImport("wdsp.dll", EntryPoint = "GetPSMaxTX", CallingConvention = CallingConvention.Cdecl)] + public static extern void GetPSMaxTX(int channel, double* maxtx); + + [DllImport("wdsp.dll", EntryPoint = "SetPSPtol", CallingConvention = CallingConvention.Cdecl)] + public static extern void SetPSPtol(int channel, double ptol); + + [DllImport("wdsp.dll", EntryPoint = "GetPSDisp", CallingConvention = CallingConvention.Cdecl)] + public static extern void GetPSDisp(int channel, IntPtr x, IntPtr ym, IntPtr yc, IntPtr ys, IntPtr cm, IntPtr cc, IntPtr cs); + + [DllImport("wdsp.dll", EntryPoint = "SetPSFeedbackRate", CallingConvention = CallingConvention.Cdecl)] + public static extern void SetPSFeedbackRate(int channel, int rate); + + [DllImport("wdsp.dll", EntryPoint = "SetPSPinMode", CallingConvention = CallingConvention.Cdecl)] + public static extern void SetPSPinMode(int channel, int pin); + + [DllImport("wdsp.dll", EntryPoint = "SetPSMapMode", CallingConvention = CallingConvention.Cdecl)] + public static extern void SetPSMapMode(int channel, int map); + + [DllImport("wdsp.dll", EntryPoint = "SetPSStabilize", CallingConvention = CallingConvention.Cdecl)] + public static extern void SetPSStabilize(int channel, int stbl); + + [DllImport("wdsp.dll", EntryPoint = "SetPSIntsAndSpi", CallingConvention = CallingConvention.Cdecl)] + public static extern void SetPSIntsAndSpi(int channel, int ints, int spi); + + #endregion + + #region public methods + private static int[] _info = new int[16]; + private static int[] _oldInfo = new int[16]; + private static bool _bInvertRedBlue = false; static puresignal() { for(int i = 0; i < 16; i++) @@ -1068,97 +1096,102 @@ static puresignal() _info[i] = 0; _oldInfo[i] = _info[i]; } - } + } public static int[] Info { get { return _info; } - } - public static void GetInfo(int txachannel) - { - //make copy of old, used in HasInfoChanged & CalibrationAttemptsChanged MW0LGE - fixed (void* dest = &_oldInfo[0]) - fixed (void* src = &_info[0]) - Win32.memcpy(dest, src, 16 * sizeof(int)); - - fixed (int* ptr = &(_info[0])) - GetPSInfo(txachannel, ptr); - } - public static bool HasInfoChanged - { - get { - for (int n = 0; n < 16; n++) - { - if (_info[n] != _oldInfo[n]) - return true; - } - return false; - } - } - public static bool CalibrationAttemptsChanged { - get { return _info[5] != _oldInfo[5]; } - } - public static bool CorrectionsBeingApplied { - get { return _info[14] == 1; } - } - public static int CalibrationCount { - get { return _info[5]; } - } - public static bool Correcting { - get { return FeedbackLevel > 90; } - } - public static bool NeedToRecalibrate(int nCurrentATTonTX) { - //note: for reference (puresignal.Info[4] > 181 || (puresignal.Info[4] <= 128 && console.SetupForm.ATTOnTX > 0)) - return (FeedbackLevel > 181 || (FeedbackLevel <= 128 && nCurrentATTonTX > 0)); - } - public static bool IsFeedbackLevelOK { - get { return FeedbackLevel <= 256; } + } + public static void GetInfo(int txachannel) + { + //make copy of old, used in HasInfoChanged & CalibrationAttemptsChanged MW0LGE + fixed (void* dest = &_oldInfo[0]) + fixed (void* src = &_info[0]) + Win32.memcpy(dest, src, 16 * sizeof(int)); + + fixed (int* ptr = &(_info[0])) + GetPSInfo(txachannel, ptr); + } + public static bool HasInfoChanged + { + get { + for (int n = 0; n < 16; n++) + { + if (_info[n] != _oldInfo[n]) + return true; + } + return false; + } + } + public static bool CalibrationAttemptsChanged { + get { return _info[5] != _oldInfo[5]; } + } + public static bool CorrectionsBeingApplied { + get { return _info[14] == 1; } + } + public static int CalibrationCount { + get { return _info[5]; } + } + public static bool Correcting { + get { return FeedbackLevel > 90; } + } + public static bool NeedToRecalibrate(int nCurrentATTonTX) { + //note: for reference (puresignal.Info[4] > 181 || (puresignal.Info[4] <= 128 && console.SetupForm.ATTOnTX > 0)) + return (FeedbackLevel > 181 || (FeedbackLevel <= 128 && nCurrentATTonTX > 0)); + } + + public static bool NeedToRecalibrate_HL2(int nCurrentATTonTX) { + //note: for reference (puresignal.Info[4] > 181 || (puresignal.Info[4] <= 128 && console.SetupForm.ATTOnTX > 0)) + return (FeedbackLevel > 181 || (FeedbackLevel <= 128 && nCurrentATTonTX > -28)); // MI0BOT: Needed seperate function for HL2 as + } // great range in attenuation + public static bool IsFeedbackLevelOK { + get { return FeedbackLevel <= 256; } } public static bool IsFeedbackLevelOKRange - { - get { return FeedbackLevel > 128 && FeedbackLevel <= 181; } - } - public static int FeedbackLevel { - get { return _info[4]; } - } - public static Color FeedbackColourLevel { - get { + { + get { return FeedbackLevel > 128 && FeedbackLevel <= 181; } + } + public static int FeedbackLevel { + get { return _info[4]; } + } + public static Color FeedbackColourLevel { + get { if (FeedbackLevel > 181) - { - if (_bInvertRedBlue) return Color.Red; + { + if (_bInvertRedBlue) return Color.Red; return Color.DodgerBlue; - } - else if (FeedbackLevel > 128) return Color.Lime; - else if (FeedbackLevel > 90) return Color.Yellow; + } + else if (FeedbackLevel > 128) return Color.Lime; + else if (FeedbackLevel > 90) return Color.Yellow; else - { - if (_bInvertRedBlue) return Color.DodgerBlue; + { + if (_bInvertRedBlue) return Color.DodgerBlue; return Color.Red; - } - } - } - // info[15] is engine state (from calcc.c) - public enum EngineState - { - LRESET = 0, - LWAIT, - LMOXDELAY, - LSETUP, - LCOLLECT, - MOXCHECK, - LCALC, - LDELAY, - LSTAYON, - LTURNON - }; - public static EngineState State { - get { return (EngineState)_info[15]; } - } - + } + } + } + // info[15] is engine state (from calcc.c) + public enum EngineState + { + LRESET = 0, + LWAIT, + LMOXDELAY, + LSETUP, + LCOLLECT, + MOXCHECK, + LCALC, + LDELAY, + LSTAYON, + LTURNON + }; + public static EngineState State { + get { return (EngineState)_info[15]; } + } + public static bool InvertRedBlue { get { return _bInvertRedBlue; } set { _bInvertRedBlue = value; } - } - #endregion - } -} + } + #endregion + } +} diff --git a/Project Files/Source/Console/PSForm.designer.cs b/Project Files/Source/Console/PSForm.designer.cs index 8fda0147..ed14ed9c 100644 --- a/Project Files/Source/Console/PSForm.designer.cs +++ b/Project Files/Source/Console/PSForm.designer.cs @@ -28,885 +28,885 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PSForm)); - this.chkPSOnTop = new System.Windows.Forms.CheckBoxTS(); - this.lblPSTint = new System.Windows.Forms.LabelTS(); - this.btnPSRestore = new System.Windows.Forms.ButtonTS(); - this.btnPSSave = new System.Windows.Forms.ButtonTS(); - this.btnPSAdvanced = new System.Windows.Forms.ButtonTS(); - this.comboPSTint = new System.Windows.Forms.ComboBoxTS(); - this.chkPSStbl = new System.Windows.Forms.CheckBoxTS(); - this.chkPSMap = new System.Windows.Forms.CheckBoxTS(); - this.chkPSPin = new System.Windows.Forms.CheckBoxTS(); - this.chkPSAutoAttenuate = new System.Windows.Forms.CheckBoxTS(); - this.btnPSAmpView = new System.Windows.Forms.ButtonTS(); - this.chkPSRelaxPtol = new System.Windows.Forms.CheckBoxTS(); - this.btnPSTwoToneGen = new System.Windows.Forms.ButtonTS(); - this.labelTS8 = new System.Windows.Forms.LabelTS(); - this.lblPSInfoFB = new System.Windows.Forms.LabelTS(); - this.lblPSInfoCO = new System.Windows.Forms.LabelTS(); - this.labelTS9 = new System.Windows.Forms.LabelTS(); - this.labelTS4 = new System.Windows.Forms.LabelTS(); - this.udPSMoxDelay = new System.Windows.Forms.NumericUpDownTS(); - this.labelTS2 = new System.Windows.Forms.LabelTS(); - this.udPSPhnum = new System.Windows.Forms.NumericUpDownTS(); - this.grpPSInfo = new System.Windows.Forms.GroupBoxTS(); - this.btnDefaultPeaks = new System.Windows.Forms.ButtonTS(); - this.checkLoopback = new System.Windows.Forms.CheckBoxTS(); - this.lblPSInfo5 = new System.Windows.Forms.LabelTS(); - this.labelTS13 = new System.Windows.Forms.LabelTS(); - this.lblPSInfo13 = new System.Windows.Forms.LabelTS(); - this.labelTS11 = new System.Windows.Forms.LabelTS(); - this.lblPSInfo6 = new System.Windows.Forms.LabelTS(); - this.labelTS7 = new System.Windows.Forms.LabelTS(); - this.GetPSpeak = new System.Windows.Forms.TextBoxTS(); - this.labelTS3 = new System.Windows.Forms.LabelTS(); - this.txtPSpeak = new System.Windows.Forms.TextBoxTS(); - this.labelTS5 = new System.Windows.Forms.LabelTS(); - this.lblPSfb2 = new System.Windows.Forms.LabelTS(); - this.labelTS1 = new System.Windows.Forms.LabelTS(); - this.lblPSInfo15 = new System.Windows.Forms.LabelTS(); - this.labelTS146 = new System.Windows.Forms.LabelTS(); - this.lblPSInfo3 = new System.Windows.Forms.LabelTS(); - this.lblPSInfo2 = new System.Windows.Forms.LabelTS(); - this.lblPSInfo1 = new System.Windows.Forms.LabelTS(); - this.lblPSInfo0 = new System.Windows.Forms.LabelTS(); - this.labelTS143 = new System.Windows.Forms.LabelTS(); - this.labelTS144 = new System.Windows.Forms.LabelTS(); - this.labelTS142 = new System.Windows.Forms.LabelTS(); - this.labelTS141 = new System.Windows.Forms.LabelTS(); - this.btnPSReset = new System.Windows.Forms.ButtonTS(); - this.btnPSCalibrate = new System.Windows.Forms.ButtonTS(); - this.labelTS140 = new System.Windows.Forms.LabelTS(); - this.udPSCalWait = new System.Windows.Forms.NumericUpDownTS(); - this.chkQuickAttenuate = new System.Windows.Forms.CheckBoxTS(); - this.chkAdvancedViewHidden = new System.Windows.Forms.CheckBoxTS(); - this.pbWarningSetPk = new System.Windows.Forms.PictureBox(); - this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); - this.chkShow2ToneMeasurements = new System.Windows.Forms.CheckBoxTS(); - ((System.ComponentModel.ISupportInitialize)(this.udPSMoxDelay)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.udPSPhnum)).BeginInit(); - this.grpPSInfo.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.udPSCalWait)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.pbWarningSetPk)).BeginInit(); - this.SuspendLayout(); - // - // chkPSOnTop - // - this.chkPSOnTop.AutoSize = true; - this.chkPSOnTop.ForeColor = System.Drawing.SystemColors.ControlLightLight; - this.chkPSOnTop.Image = null; - this.chkPSOnTop.Location = new System.Drawing.Point(450, 276); - this.chkPSOnTop.Name = "chkPSOnTop"; - this.chkPSOnTop.Size = new System.Drawing.Size(98, 17); - this.chkPSOnTop.TabIndex = 48; - this.chkPSOnTop.Text = "Always On Top"; - this.chkPSOnTop.UseVisualStyleBackColor = true; - this.chkPSOnTop.CheckedChanged += new System.EventHandler(this.chkPSOnTop_CheckedChanged); - // - // lblPSTint - // - this.lblPSTint.AutoSize = true; - this.lblPSTint.ForeColor = System.Drawing.Color.White; - this.lblPSTint.Image = null; - this.lblPSTint.Location = new System.Drawing.Point(431, 130); - this.lblPSTint.Name = "lblPSTint"; - this.lblPSTint.Size = new System.Drawing.Size(54, 13); - this.lblPSTint.TabIndex = 47; - this.lblPSTint.Text = "TINT (dB)"; - // - // btnPSRestore - // - this.btnPSRestore.BackColor = System.Drawing.SystemColors.Control; - this.btnPSRestore.ForeColor = System.Drawing.SystemColors.ControlText; - this.btnPSRestore.Image = null; - this.btnPSRestore.Location = new System.Drawing.Point(399, 12); - this.btnPSRestore.Name = "btnPSRestore"; - this.btnPSRestore.Selectable = true; - this.btnPSRestore.Size = new System.Drawing.Size(71, 20); - this.btnPSRestore.TabIndex = 0; - this.btnPSRestore.Text = "Restore"; - this.btnPSRestore.UseVisualStyleBackColor = false; - this.btnPSRestore.Click += new System.EventHandler(this.btnPSRestore_Click); - // - // btnPSSave - // - this.btnPSSave.BackColor = System.Drawing.SystemColors.Control; - this.btnPSSave.ForeColor = System.Drawing.SystemColors.ControlText; - this.btnPSSave.Image = null; - this.btnPSSave.Location = new System.Drawing.Point(322, 12); - this.btnPSSave.Name = "btnPSSave"; - this.btnPSSave.Selectable = true; - this.btnPSSave.Size = new System.Drawing.Size(71, 20); - this.btnPSSave.TabIndex = 4; - this.btnPSSave.Text = "Save"; - this.btnPSSave.UseVisualStyleBackColor = false; - this.btnPSSave.Click += new System.EventHandler(this.btnPSSave_Click); - // - // btnPSAdvanced - // - this.btnPSAdvanced.BackColor = System.Drawing.SystemColors.Control; - this.btnPSAdvanced.Image = null; - this.btnPSAdvanced.Location = new System.Drawing.Point(245, 12); - this.btnPSAdvanced.Name = "btnPSAdvanced"; - this.btnPSAdvanced.Selectable = true; - this.btnPSAdvanced.Size = new System.Drawing.Size(71, 20); - this.btnPSAdvanced.TabIndex = 46; - this.btnPSAdvanced.Text = "Advanced"; - this.btnPSAdvanced.UseVisualStyleBackColor = false; - this.btnPSAdvanced.Click += new System.EventHandler(this.btnPSAdvanced_Click); - // - // comboPSTint - // - this.comboPSTint.ForeColor = System.Drawing.Color.Black; - this.comboPSTint.FormattingEnabled = true; - this.comboPSTint.Items.AddRange(new object[] { - "0.5", - "1.1", - "2.5"}); - this.comboPSTint.Location = new System.Drawing.Point(490, 126); - this.comboPSTint.Name = "comboPSTint"; - this.comboPSTint.Size = new System.Drawing.Size(57, 21); - this.comboPSTint.TabIndex = 45; - this.comboPSTint.Text = "0.5"; - this.toolTip1.SetToolTip(this.comboPSTint, "FOR EXPERIMENTATION. – LEAVE AT 0.5dB."); - this.comboPSTint.SelectedIndexChanged += new System.EventHandler(this.comboPSTint_SelectedIndexChanged); - // - // chkPSStbl - // - this.chkPSStbl.AutoSize = true; - this.chkPSStbl.ForeColor = System.Drawing.SystemColors.HighlightText; - this.chkPSStbl.Image = null; - this.chkPSStbl.Location = new System.Drawing.Point(434, 108); - this.chkPSStbl.Name = "chkPSStbl"; - this.chkPSStbl.Size = new System.Drawing.Size(53, 17); - this.chkPSStbl.TabIndex = 44; - this.chkPSStbl.Text = "STBL"; - this.toolTip1.SetToolTip(this.chkPSStbl, "Averages multiple collections of calibration samples."); - this.chkPSStbl.UseVisualStyleBackColor = true; - this.chkPSStbl.CheckedChanged += new System.EventHandler(this.chkPSStbl_CheckedChanged); - // - // chkPSMap - // - this.chkPSMap.AutoSize = true; - this.chkPSMap.Checked = true; - this.chkPSMap.CheckState = System.Windows.Forms.CheckState.Checked; - this.chkPSMap.ForeColor = System.Drawing.SystemColors.HighlightText; - this.chkPSMap.Image = null; - this.chkPSMap.Location = new System.Drawing.Point(434, 85); - this.chkPSMap.Name = "chkPSMap"; - this.chkPSMap.Size = new System.Drawing.Size(49, 17); - this.chkPSMap.TabIndex = 43; - this.chkPSMap.Text = "MAP"; - this.toolTip1.SetToolTip(this.chkPSMap, "Optimally re-map the sample collection intervals based upon amplifier characteris" + - "tic. (Recommended)"); - this.chkPSMap.UseVisualStyleBackColor = true; - this.chkPSMap.CheckedChanged += new System.EventHandler(this.chkPSMap_CheckedChanged); - // - // chkPSPin - // - this.chkPSPin.AutoSize = true; - this.chkPSPin.Checked = true; - this.chkPSPin.CheckState = System.Windows.Forms.CheckState.Checked; - this.chkPSPin.ForeColor = System.Drawing.SystemColors.HighlightText; - this.chkPSPin.Image = null; - this.chkPSPin.Location = new System.Drawing.Point(434, 62); - this.chkPSPin.Name = "chkPSPin"; - this.chkPSPin.Size = new System.Drawing.Size(44, 17); - this.chkPSPin.TabIndex = 42; - this.chkPSPin.Text = "PIN"; - this.toolTip1.SetToolTip(this.chkPSPin, "Manually ‘pin’ the upper-end of the gain curve; compensates for overshoots, etc. " + - "(Recommended)"); - this.chkPSPin.UseVisualStyleBackColor = true; - this.chkPSPin.CheckedChanged += new System.EventHandler(this.chkPSPin_CheckedChanged); - // - // chkPSAutoAttenuate - // - this.chkPSAutoAttenuate.AutoSize = true; - this.chkPSAutoAttenuate.Checked = true; - this.chkPSAutoAttenuate.CheckState = System.Windows.Forms.CheckState.Checked; - this.chkPSAutoAttenuate.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.chkPSAutoAttenuate.ForeColor = System.Drawing.SystemColors.HighlightText; - this.chkPSAutoAttenuate.Image = null; - this.chkPSAutoAttenuate.Location = new System.Drawing.Point(208, 61); - this.chkPSAutoAttenuate.Name = "chkPSAutoAttenuate"; - this.chkPSAutoAttenuate.Size = new System.Drawing.Size(97, 17); - this.chkPSAutoAttenuate.TabIndex = 41; - this.chkPSAutoAttenuate.Text = "Auto-Attenuate"; - this.toolTip1.SetToolTip(this.chkPSAutoAttenuate, "Automatically adjust attenuator for optimum feedback level. (Recommended)"); - this.chkPSAutoAttenuate.UseVisualStyleBackColor = true; - this.chkPSAutoAttenuate.CheckedChanged += new System.EventHandler(this.chkPSAutoAttenuate_CheckedChanged); - // - // btnPSAmpView - // - this.btnPSAmpView.BackColor = System.Drawing.SystemColors.Control; - this.btnPSAmpView.ForeColor = System.Drawing.SystemColors.ControlText; - this.btnPSAmpView.Image = null; - this.btnPSAmpView.Location = new System.Drawing.Point(168, 12); - this.btnPSAmpView.Name = "btnPSAmpView"; - this.btnPSAmpView.Selectable = true; - this.btnPSAmpView.Size = new System.Drawing.Size(71, 20); - this.btnPSAmpView.TabIndex = 40; - this.btnPSAmpView.Text = "AmpView"; - this.btnPSAmpView.UseVisualStyleBackColor = false; - this.btnPSAmpView.Click += new System.EventHandler(this.btnPSAmpView_Click); - // - // chkPSRelaxPtol - // - this.chkPSRelaxPtol.AutoSize = true; - this.chkPSRelaxPtol.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.chkPSRelaxPtol.ForeColor = System.Drawing.SystemColors.HighlightText; - this.chkPSRelaxPtol.Image = null; - this.chkPSRelaxPtol.Location = new System.Drawing.Point(208, 85); - this.chkPSRelaxPtol.Name = "chkPSRelaxPtol"; - this.chkPSRelaxPtol.Size = new System.Drawing.Size(104, 17); - this.chkPSRelaxPtol.TabIndex = 39; - this.chkPSRelaxPtol.Text = "Relax Tolerance"; - this.toolTip1.SetToolTip(this.chkPSRelaxPtol, "Allow for more dynamic variation in feedback; e.g., for memory-effects"); - this.chkPSRelaxPtol.UseVisualStyleBackColor = true; - this.chkPSRelaxPtol.CheckedChanged += new System.EventHandler(this.chkPSRelaxPtol_CheckedChanged); - // - // btnPSTwoToneGen - // - this.btnPSTwoToneGen.BackColor = System.Drawing.SystemColors.Control; - this.btnPSTwoToneGen.ForeColor = System.Drawing.SystemColors.ControlText; - this.btnPSTwoToneGen.Image = null; - this.btnPSTwoToneGen.Location = new System.Drawing.Point(14, 12); - this.btnPSTwoToneGen.Name = "btnPSTwoToneGen"; - this.btnPSTwoToneGen.Selectable = true; - this.btnPSTwoToneGen.Size = new System.Drawing.Size(71, 20); - this.btnPSTwoToneGen.TabIndex = 37; - this.btnPSTwoToneGen.Text = "Two-tone"; - this.toolTip1.SetToolTip(this.btnPSTwoToneGen, "Generate and TX a Two Tone Signal"); - this.btnPSTwoToneGen.UseVisualStyleBackColor = false; - this.btnPSTwoToneGen.Click += new System.EventHandler(this.btnPSTwoToneGen_Click); - // - // labelTS8 - // - this.labelTS8.AutoSize = true; - this.labelTS8.ForeColor = System.Drawing.Color.White; - this.labelTS8.Image = null; - this.labelTS8.Location = new System.Drawing.Point(32, 40); - this.labelTS8.Name = "labelTS8"; - this.labelTS8.Size = new System.Drawing.Size(84, 13); - this.labelTS8.TabIndex = 10; - this.labelTS8.Text = "Feedback Level"; - this.toolTip1.SetToolTip(this.labelTS8, "Indicates, by color, correct/incorrect RF feedback level"); - // - // lblPSInfoFB - // - this.lblPSInfoFB.BackColor = System.Drawing.Color.Black; - this.lblPSInfoFB.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.lblPSInfoFB.ForeColor = System.Drawing.Color.Black; - this.lblPSInfoFB.Image = null; - this.lblPSInfoFB.Location = new System.Drawing.Point(14, 41); - this.lblPSInfoFB.Name = "lblPSInfoFB"; - this.lblPSInfoFB.Size = new System.Drawing.Size(12, 12); - this.lblPSInfoFB.TabIndex = 11; - this.toolTip1.SetToolTip(this.lblPSInfoFB, "Indicates, by color, correct/incorrect RF feedback level"); - // - // lblPSInfoCO - // - this.lblPSInfoCO.BackColor = System.Drawing.Color.Black; - this.lblPSInfoCO.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.lblPSInfoCO.ForeColor = System.Drawing.Color.Black; - this.lblPSInfoCO.Image = null; - this.lblPSInfoCO.Location = new System.Drawing.Point(168, 41); - this.lblPSInfoCO.Name = "lblPSInfoCO"; - this.lblPSInfoCO.Size = new System.Drawing.Size(12, 12); - this.lblPSInfoCO.TabIndex = 13; - this.toolTip1.SetToolTip(this.lblPSInfoCO, "If green, a correction solution is in place and PureSignal is correcting"); - // - // labelTS9 - // - this.labelTS9.AutoSize = true; - this.labelTS9.ForeColor = System.Drawing.Color.White; - this.labelTS9.Image = null; - this.labelTS9.Location = new System.Drawing.Point(186, 40); - this.labelTS9.Name = "labelTS9"; - this.labelTS9.Size = new System.Drawing.Size(55, 13); - this.labelTS9.TabIndex = 12; - this.labelTS9.Text = "Correcting"; - this.toolTip1.SetToolTip(this.labelTS9, "If green, a correction solution is in place and PureSignal is correcting"); - // - // labelTS4 - // - this.labelTS4.AutoSize = true; - this.labelTS4.ForeColor = System.Drawing.Color.White; - this.labelTS4.Image = null; - this.labelTS4.Location = new System.Drawing.Point(11, 63); - this.labelTS4.Name = "labelTS4"; - this.labelTS4.Size = new System.Drawing.Size(82, 13); - this.labelTS4.TabIndex = 30; - this.labelTS4.Text = "MOX Wait (sec)"; - // - // udPSMoxDelay - // - this.udPSMoxDelay.DecimalPlaces = 1; - this.udPSMoxDelay.Increment = new decimal(new int[] { - 1, - 0, - 0, - 65536}); - this.udPSMoxDelay.Location = new System.Drawing.Point(99, 61); - this.udPSMoxDelay.Maximum = new decimal(new int[] { - 10, - 0, - 0, - 65536}); - this.udPSMoxDelay.Minimum = new decimal(new int[] { - 1, - 0, - 0, - 65536}); - this.udPSMoxDelay.Name = "udPSMoxDelay"; - this.udPSMoxDelay.Size = new System.Drawing.Size(51, 20); - this.udPSMoxDelay.TabIndex = 29; - this.udPSMoxDelay.TinyStep = false; - this.toolTip1.SetToolTip(this.udPSMoxDelay, "Settling time between assertion of MOX and collection of feedback"); - this.udPSMoxDelay.Value = new decimal(new int[] { - 2, - 0, - 0, - 65536}); - this.udPSMoxDelay.ValueChanged += new System.EventHandler(this.udPSMoxDelay_ValueChanged); - // - // labelTS2 - // - this.labelTS2.AutoSize = true; - this.labelTS2.ForeColor = System.Drawing.Color.White; - this.labelTS2.Image = null; - this.labelTS2.Location = new System.Drawing.Point(11, 117); - this.labelTS2.Name = "labelTS2"; - this.labelTS2.Size = new System.Drawing.Size(80, 13); - this.labelTS2.TabIndex = 26; - this.labelTS2.Text = "AMP Delay (ns)"; - // - // udPSPhnum - // - this.udPSPhnum.Increment = new decimal(new int[] { - 20, - 0, - 0, - 0}); - this.udPSPhnum.Location = new System.Drawing.Point(99, 115); - this.udPSPhnum.Maximum = new decimal(new int[] { - 25000000, - 0, - 0, - 0}); - this.udPSPhnum.Minimum = new decimal(new int[] { - 0, - 0, - 0, - 0}); - this.udPSPhnum.Name = "udPSPhnum"; - this.udPSPhnum.Size = new System.Drawing.Size(80, 20); - this.udPSPhnum.TabIndex = 25; - this.udPSPhnum.TinyStep = false; - this.toolTip1.SetToolTip(this.udPSPhnum, "Compensation delay for the analog PA chain"); - this.udPSPhnum.Value = new decimal(new int[] { - 150, - 0, - 0, - 0}); - this.udPSPhnum.ValueChanged += new System.EventHandler(this.udPSPhnum_ValueChanged); - // - // grpPSInfo - // - this.grpPSInfo.Controls.Add(this.btnDefaultPeaks); - this.grpPSInfo.Controls.Add(this.checkLoopback); - this.grpPSInfo.Controls.Add(this.lblPSInfo5); - this.grpPSInfo.Controls.Add(this.labelTS13); - this.grpPSInfo.Controls.Add(this.lblPSInfo13); - this.grpPSInfo.Controls.Add(this.labelTS11); - this.grpPSInfo.Controls.Add(this.lblPSInfo6); - this.grpPSInfo.Controls.Add(this.labelTS7); - this.grpPSInfo.Controls.Add(this.GetPSpeak); - this.grpPSInfo.Controls.Add(this.labelTS3); - this.grpPSInfo.Controls.Add(this.txtPSpeak); - this.grpPSInfo.Controls.Add(this.labelTS5); - this.grpPSInfo.Controls.Add(this.lblPSfb2); - this.grpPSInfo.Controls.Add(this.labelTS1); - this.grpPSInfo.Controls.Add(this.lblPSInfo15); - this.grpPSInfo.Controls.Add(this.labelTS146); - this.grpPSInfo.Controls.Add(this.lblPSInfo3); - this.grpPSInfo.Controls.Add(this.lblPSInfo2); - this.grpPSInfo.Controls.Add(this.lblPSInfo1); - this.grpPSInfo.Controls.Add(this.lblPSInfo0); - this.grpPSInfo.Controls.Add(this.labelTS143); - this.grpPSInfo.Controls.Add(this.labelTS144); - this.grpPSInfo.Controls.Add(this.labelTS142); - this.grpPSInfo.Controls.Add(this.labelTS141); - this.grpPSInfo.ForeColor = System.Drawing.Color.White; - this.grpPSInfo.Location = new System.Drawing.Point(14, 145); - this.grpPSInfo.Name = "grpPSInfo"; - this.grpPSInfo.Size = new System.Drawing.Size(358, 148); - this.grpPSInfo.TabIndex = 21; - this.grpPSInfo.TabStop = false; - this.grpPSInfo.Text = "Calibration Information"; - // - // btnDefaultPeaks - // - this.btnDefaultPeaks.BackColor = System.Drawing.Color.White; - this.btnDefaultPeaks.ForeColor = System.Drawing.Color.Black; - this.btnDefaultPeaks.Image = null; - this.btnDefaultPeaks.Location = new System.Drawing.Point(277, 117); - this.btnDefaultPeaks.Name = "btnDefaultPeaks"; - this.btnDefaultPeaks.Selectable = true; - this.btnDefaultPeaks.Size = new System.Drawing.Size(67, 23); - this.btnDefaultPeaks.TabIndex = 41; - this.btnDefaultPeaks.Text = "Default"; - this.toolTip1.SetToolTip(this.btnDefaultPeaks, "Set the default peak level of expected digital TX feedback for the current hardwa" + - "re"); - this.btnDefaultPeaks.UseVisualStyleBackColor = false; - this.btnDefaultPeaks.Click += new System.EventHandler(this.btnDefaultPeaks_Click); - // - // checkLoopback - // - this.checkLoopback.AutoSize = true; - this.checkLoopback.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.checkLoopback.ForeColor = System.Drawing.SystemColors.HighlightText; - this.checkLoopback.Image = null; - this.checkLoopback.Location = new System.Drawing.Point(9, 121); - this.checkLoopback.Name = "checkLoopback"; - this.checkLoopback.Size = new System.Drawing.Size(188, 17); - this.checkLoopback.TabIndex = 40; - this.checkLoopback.Text = "Display PS-RX and PS-TX spectra"; - this.toolTip1.SetToolTip(this.checkLoopback, "Use top and bottom panadapters to display the two feedback streams."); - this.checkLoopback.UseVisualStyleBackColor = true; - this.checkLoopback.CheckedChanged += new System.EventHandler(this.checkLoopback_CheckedChanged); - // - // lblPSInfo5 - // - this.lblPSInfo5.AutoSize = true; - this.lblPSInfo5.BackColor = System.Drawing.Color.Bisque; - this.lblPSInfo5.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.lblPSInfo5.ForeColor = System.Drawing.Color.Black; - this.lblPSInfo5.Image = null; - this.lblPSInfo5.Location = new System.Drawing.Point(194, 72); - this.lblPSInfo5.Name = "lblPSInfo5"; - this.lblPSInfo5.Size = new System.Drawing.Size(2, 15); - this.lblPSInfo5.TabIndex = 21; - this.toolTip1.SetToolTip(this.lblPSInfo5, "Indicator: cumulative number of new correction solutions."); - // - // labelTS13 - // - this.labelTS13.AutoSize = true; - this.labelTS13.Image = null; - this.labelTS13.Location = new System.Drawing.Point(128, 72); - this.labelTS13.Name = "labelTS13"; - this.labelTS13.Size = new System.Drawing.Size(40, 13); - this.labelTS13.TabIndex = 20; - this.labelTS13.Text = "cor.cnt"; - this.toolTip1.SetToolTip(this.labelTS13, "Indicator: cumulative number of new correction solutions."); - // - // lblPSInfo13 - // - this.lblPSInfo13.AutoSize = true; - this.lblPSInfo13.BackColor = System.Drawing.Color.Bisque; - this.lblPSInfo13.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.lblPSInfo13.ForeColor = System.Drawing.Color.Black; - this.lblPSInfo13.Image = null; - this.lblPSInfo13.Location = new System.Drawing.Point(194, 48); - this.lblPSInfo13.Name = "lblPSInfo13"; - this.lblPSInfo13.Size = new System.Drawing.Size(2, 15); - this.lblPSInfo13.TabIndex = 19; - this.toolTip1.SetToolTip(this.lblPSInfo13, "Indicator: number of rejected sample sets (Normal <= 2)"); - // - // labelTS11 - // - this.labelTS11.AutoSize = true; - this.labelTS11.Image = null; - this.labelTS11.Location = new System.Drawing.Point(128, 48); - this.labelTS11.Name = "labelTS11"; - this.labelTS11.Size = new System.Drawing.Size(37, 13); - this.labelTS11.TabIndex = 18; - this.labelTS11.Text = "dg.cnt"; - this.toolTip1.SetToolTip(this.labelTS11, "Indicator: number of rejected sample sets (Normal <= 2)"); - // - // lblPSInfo6 - // - this.lblPSInfo6.AutoSize = true; - this.lblPSInfo6.BackColor = System.Drawing.Color.Bisque; - this.lblPSInfo6.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.lblPSInfo6.ForeColor = System.Drawing.Color.Black; - this.lblPSInfo6.Image = null; - this.lblPSInfo6.Location = new System.Drawing.Point(194, 24); - this.lblPSInfo6.Name = "lblPSInfo6"; - this.lblPSInfo6.Size = new System.Drawing.Size(2, 15); - this.lblPSInfo6.TabIndex = 17; - this.toolTip1.SetToolTip(this.lblPSInfo6, "Indicator: code indicating evaluation of correction solution. (Normal = 0)"); - // - // labelTS7 - // - this.labelTS7.AutoSize = true; - this.labelTS7.Image = null; - this.labelTS7.Location = new System.Drawing.Point(128, 24); - this.labelTS7.Name = "labelTS7"; - this.labelTS7.Size = new System.Drawing.Size(41, 13); - this.labelTS7.TabIndex = 16; - this.labelTS7.Text = "sln.chk"; - this.toolTip1.SetToolTip(this.labelTS7, "Indicator: code indicating evaluation of correction solution. (Normal = 0)"); - // - // GetPSpeak - // - this.GetPSpeak.BackColor = System.Drawing.Color.Bisque; - this.GetPSpeak.Location = new System.Drawing.Point(287, 69); - this.GetPSpeak.Name = "GetPSpeak"; - this.GetPSpeak.ReadOnly = true; - this.GetPSpeak.Size = new System.Drawing.Size(57, 20); - this.GetPSpeak.TabIndex = 15; - this.toolTip1.SetToolTip(this.GetPSpeak, "Indicator: Peak level of measured digital TX feedback."); - // - // labelTS3 - // - this.labelTS3.AutoSize = true; - this.labelTS3.Image = null; - this.labelTS3.Location = new System.Drawing.Point(250, 72); - this.labelTS3.Name = "labelTS3"; - this.labelTS3.Size = new System.Drawing.Size(37, 13); - this.labelTS3.TabIndex = 14; - this.labelTS3.Text = "GetPk"; - // - // txtPSpeak - // - this.txtPSpeak.BackColor = System.Drawing.Color.Bisque; - this.txtPSpeak.Location = new System.Drawing.Point(287, 93); - this.txtPSpeak.Name = "txtPSpeak"; - this.txtPSpeak.Size = new System.Drawing.Size(57, 20); - this.txtPSpeak.TabIndex = 13; - this.toolTip1.SetToolTip(this.txtPSpeak, "Indicator: Peak level of expected digital TX feedback. (Should be close to GetP" + - "k; Can be set manually for non-recognized hardware/firmware.)"); - this.txtPSpeak.TextChanged += new System.EventHandler(this.PSpeak_TextChanged); - // - // labelTS5 - // - this.labelTS5.AutoSize = true; - this.labelTS5.Image = null; - this.labelTS5.Location = new System.Drawing.Point(250, 96); - this.labelTS5.Name = "labelTS5"; - this.labelTS5.Size = new System.Drawing.Size(36, 13); - this.labelTS5.TabIndex = 12; - this.labelTS5.Text = "SetPk"; - // - // lblPSfb2 - // - this.lblPSfb2.AutoSize = true; - this.lblPSfb2.BackColor = System.Drawing.Color.Bisque; - this.lblPSfb2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.lblPSfb2.ForeColor = System.Drawing.Color.Black; - this.lblPSfb2.Image = null; - this.lblPSfb2.Location = new System.Drawing.Point(309, 48); - this.lblPSfb2.Name = "lblPSfb2"; - this.lblPSfb2.Size = new System.Drawing.Size(2, 15); - this.lblPSfb2.TabIndex = 11; - this.toolTip1.SetToolTip(this.lblPSfb2, "Indicator: RF feedback level; drives red/yellow/green indicator."); - // - // labelTS1 - // - this.labelTS1.AutoSize = true; - this.labelTS1.Image = null; - this.labelTS1.Location = new System.Drawing.Point(250, 48); - this.labelTS1.Name = "labelTS1"; - this.labelTS1.Size = new System.Drawing.Size(40, 13); - this.labelTS1.TabIndex = 10; - this.labelTS1.Text = "feedbk"; - this.toolTip1.SetToolTip(this.labelTS1, "Indicator: RF feedback level; drives red/yellow/green indicator."); - // - // lblPSInfo15 - // - this.lblPSInfo15.AutoSize = true; - this.lblPSInfo15.BackColor = System.Drawing.Color.Bisque; - this.lblPSInfo15.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.lblPSInfo15.ForeColor = System.Drawing.Color.Black; - this.lblPSInfo15.Image = null; - this.lblPSInfo15.Location = new System.Drawing.Point(309, 24); - this.lblPSInfo15.Name = "lblPSInfo15"; - this.lblPSInfo15.Size = new System.Drawing.Size(2, 15); - this.lblPSInfo15.TabIndex = 9; - this.toolTip1.SetToolTip(this.lblPSInfo15, "Indicator: indicates what PureSignal is doing at the present time."); - // - // labelTS146 - // - this.labelTS146.AutoSize = true; - this.labelTS146.Image = null; - this.labelTS146.Location = new System.Drawing.Point(250, 24); - this.labelTS146.Name = "labelTS146"; - this.labelTS146.Size = new System.Drawing.Size(30, 13); - this.labelTS146.TabIndex = 8; - this.labelTS146.Text = "state"; - this.toolTip1.SetToolTip(this.labelTS146, "Indicator: indicates what PureSignal is doing at the present time."); - // - // lblPSInfo3 - // - this.lblPSInfo3.AutoSize = true; - this.lblPSInfo3.BackColor = System.Drawing.Color.Bisque; - this.lblPSInfo3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.lblPSInfo3.ForeColor = System.Drawing.Color.Black; - this.lblPSInfo3.Image = null; - this.lblPSInfo3.Location = new System.Drawing.Point(72, 96); - this.lblPSInfo3.Name = "lblPSInfo3"; - this.lblPSInfo3.Size = new System.Drawing.Size(2, 15); - this.lblPSInfo3.TabIndex = 7; - this.toolTip1.SetToolTip(this.lblPSInfo3, "Indicator: build of sine correction curve. (Normal = 0)"); - // - // lblPSInfo2 - // - this.lblPSInfo2.AutoSize = true; - this.lblPSInfo2.BackColor = System.Drawing.Color.Bisque; - this.lblPSInfo2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.lblPSInfo2.ForeColor = System.Drawing.Color.Black; - this.lblPSInfo2.Image = null; - this.lblPSInfo2.Location = new System.Drawing.Point(72, 72); - this.lblPSInfo2.Name = "lblPSInfo2"; - this.lblPSInfo2.Size = new System.Drawing.Size(2, 15); - this.lblPSInfo2.TabIndex = 6; - this.toolTip1.SetToolTip(this.lblPSInfo2, "Indicator: build of cosine correction curve. (Normal = 0)"); - // - // lblPSInfo1 - // - this.lblPSInfo1.AutoSize = true; - this.lblPSInfo1.BackColor = System.Drawing.Color.Bisque; - this.lblPSInfo1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.lblPSInfo1.ForeColor = System.Drawing.Color.Black; - this.lblPSInfo1.Image = null; - this.lblPSInfo1.Location = new System.Drawing.Point(72, 48); - this.lblPSInfo1.Name = "lblPSInfo1"; - this.lblPSInfo1.Size = new System.Drawing.Size(2, 15); - this.lblPSInfo1.TabIndex = 5; - this.toolTip1.SetToolTip(this.lblPSInfo1, "Indicator: build of magnitude correction curve. (Normal = 0)"); - // - // lblPSInfo0 - // - this.lblPSInfo0.AutoSize = true; - this.lblPSInfo0.BackColor = System.Drawing.Color.Bisque; - this.lblPSInfo0.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.lblPSInfo0.ForeColor = System.Drawing.Color.Black; - this.lblPSInfo0.Image = null; - this.lblPSInfo0.Location = new System.Drawing.Point(72, 24); - this.lblPSInfo0.Name = "lblPSInfo0"; - this.lblPSInfo0.Size = new System.Drawing.Size(2, 15); - this.lblPSInfo0.TabIndex = 4; - this.toolTip1.SetToolTip(this.lblPSInfo0, "Indicator: build of feedback magnitude curve. (Normal = 0)"); - // - // labelTS143 - // - this.labelTS143.AutoSize = true; - this.labelTS143.Image = null; - this.labelTS143.Location = new System.Drawing.Point(6, 96); - this.labelTS143.Name = "labelTS143"; - this.labelTS143.Size = new System.Drawing.Size(38, 13); - this.labelTS143.TabIndex = 3; - this.labelTS143.Text = "bldr.cs"; - this.toolTip1.SetToolTip(this.labelTS143, "Indicator: build of sine correction curve. (Normal = 0)"); - // - // labelTS144 - // - this.labelTS144.AutoSize = true; - this.labelTS144.Image = null; - this.labelTS144.Location = new System.Drawing.Point(6, 72); - this.labelTS144.Name = "labelTS144"; - this.labelTS144.Size = new System.Drawing.Size(39, 13); - this.labelTS144.TabIndex = 2; - this.labelTS144.Text = "bldr.cc"; - this.toolTip1.SetToolTip(this.labelTS144, "Indicator: build of cosine correction curve. (Normal = 0)"); - // - // labelTS142 - // - this.labelTS142.AutoSize = true; - this.labelTS142.Image = null; - this.labelTS142.Location = new System.Drawing.Point(6, 48); - this.labelTS142.Name = "labelTS142"; - this.labelTS142.Size = new System.Drawing.Size(41, 13); - this.labelTS142.TabIndex = 1; - this.labelTS142.Text = "bldr.cm"; - this.toolTip1.SetToolTip(this.labelTS142, "Indicator: build of magnitude correction curve. (Normal = 0)"); - // - // labelTS141 - // - this.labelTS141.AutoSize = true; - this.labelTS141.Image = null; - this.labelTS141.Location = new System.Drawing.Point(6, 24); - this.labelTS141.Name = "labelTS141"; - this.labelTS141.Size = new System.Drawing.Size(35, 13); - this.labelTS141.TabIndex = 0; - this.labelTS141.Text = "bldr.rx"; - this.toolTip1.SetToolTip(this.labelTS141, "Indicator: build of feedback magnitude curve. (Normal = 0)"); - // - // btnPSReset - // - this.btnPSReset.BackColor = System.Drawing.SystemColors.Control; - this.btnPSReset.Image = null; - this.btnPSReset.Location = new System.Drawing.Point(476, 12); - this.btnPSReset.Name = "btnPSReset"; - this.btnPSReset.Selectable = true; - this.btnPSReset.Size = new System.Drawing.Size(71, 20); - this.btnPSReset.TabIndex = 20; - this.btnPSReset.Text = "OFF"; - this.btnPSReset.UseVisualStyleBackColor = false; - this.btnPSReset.Click += new System.EventHandler(this.btnPSReset_Click); - // - // btnPSCalibrate - // - this.btnPSCalibrate.BackColor = System.Drawing.SystemColors.Control; - this.btnPSCalibrate.Image = null; - this.btnPSCalibrate.Location = new System.Drawing.Point(91, 12); - this.btnPSCalibrate.Name = "btnPSCalibrate"; - this.btnPSCalibrate.Selectable = true; - this.btnPSCalibrate.Size = new System.Drawing.Size(71, 20); - this.btnPSCalibrate.TabIndex = 19; - this.btnPSCalibrate.Text = "Single Cal"; - this.toolTip1.SetToolTip(this.btnPSCalibrate, "Perform a singal calibration. This will happen up to 5 times in a row"); - this.btnPSCalibrate.UseVisualStyleBackColor = false; - this.btnPSCalibrate.Click += new System.EventHandler(this.btnPSCalibrate_Click); - // - // labelTS140 - // - this.labelTS140.AutoSize = true; - this.labelTS140.ForeColor = System.Drawing.Color.White; - this.labelTS140.Image = null; - this.labelTS140.Location = new System.Drawing.Point(11, 90); - this.labelTS140.Name = "labelTS140"; - this.labelTS140.Size = new System.Drawing.Size(78, 13); - this.labelTS140.TabIndex = 17; - this.labelTS140.Text = "CAL Wait (sec)"; - // - // udPSCalWait - // - this.udPSCalWait.DecimalPlaces = 1; - this.udPSCalWait.Increment = new decimal(new int[] { - 1, - 0, - 0, - 65536}); - this.udPSCalWait.Location = new System.Drawing.Point(99, 88); - this.udPSCalWait.Maximum = new decimal(new int[] { - 100, - 0, - 0, - 0}); - this.udPSCalWait.Minimum = new decimal(new int[] { - 0, - 0, - 0, - 0}); - this.udPSCalWait.Name = "udPSCalWait"; - this.udPSCalWait.Size = new System.Drawing.Size(51, 20); - this.udPSCalWait.TabIndex = 16; - this.udPSCalWait.TinyStep = false; - this.toolTip1.SetToolTip(this.udPSCalWait, "Time to wait between calculating correction solutions. (Zero for fastest respons" + - "e.)"); - this.udPSCalWait.Value = new decimal(new int[] { - 0, - 0, - 0, - 0}); - this.udPSCalWait.ValueChanged += new System.EventHandler(this.udPSCalWait_ValueChanged); - // - // chkQuickAttenuate - // - this.chkQuickAttenuate.AutoSize = true; - this.chkQuickAttenuate.ForeColor = System.Drawing.SystemColors.HighlightText; - this.chkQuickAttenuate.Image = null; - this.chkQuickAttenuate.Location = new System.Drawing.Point(208, 108); - this.chkQuickAttenuate.Name = "chkQuickAttenuate"; - this.chkQuickAttenuate.Size = new System.Drawing.Size(154, 17); - this.chkQuickAttenuate.TabIndex = 49; - this.chkQuickAttenuate.Text = "Quick Attenuate Response"; - this.toolTip1.SetToolTip(this.chkQuickAttenuate, "Apply auto attenuation changes at a faster interval"); - this.chkQuickAttenuate.UseVisualStyleBackColor = true; - this.chkQuickAttenuate.CheckedChanged += new System.EventHandler(this.chkQuickAttenuate_CheckedChanged); - // - // chkAdvancedViewHidden - // - this.chkAdvancedViewHidden.AutoSize = true; - this.chkAdvancedViewHidden.BackColor = System.Drawing.SystemColors.ControlLightLight; - this.chkAdvancedViewHidden.Image = null; - this.chkAdvancedViewHidden.Location = new System.Drawing.Point(397, 189); - this.chkAdvancedViewHidden.Name = "chkAdvancedViewHidden"; - this.chkAdvancedViewHidden.Size = new System.Drawing.Size(150, 17); - this.chkAdvancedViewHidden.TabIndex = 50; - this.chkAdvancedViewHidden.Text = "chkAdvancedViewHidden"; - this.chkAdvancedViewHidden.UseVisualStyleBackColor = false; - this.chkAdvancedViewHidden.Visible = false; - // - // pbWarningSetPk - // - this.pbWarningSetPk.Image = ((System.Drawing.Image)(resources.GetObject("pbWarningSetPk.Image"))); - this.pbWarningSetPk.Location = new System.Drawing.Point(323, 35); - this.pbWarningSetPk.Name = "pbWarningSetPk"; - this.pbWarningSetPk.Size = new System.Drawing.Size(20, 20); - this.pbWarningSetPk.TabIndex = 51; - this.pbWarningSetPk.TabStop = false; - this.toolTip1.SetToolTip(this.pbWarningSetPk, resources.GetString("pbWarningSetPk.ToolTip")); - this.pbWarningSetPk.Visible = false; - // - // chkShow2ToneMeasurements - // - this.chkShow2ToneMeasurements.AutoSize = true; - this.chkShow2ToneMeasurements.ForeColor = System.Drawing.SystemColors.ControlLightLight; - this.chkShow2ToneMeasurements.Image = null; - this.chkShow2ToneMeasurements.Location = new System.Drawing.Point(389, 38); - this.chkShow2ToneMeasurements.Name = "chkShow2ToneMeasurements"; - this.chkShow2ToneMeasurements.Size = new System.Drawing.Size(158, 17); - this.chkShow2ToneMeasurements.TabIndex = 52; - this.chkShow2ToneMeasurements.Text = "Show 2Tone measurements"; - this.chkShow2ToneMeasurements.UseVisualStyleBackColor = true; - this.chkShow2ToneMeasurements.CheckedChanged += new System.EventHandler(this.chkShow2ToneMeasurements_CheckedChanged); - // - // PSForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.Black; - this.ClientSize = new System.Drawing.Size(560, 303); - this.Controls.Add(this.chkShow2ToneMeasurements); - this.Controls.Add(this.pbWarningSetPk); - this.Controls.Add(this.chkAdvancedViewHidden); - this.Controls.Add(this.chkQuickAttenuate); - this.Controls.Add(this.chkPSOnTop); - this.Controls.Add(this.lblPSTint); - this.Controls.Add(this.btnPSRestore); - this.Controls.Add(this.btnPSSave); - this.Controls.Add(this.btnPSAdvanced); - this.Controls.Add(this.comboPSTint); - this.Controls.Add(this.chkPSStbl); - this.Controls.Add(this.chkPSMap); - this.Controls.Add(this.chkPSPin); - this.Controls.Add(this.chkPSAutoAttenuate); - this.Controls.Add(this.btnPSAmpView); - this.Controls.Add(this.chkPSRelaxPtol); - this.Controls.Add(this.btnPSTwoToneGen); - this.Controls.Add(this.labelTS8); - this.Controls.Add(this.lblPSInfoFB); - this.Controls.Add(this.lblPSInfoCO); - this.Controls.Add(this.labelTS9); - this.Controls.Add(this.labelTS4); - this.Controls.Add(this.udPSMoxDelay); - this.Controls.Add(this.labelTS2); - this.Controls.Add(this.udPSPhnum); - this.Controls.Add(this.grpPSInfo); - this.Controls.Add(this.btnPSReset); - this.Controls.Add(this.btnPSCalibrate); - this.Controls.Add(this.labelTS140); - this.Controls.Add(this.udPSCalWait); - this.ForeColor = System.Drawing.SystemColors.ControlText; - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Name = "PSForm"; - this.Text = "PureSignal 2.0"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.PSForm_Closing); - this.Load += new System.EventHandler(this.PSForm_Load); - ((System.ComponentModel.ISupportInitialize)(this.udPSMoxDelay)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.udPSPhnum)).EndInit(); - this.grpPSInfo.ResumeLayout(false); - this.grpPSInfo.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.udPSCalWait)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.pbWarningSetPk)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PSForm)); + this.chkPSOnTop = new System.Windows.Forms.CheckBoxTS(); + this.lblPSTint = new System.Windows.Forms.LabelTS(); + this.btnPSRestore = new System.Windows.Forms.ButtonTS(); + this.btnPSSave = new System.Windows.Forms.ButtonTS(); + this.btnPSAdvanced = new System.Windows.Forms.ButtonTS(); + this.comboPSTint = new System.Windows.Forms.ComboBoxTS(); + this.chkPSStbl = new System.Windows.Forms.CheckBoxTS(); + this.chkPSMap = new System.Windows.Forms.CheckBoxTS(); + this.chkPSPin = new System.Windows.Forms.CheckBoxTS(); + this.chkPSAutoAttenuate = new System.Windows.Forms.CheckBoxTS(); + this.btnPSAmpView = new System.Windows.Forms.ButtonTS(); + this.chkPSRelaxPtol = new System.Windows.Forms.CheckBoxTS(); + this.btnPSTwoToneGen = new System.Windows.Forms.ButtonTS(); + this.labelTS8 = new System.Windows.Forms.LabelTS(); + this.lblPSInfoFB = new System.Windows.Forms.LabelTS(); + this.lblPSInfoCO = new System.Windows.Forms.LabelTS(); + this.labelTS9 = new System.Windows.Forms.LabelTS(); + this.labelTS4 = new System.Windows.Forms.LabelTS(); + this.udPSMoxDelay = new System.Windows.Forms.NumericUpDownTS(); + this.labelTS2 = new System.Windows.Forms.LabelTS(); + this.udPSPhnum = new System.Windows.Forms.NumericUpDownTS(); + this.grpPSInfo = new System.Windows.Forms.GroupBoxTS(); + this.btnDefaultPeaks = new System.Windows.Forms.ButtonTS(); + this.checkLoopback = new System.Windows.Forms.CheckBoxTS(); + this.lblPSInfo5 = new System.Windows.Forms.LabelTS(); + this.labelTS13 = new System.Windows.Forms.LabelTS(); + this.lblPSInfo13 = new System.Windows.Forms.LabelTS(); + this.labelTS11 = new System.Windows.Forms.LabelTS(); + this.lblPSInfo6 = new System.Windows.Forms.LabelTS(); + this.labelTS7 = new System.Windows.Forms.LabelTS(); + this.txtGetPSpeak = new System.Windows.Forms.TextBoxTS(); + this.labelTS3 = new System.Windows.Forms.LabelTS(); + this.txtPSpeak = new System.Windows.Forms.TextBoxTS(); + this.labelTS5 = new System.Windows.Forms.LabelTS(); + this.lblPSfb2 = new System.Windows.Forms.LabelTS(); + this.labelTS1 = new System.Windows.Forms.LabelTS(); + this.lblPSInfo15 = new System.Windows.Forms.LabelTS(); + this.labelTS146 = new System.Windows.Forms.LabelTS(); + this.lblPSInfo3 = new System.Windows.Forms.LabelTS(); + this.lblPSInfo2 = new System.Windows.Forms.LabelTS(); + this.lblPSInfo1 = new System.Windows.Forms.LabelTS(); + this.lblPSInfo0 = new System.Windows.Forms.LabelTS(); + this.labelTS143 = new System.Windows.Forms.LabelTS(); + this.labelTS144 = new System.Windows.Forms.LabelTS(); + this.labelTS142 = new System.Windows.Forms.LabelTS(); + this.labelTS141 = new System.Windows.Forms.LabelTS(); + this.btnPSReset = new System.Windows.Forms.ButtonTS(); + this.btnPSCalibrate = new System.Windows.Forms.ButtonTS(); + this.labelTS140 = new System.Windows.Forms.LabelTS(); + this.udPSCalWait = new System.Windows.Forms.NumericUpDownTS(); + this.chkQuickAttenuate = new System.Windows.Forms.CheckBoxTS(); + this.chkAdvancedViewHidden = new System.Windows.Forms.CheckBoxTS(); + this.pbWarningSetPk = new System.Windows.Forms.PictureBox(); + this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); + this.chkShow2ToneMeasurements = new System.Windows.Forms.CheckBoxTS(); + ((System.ComponentModel.ISupportInitialize)(this.udPSMoxDelay)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.udPSPhnum)).BeginInit(); + this.grpPSInfo.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.udPSCalWait)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pbWarningSetPk)).BeginInit(); + this.SuspendLayout(); + // + // chkPSOnTop + // + this.chkPSOnTop.AutoSize = true; + this.chkPSOnTop.ForeColor = System.Drawing.SystemColors.ControlLightLight; + this.chkPSOnTop.Image = null; + this.chkPSOnTop.Location = new System.Drawing.Point(450, 276); + this.chkPSOnTop.Name = "chkPSOnTop"; + this.chkPSOnTop.Size = new System.Drawing.Size(98, 17); + this.chkPSOnTop.TabIndex = 48; + this.chkPSOnTop.Text = "Always On Top"; + this.chkPSOnTop.UseVisualStyleBackColor = true; + this.chkPSOnTop.CheckedChanged += new System.EventHandler(this.chkPSOnTop_CheckedChanged); + // + // lblPSTint + // + this.lblPSTint.AutoSize = true; + this.lblPSTint.ForeColor = System.Drawing.Color.White; + this.lblPSTint.Image = null; + this.lblPSTint.Location = new System.Drawing.Point(431, 130); + this.lblPSTint.Name = "lblPSTint"; + this.lblPSTint.Size = new System.Drawing.Size(54, 13); + this.lblPSTint.TabIndex = 47; + this.lblPSTint.Text = "TINT (dB)"; + // + // btnPSRestore + // + this.btnPSRestore.BackColor = System.Drawing.SystemColors.Control; + this.btnPSRestore.ForeColor = System.Drawing.SystemColors.ControlText; + this.btnPSRestore.Image = null; + this.btnPSRestore.Location = new System.Drawing.Point(399, 12); + this.btnPSRestore.Name = "btnPSRestore"; + this.btnPSRestore.Selectable = true; + this.btnPSRestore.Size = new System.Drawing.Size(71, 20); + this.btnPSRestore.TabIndex = 0; + this.btnPSRestore.Text = "Restore"; + this.btnPSRestore.UseVisualStyleBackColor = false; + this.btnPSRestore.Click += new System.EventHandler(this.btnPSRestore_Click); + // + // btnPSSave + // + this.btnPSSave.BackColor = System.Drawing.SystemColors.Control; + this.btnPSSave.ForeColor = System.Drawing.SystemColors.ControlText; + this.btnPSSave.Image = null; + this.btnPSSave.Location = new System.Drawing.Point(322, 12); + this.btnPSSave.Name = "btnPSSave"; + this.btnPSSave.Selectable = true; + this.btnPSSave.Size = new System.Drawing.Size(71, 20); + this.btnPSSave.TabIndex = 4; + this.btnPSSave.Text = "Save"; + this.btnPSSave.UseVisualStyleBackColor = false; + this.btnPSSave.Click += new System.EventHandler(this.btnPSSave_Click); + // + // btnPSAdvanced + // + this.btnPSAdvanced.BackColor = System.Drawing.SystemColors.Control; + this.btnPSAdvanced.Image = null; + this.btnPSAdvanced.Location = new System.Drawing.Point(245, 12); + this.btnPSAdvanced.Name = "btnPSAdvanced"; + this.btnPSAdvanced.Selectable = true; + this.btnPSAdvanced.Size = new System.Drawing.Size(71, 20); + this.btnPSAdvanced.TabIndex = 46; + this.btnPSAdvanced.Text = "Advanced"; + this.btnPSAdvanced.UseVisualStyleBackColor = false; + this.btnPSAdvanced.Click += new System.EventHandler(this.btnPSAdvanced_Click); + // + // comboPSTint + // + this.comboPSTint.ForeColor = System.Drawing.Color.Black; + this.comboPSTint.FormattingEnabled = true; + this.comboPSTint.Items.AddRange(new object[] { + "0.5", + "1.1", + "2.5"}); + this.comboPSTint.Location = new System.Drawing.Point(490, 126); + this.comboPSTint.Name = "comboPSTint"; + this.comboPSTint.Size = new System.Drawing.Size(57, 21); + this.comboPSTint.TabIndex = 45; + this.comboPSTint.Text = "0.5"; + this.toolTip1.SetToolTip(this.comboPSTint, "FOR EXPERIMENTATION. – LEAVE AT 0.5dB."); + this.comboPSTint.SelectedIndexChanged += new System.EventHandler(this.comboPSTint_SelectedIndexChanged); + // + // chkPSStbl + // + this.chkPSStbl.AutoSize = true; + this.chkPSStbl.ForeColor = System.Drawing.SystemColors.HighlightText; + this.chkPSStbl.Image = null; + this.chkPSStbl.Location = new System.Drawing.Point(434, 108); + this.chkPSStbl.Name = "chkPSStbl"; + this.chkPSStbl.Size = new System.Drawing.Size(53, 17); + this.chkPSStbl.TabIndex = 44; + this.chkPSStbl.Text = "STBL"; + this.toolTip1.SetToolTip(this.chkPSStbl, "Averages multiple collections of calibration samples."); + this.chkPSStbl.UseVisualStyleBackColor = true; + this.chkPSStbl.CheckedChanged += new System.EventHandler(this.chkPSStbl_CheckedChanged); + // + // chkPSMap + // + this.chkPSMap.AutoSize = true; + this.chkPSMap.Checked = true; + this.chkPSMap.CheckState = System.Windows.Forms.CheckState.Checked; + this.chkPSMap.ForeColor = System.Drawing.SystemColors.HighlightText; + this.chkPSMap.Image = null; + this.chkPSMap.Location = new System.Drawing.Point(434, 85); + this.chkPSMap.Name = "chkPSMap"; + this.chkPSMap.Size = new System.Drawing.Size(49, 17); + this.chkPSMap.TabIndex = 43; + this.chkPSMap.Text = "MAP"; + this.toolTip1.SetToolTip(this.chkPSMap, "Optimally re-map the sample collection intervals based upon amplifier characteris" + + "tic. (Recommended)"); + this.chkPSMap.UseVisualStyleBackColor = true; + this.chkPSMap.CheckedChanged += new System.EventHandler(this.chkPSMap_CheckedChanged); + // + // chkPSPin + // + this.chkPSPin.AutoSize = true; + this.chkPSPin.Checked = true; + this.chkPSPin.CheckState = System.Windows.Forms.CheckState.Checked; + this.chkPSPin.ForeColor = System.Drawing.SystemColors.HighlightText; + this.chkPSPin.Image = null; + this.chkPSPin.Location = new System.Drawing.Point(434, 62); + this.chkPSPin.Name = "chkPSPin"; + this.chkPSPin.Size = new System.Drawing.Size(44, 17); + this.chkPSPin.TabIndex = 42; + this.chkPSPin.Text = "PIN"; + this.toolTip1.SetToolTip(this.chkPSPin, "Manually ‘pin’ the upper-end of the gain curve; compensates for overshoots, etc. " + + "(Recommended)"); + this.chkPSPin.UseVisualStyleBackColor = true; + this.chkPSPin.CheckedChanged += new System.EventHandler(this.chkPSPin_CheckedChanged); + // + // chkPSAutoAttenuate + // + this.chkPSAutoAttenuate.AutoSize = true; + this.chkPSAutoAttenuate.Checked = true; + this.chkPSAutoAttenuate.CheckState = System.Windows.Forms.CheckState.Checked; + this.chkPSAutoAttenuate.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.chkPSAutoAttenuate.ForeColor = System.Drawing.SystemColors.HighlightText; + this.chkPSAutoAttenuate.Image = null; + this.chkPSAutoAttenuate.Location = new System.Drawing.Point(208, 61); + this.chkPSAutoAttenuate.Name = "chkPSAutoAttenuate"; + this.chkPSAutoAttenuate.Size = new System.Drawing.Size(97, 17); + this.chkPSAutoAttenuate.TabIndex = 41; + this.chkPSAutoAttenuate.Text = "Auto-Attenuate"; + this.toolTip1.SetToolTip(this.chkPSAutoAttenuate, "Automatically adjust attenuator for optimum feedback level. (Recommended)"); + this.chkPSAutoAttenuate.UseVisualStyleBackColor = true; + this.chkPSAutoAttenuate.CheckedChanged += new System.EventHandler(this.chkPSAutoAttenuate_CheckedChanged); + // + // btnPSAmpView + // + this.btnPSAmpView.BackColor = System.Drawing.SystemColors.Control; + this.btnPSAmpView.ForeColor = System.Drawing.SystemColors.ControlText; + this.btnPSAmpView.Image = null; + this.btnPSAmpView.Location = new System.Drawing.Point(168, 12); + this.btnPSAmpView.Name = "btnPSAmpView"; + this.btnPSAmpView.Selectable = true; + this.btnPSAmpView.Size = new System.Drawing.Size(71, 20); + this.btnPSAmpView.TabIndex = 40; + this.btnPSAmpView.Text = "AmpView"; + this.btnPSAmpView.UseVisualStyleBackColor = false; + this.btnPSAmpView.Click += new System.EventHandler(this.btnPSAmpView_Click); + // + // chkPSRelaxPtol + // + this.chkPSRelaxPtol.AutoSize = true; + this.chkPSRelaxPtol.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.chkPSRelaxPtol.ForeColor = System.Drawing.SystemColors.HighlightText; + this.chkPSRelaxPtol.Image = null; + this.chkPSRelaxPtol.Location = new System.Drawing.Point(208, 85); + this.chkPSRelaxPtol.Name = "chkPSRelaxPtol"; + this.chkPSRelaxPtol.Size = new System.Drawing.Size(104, 17); + this.chkPSRelaxPtol.TabIndex = 39; + this.chkPSRelaxPtol.Text = "Relax Tolerance"; + this.toolTip1.SetToolTip(this.chkPSRelaxPtol, "Allow for more dynamic variation in feedback; e.g., for memory-effects"); + this.chkPSRelaxPtol.UseVisualStyleBackColor = true; + this.chkPSRelaxPtol.CheckedChanged += new System.EventHandler(this.chkPSRelaxPtol_CheckedChanged); + // + // btnPSTwoToneGen + // + this.btnPSTwoToneGen.BackColor = System.Drawing.SystemColors.Control; + this.btnPSTwoToneGen.ForeColor = System.Drawing.SystemColors.ControlText; + this.btnPSTwoToneGen.Image = null; + this.btnPSTwoToneGen.Location = new System.Drawing.Point(14, 12); + this.btnPSTwoToneGen.Name = "btnPSTwoToneGen"; + this.btnPSTwoToneGen.Selectable = true; + this.btnPSTwoToneGen.Size = new System.Drawing.Size(71, 20); + this.btnPSTwoToneGen.TabIndex = 37; + this.btnPSTwoToneGen.Text = "Two-tone"; + this.toolTip1.SetToolTip(this.btnPSTwoToneGen, "Generate and TX a Two Tone Signal"); + this.btnPSTwoToneGen.UseVisualStyleBackColor = false; + this.btnPSTwoToneGen.Click += new System.EventHandler(this.btnPSTwoToneGen_Click); + // + // labelTS8 + // + this.labelTS8.AutoSize = true; + this.labelTS8.ForeColor = System.Drawing.Color.White; + this.labelTS8.Image = null; + this.labelTS8.Location = new System.Drawing.Point(32, 40); + this.labelTS8.Name = "labelTS8"; + this.labelTS8.Size = new System.Drawing.Size(84, 13); + this.labelTS8.TabIndex = 10; + this.labelTS8.Text = "Feedback Level"; + this.toolTip1.SetToolTip(this.labelTS8, "Indicates, by color, correct/incorrect RF feedback level"); + // + // lblPSInfoFB + // + this.lblPSInfoFB.BackColor = System.Drawing.Color.Black; + this.lblPSInfoFB.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.lblPSInfoFB.ForeColor = System.Drawing.Color.Black; + this.lblPSInfoFB.Image = null; + this.lblPSInfoFB.Location = new System.Drawing.Point(14, 41); + this.lblPSInfoFB.Name = "lblPSInfoFB"; + this.lblPSInfoFB.Size = new System.Drawing.Size(12, 12); + this.lblPSInfoFB.TabIndex = 11; + this.toolTip1.SetToolTip(this.lblPSInfoFB, "Indicates, by color, correct/incorrect RF feedback level"); + // + // lblPSInfoCO + // + this.lblPSInfoCO.BackColor = System.Drawing.Color.Black; + this.lblPSInfoCO.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.lblPSInfoCO.ForeColor = System.Drawing.Color.Black; + this.lblPSInfoCO.Image = null; + this.lblPSInfoCO.Location = new System.Drawing.Point(168, 41); + this.lblPSInfoCO.Name = "lblPSInfoCO"; + this.lblPSInfoCO.Size = new System.Drawing.Size(12, 12); + this.lblPSInfoCO.TabIndex = 13; + this.toolTip1.SetToolTip(this.lblPSInfoCO, "If green, a correction solution is in place and PureSignal is correcting"); + // + // labelTS9 + // + this.labelTS9.AutoSize = true; + this.labelTS9.ForeColor = System.Drawing.Color.White; + this.labelTS9.Image = null; + this.labelTS9.Location = new System.Drawing.Point(186, 40); + this.labelTS9.Name = "labelTS9"; + this.labelTS9.Size = new System.Drawing.Size(55, 13); + this.labelTS9.TabIndex = 12; + this.labelTS9.Text = "Correcting"; + this.toolTip1.SetToolTip(this.labelTS9, "If green, a correction solution is in place and PureSignal is correcting"); + // + // labelTS4 + // + this.labelTS4.AutoSize = true; + this.labelTS4.ForeColor = System.Drawing.Color.White; + this.labelTS4.Image = null; + this.labelTS4.Location = new System.Drawing.Point(11, 63); + this.labelTS4.Name = "labelTS4"; + this.labelTS4.Size = new System.Drawing.Size(82, 13); + this.labelTS4.TabIndex = 30; + this.labelTS4.Text = "MOX Wait (sec)"; + // + // udPSMoxDelay + // + this.udPSMoxDelay.DecimalPlaces = 1; + this.udPSMoxDelay.Increment = new decimal(new int[] { + 1, + 0, + 0, + 65536}); + this.udPSMoxDelay.Location = new System.Drawing.Point(99, 61); + this.udPSMoxDelay.Maximum = new decimal(new int[] { + 10, + 0, + 0, + 65536}); + this.udPSMoxDelay.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 65536}); + this.udPSMoxDelay.Name = "udPSMoxDelay"; + this.udPSMoxDelay.Size = new System.Drawing.Size(51, 20); + this.udPSMoxDelay.TabIndex = 29; + this.udPSMoxDelay.TinyStep = false; + this.toolTip1.SetToolTip(this.udPSMoxDelay, "Settling time between assertion of MOX and collection of feedback"); + this.udPSMoxDelay.Value = new decimal(new int[] { + 2, + 0, + 0, + 65536}); + this.udPSMoxDelay.ValueChanged += new System.EventHandler(this.udPSMoxDelay_ValueChanged); + // + // labelTS2 + // + this.labelTS2.AutoSize = true; + this.labelTS2.ForeColor = System.Drawing.Color.White; + this.labelTS2.Image = null; + this.labelTS2.Location = new System.Drawing.Point(11, 117); + this.labelTS2.Name = "labelTS2"; + this.labelTS2.Size = new System.Drawing.Size(80, 13); + this.labelTS2.TabIndex = 26; + this.labelTS2.Text = "AMP Delay (ns)"; + // + // udPSPhnum + // + this.udPSPhnum.Increment = new decimal(new int[] { + 20, + 0, + 0, + 0}); + this.udPSPhnum.Location = new System.Drawing.Point(99, 115); + this.udPSPhnum.Maximum = new decimal(new int[] { + 25000000, + 0, + 0, + 0}); + this.udPSPhnum.Minimum = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.udPSPhnum.Name = "udPSPhnum"; + this.udPSPhnum.Size = new System.Drawing.Size(80, 20); + this.udPSPhnum.TabIndex = 25; + this.udPSPhnum.TinyStep = false; + this.toolTip1.SetToolTip(this.udPSPhnum, "Compensation delay for the analog PA chain"); + this.udPSPhnum.Value = new decimal(new int[] { + 150, + 0, + 0, + 0}); + this.udPSPhnum.ValueChanged += new System.EventHandler(this.udPSPhnum_ValueChanged); + // + // grpPSInfo + // + this.grpPSInfo.Controls.Add(this.btnDefaultPeaks); + this.grpPSInfo.Controls.Add(this.checkLoopback); + this.grpPSInfo.Controls.Add(this.lblPSInfo5); + this.grpPSInfo.Controls.Add(this.labelTS13); + this.grpPSInfo.Controls.Add(this.lblPSInfo13); + this.grpPSInfo.Controls.Add(this.labelTS11); + this.grpPSInfo.Controls.Add(this.lblPSInfo6); + this.grpPSInfo.Controls.Add(this.labelTS7); + this.grpPSInfo.Controls.Add(this.txtGetPSpeak); + this.grpPSInfo.Controls.Add(this.labelTS3); + this.grpPSInfo.Controls.Add(this.txtPSpeak); + this.grpPSInfo.Controls.Add(this.labelTS5); + this.grpPSInfo.Controls.Add(this.lblPSfb2); + this.grpPSInfo.Controls.Add(this.labelTS1); + this.grpPSInfo.Controls.Add(this.lblPSInfo15); + this.grpPSInfo.Controls.Add(this.labelTS146); + this.grpPSInfo.Controls.Add(this.lblPSInfo3); + this.grpPSInfo.Controls.Add(this.lblPSInfo2); + this.grpPSInfo.Controls.Add(this.lblPSInfo1); + this.grpPSInfo.Controls.Add(this.lblPSInfo0); + this.grpPSInfo.Controls.Add(this.labelTS143); + this.grpPSInfo.Controls.Add(this.labelTS144); + this.grpPSInfo.Controls.Add(this.labelTS142); + this.grpPSInfo.Controls.Add(this.labelTS141); + this.grpPSInfo.ForeColor = System.Drawing.Color.White; + this.grpPSInfo.Location = new System.Drawing.Point(14, 145); + this.grpPSInfo.Name = "grpPSInfo"; + this.grpPSInfo.Size = new System.Drawing.Size(358, 148); + this.grpPSInfo.TabIndex = 21; + this.grpPSInfo.TabStop = false; + this.grpPSInfo.Text = "Calibration Information"; + // + // btnDefaultPeaks + // + this.btnDefaultPeaks.BackColor = System.Drawing.Color.White; + this.btnDefaultPeaks.ForeColor = System.Drawing.Color.Black; + this.btnDefaultPeaks.Image = null; + this.btnDefaultPeaks.Location = new System.Drawing.Point(277, 117); + this.btnDefaultPeaks.Name = "btnDefaultPeaks"; + this.btnDefaultPeaks.Selectable = true; + this.btnDefaultPeaks.Size = new System.Drawing.Size(67, 23); + this.btnDefaultPeaks.TabIndex = 41; + this.btnDefaultPeaks.Text = "Default"; + this.toolTip1.SetToolTip(this.btnDefaultPeaks, "Set the default peak level of expected digital TX feedback for the current hardwa" + + "re"); + this.btnDefaultPeaks.UseVisualStyleBackColor = false; + this.btnDefaultPeaks.Click += new System.EventHandler(this.btnDefaultPeaks_Click); + // + // checkLoopback + // + this.checkLoopback.AutoSize = true; + this.checkLoopback.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.checkLoopback.ForeColor = System.Drawing.SystemColors.HighlightText; + this.checkLoopback.Image = null; + this.checkLoopback.Location = new System.Drawing.Point(9, 121); + this.checkLoopback.Name = "checkLoopback"; + this.checkLoopback.Size = new System.Drawing.Size(188, 17); + this.checkLoopback.TabIndex = 40; + this.checkLoopback.Text = "Display PS-RX and PS-TX spectra"; + this.toolTip1.SetToolTip(this.checkLoopback, "Use top and bottom panadapters to display the two feedback streams."); + this.checkLoopback.UseVisualStyleBackColor = true; + this.checkLoopback.CheckedChanged += new System.EventHandler(this.checkLoopback_CheckedChanged); + // + // lblPSInfo5 + // + this.lblPSInfo5.AutoSize = true; + this.lblPSInfo5.BackColor = System.Drawing.Color.Bisque; + this.lblPSInfo5.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.lblPSInfo5.ForeColor = System.Drawing.Color.Black; + this.lblPSInfo5.Image = null; + this.lblPSInfo5.Location = new System.Drawing.Point(194, 72); + this.lblPSInfo5.Name = "lblPSInfo5"; + this.lblPSInfo5.Size = new System.Drawing.Size(2, 15); + this.lblPSInfo5.TabIndex = 21; + this.toolTip1.SetToolTip(this.lblPSInfo5, "Indicator: cumulative number of new correction solutions."); + // + // labelTS13 + // + this.labelTS13.AutoSize = true; + this.labelTS13.Image = null; + this.labelTS13.Location = new System.Drawing.Point(128, 72); + this.labelTS13.Name = "labelTS13"; + this.labelTS13.Size = new System.Drawing.Size(40, 13); + this.labelTS13.TabIndex = 20; + this.labelTS13.Text = "cor.cnt"; + this.toolTip1.SetToolTip(this.labelTS13, "Indicator: cumulative number of new correction solutions."); + // + // lblPSInfo13 + // + this.lblPSInfo13.AutoSize = true; + this.lblPSInfo13.BackColor = System.Drawing.Color.Bisque; + this.lblPSInfo13.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.lblPSInfo13.ForeColor = System.Drawing.Color.Black; + this.lblPSInfo13.Image = null; + this.lblPSInfo13.Location = new System.Drawing.Point(194, 48); + this.lblPSInfo13.Name = "lblPSInfo13"; + this.lblPSInfo13.Size = new System.Drawing.Size(2, 15); + this.lblPSInfo13.TabIndex = 19; + this.toolTip1.SetToolTip(this.lblPSInfo13, "Indicator: number of rejected sample sets (Normal <= 2)"); + // + // labelTS11 + // + this.labelTS11.AutoSize = true; + this.labelTS11.Image = null; + this.labelTS11.Location = new System.Drawing.Point(128, 48); + this.labelTS11.Name = "labelTS11"; + this.labelTS11.Size = new System.Drawing.Size(37, 13); + this.labelTS11.TabIndex = 18; + this.labelTS11.Text = "dg.cnt"; + this.toolTip1.SetToolTip(this.labelTS11, "Indicator: number of rejected sample sets (Normal <= 2)"); + // + // lblPSInfo6 + // + this.lblPSInfo6.AutoSize = true; + this.lblPSInfo6.BackColor = System.Drawing.Color.Bisque; + this.lblPSInfo6.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.lblPSInfo6.ForeColor = System.Drawing.Color.Black; + this.lblPSInfo6.Image = null; + this.lblPSInfo6.Location = new System.Drawing.Point(194, 24); + this.lblPSInfo6.Name = "lblPSInfo6"; + this.lblPSInfo6.Size = new System.Drawing.Size(2, 15); + this.lblPSInfo6.TabIndex = 17; + this.toolTip1.SetToolTip(this.lblPSInfo6, "Indicator: code indicating evaluation of correction solution. (Normal = 0)"); + // + // labelTS7 + // + this.labelTS7.AutoSize = true; + this.labelTS7.Image = null; + this.labelTS7.Location = new System.Drawing.Point(128, 24); + this.labelTS7.Name = "labelTS7"; + this.labelTS7.Size = new System.Drawing.Size(41, 13); + this.labelTS7.TabIndex = 16; + this.labelTS7.Text = "sln.chk"; + this.toolTip1.SetToolTip(this.labelTS7, "Indicator: code indicating evaluation of correction solution. (Normal = 0)"); + // + // txtGetPSpeak + // + this.txtGetPSpeak.BackColor = System.Drawing.Color.Bisque; + this.txtGetPSpeak.Location = new System.Drawing.Point(287, 69); + this.txtGetPSpeak.Name = "txtGetPSpeak"; + this.txtGetPSpeak.ReadOnly = true; + this.txtGetPSpeak.Size = new System.Drawing.Size(57, 20); + this.txtGetPSpeak.TabIndex = 15; + this.toolTip1.SetToolTip(this.txtGetPSpeak, "Indicator: Peak level of measured digital TX feedback."); + // + // labelTS3 + // + this.labelTS3.AutoSize = true; + this.labelTS3.Image = null; + this.labelTS3.Location = new System.Drawing.Point(250, 72); + this.labelTS3.Name = "labelTS3"; + this.labelTS3.Size = new System.Drawing.Size(37, 13); + this.labelTS3.TabIndex = 14; + this.labelTS3.Text = "GetPk"; + // + // txtPSpeak + // + this.txtPSpeak.BackColor = System.Drawing.Color.Bisque; + this.txtPSpeak.Location = new System.Drawing.Point(287, 93); + this.txtPSpeak.Name = "txtPSpeak"; + this.txtPSpeak.Size = new System.Drawing.Size(57, 20); + this.txtPSpeak.TabIndex = 13; + this.toolTip1.SetToolTip(this.txtPSpeak, "Indicator: Peak level of expected digital TX feedback. (Should be close to GetP" + + "k; Can be set manually for non-recognized hardware/firmware.)"); + this.txtPSpeak.TextChanged += new System.EventHandler(this.PSpeak_TextChanged); + // + // labelTS5 + // + this.labelTS5.AutoSize = true; + this.labelTS5.Image = null; + this.labelTS5.Location = new System.Drawing.Point(250, 96); + this.labelTS5.Name = "labelTS5"; + this.labelTS5.Size = new System.Drawing.Size(36, 13); + this.labelTS5.TabIndex = 12; + this.labelTS5.Text = "SetPk"; + // + // lblPSfb2 + // + this.lblPSfb2.AutoSize = true; + this.lblPSfb2.BackColor = System.Drawing.Color.Bisque; + this.lblPSfb2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.lblPSfb2.ForeColor = System.Drawing.Color.Black; + this.lblPSfb2.Image = null; + this.lblPSfb2.Location = new System.Drawing.Point(309, 48); + this.lblPSfb2.Name = "lblPSfb2"; + this.lblPSfb2.Size = new System.Drawing.Size(2, 15); + this.lblPSfb2.TabIndex = 11; + this.toolTip1.SetToolTip(this.lblPSfb2, "Indicator: RF feedback level; drives red/yellow/green indicator."); + // + // labelTS1 + // + this.labelTS1.AutoSize = true; + this.labelTS1.Image = null; + this.labelTS1.Location = new System.Drawing.Point(250, 48); + this.labelTS1.Name = "labelTS1"; + this.labelTS1.Size = new System.Drawing.Size(40, 13); + this.labelTS1.TabIndex = 10; + this.labelTS1.Text = "feedbk"; + this.toolTip1.SetToolTip(this.labelTS1, "Indicator: RF feedback level; drives red/yellow/green indicator."); + // + // lblPSInfo15 + // + this.lblPSInfo15.AutoSize = true; + this.lblPSInfo15.BackColor = System.Drawing.Color.Bisque; + this.lblPSInfo15.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.lblPSInfo15.ForeColor = System.Drawing.Color.Black; + this.lblPSInfo15.Image = null; + this.lblPSInfo15.Location = new System.Drawing.Point(309, 24); + this.lblPSInfo15.Name = "lblPSInfo15"; + this.lblPSInfo15.Size = new System.Drawing.Size(2, 15); + this.lblPSInfo15.TabIndex = 9; + this.toolTip1.SetToolTip(this.lblPSInfo15, "Indicator: indicates what PureSignal is doing at the present time."); + // + // labelTS146 + // + this.labelTS146.AutoSize = true; + this.labelTS146.Image = null; + this.labelTS146.Location = new System.Drawing.Point(250, 24); + this.labelTS146.Name = "labelTS146"; + this.labelTS146.Size = new System.Drawing.Size(30, 13); + this.labelTS146.TabIndex = 8; + this.labelTS146.Text = "state"; + this.toolTip1.SetToolTip(this.labelTS146, "Indicator: indicates what PureSignal is doing at the present time."); + // + // lblPSInfo3 + // + this.lblPSInfo3.AutoSize = true; + this.lblPSInfo3.BackColor = System.Drawing.Color.Bisque; + this.lblPSInfo3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.lblPSInfo3.ForeColor = System.Drawing.Color.Black; + this.lblPSInfo3.Image = null; + this.lblPSInfo3.Location = new System.Drawing.Point(72, 96); + this.lblPSInfo3.Name = "lblPSInfo3"; + this.lblPSInfo3.Size = new System.Drawing.Size(2, 15); + this.lblPSInfo3.TabIndex = 7; + this.toolTip1.SetToolTip(this.lblPSInfo3, "Indicator: build of sine correction curve. (Normal = 0)"); + // + // lblPSInfo2 + // + this.lblPSInfo2.AutoSize = true; + this.lblPSInfo2.BackColor = System.Drawing.Color.Bisque; + this.lblPSInfo2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.lblPSInfo2.ForeColor = System.Drawing.Color.Black; + this.lblPSInfo2.Image = null; + this.lblPSInfo2.Location = new System.Drawing.Point(72, 72); + this.lblPSInfo2.Name = "lblPSInfo2"; + this.lblPSInfo2.Size = new System.Drawing.Size(2, 15); + this.lblPSInfo2.TabIndex = 6; + this.toolTip1.SetToolTip(this.lblPSInfo2, "Indicator: build of cosine correction curve. (Normal = 0)"); + // + // lblPSInfo1 + // + this.lblPSInfo1.AutoSize = true; + this.lblPSInfo1.BackColor = System.Drawing.Color.Bisque; + this.lblPSInfo1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.lblPSInfo1.ForeColor = System.Drawing.Color.Black; + this.lblPSInfo1.Image = null; + this.lblPSInfo1.Location = new System.Drawing.Point(72, 48); + this.lblPSInfo1.Name = "lblPSInfo1"; + this.lblPSInfo1.Size = new System.Drawing.Size(2, 15); + this.lblPSInfo1.TabIndex = 5; + this.toolTip1.SetToolTip(this.lblPSInfo1, "Indicator: build of magnitude correction curve. (Normal = 0)"); + // + // lblPSInfo0 + // + this.lblPSInfo0.AutoSize = true; + this.lblPSInfo0.BackColor = System.Drawing.Color.Bisque; + this.lblPSInfo0.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.lblPSInfo0.ForeColor = System.Drawing.Color.Black; + this.lblPSInfo0.Image = null; + this.lblPSInfo0.Location = new System.Drawing.Point(72, 24); + this.lblPSInfo0.Name = "lblPSInfo0"; + this.lblPSInfo0.Size = new System.Drawing.Size(2, 15); + this.lblPSInfo0.TabIndex = 4; + this.toolTip1.SetToolTip(this.lblPSInfo0, "Indicator: build of feedback magnitude curve. (Normal = 0)"); + // + // labelTS143 + // + this.labelTS143.AutoSize = true; + this.labelTS143.Image = null; + this.labelTS143.Location = new System.Drawing.Point(6, 96); + this.labelTS143.Name = "labelTS143"; + this.labelTS143.Size = new System.Drawing.Size(38, 13); + this.labelTS143.TabIndex = 3; + this.labelTS143.Text = "bldr.cs"; + this.toolTip1.SetToolTip(this.labelTS143, "Indicator: build of sine correction curve. (Normal = 0)"); + // + // labelTS144 + // + this.labelTS144.AutoSize = true; + this.labelTS144.Image = null; + this.labelTS144.Location = new System.Drawing.Point(6, 72); + this.labelTS144.Name = "labelTS144"; + this.labelTS144.Size = new System.Drawing.Size(39, 13); + this.labelTS144.TabIndex = 2; + this.labelTS144.Text = "bldr.cc"; + this.toolTip1.SetToolTip(this.labelTS144, "Indicator: build of cosine correction curve. (Normal = 0)"); + // + // labelTS142 + // + this.labelTS142.AutoSize = true; + this.labelTS142.Image = null; + this.labelTS142.Location = new System.Drawing.Point(6, 48); + this.labelTS142.Name = "labelTS142"; + this.labelTS142.Size = new System.Drawing.Size(41, 13); + this.labelTS142.TabIndex = 1; + this.labelTS142.Text = "bldr.cm"; + this.toolTip1.SetToolTip(this.labelTS142, "Indicator: build of magnitude correction curve. (Normal = 0)"); + // + // labelTS141 + // + this.labelTS141.AutoSize = true; + this.labelTS141.Image = null; + this.labelTS141.Location = new System.Drawing.Point(6, 24); + this.labelTS141.Name = "labelTS141"; + this.labelTS141.Size = new System.Drawing.Size(35, 13); + this.labelTS141.TabIndex = 0; + this.labelTS141.Text = "bldr.rx"; + this.toolTip1.SetToolTip(this.labelTS141, "Indicator: build of feedback magnitude curve. (Normal = 0)"); + // + // btnPSReset + // + this.btnPSReset.BackColor = System.Drawing.SystemColors.Control; + this.btnPSReset.Image = null; + this.btnPSReset.Location = new System.Drawing.Point(476, 12); + this.btnPSReset.Name = "btnPSReset"; + this.btnPSReset.Selectable = true; + this.btnPSReset.Size = new System.Drawing.Size(71, 20); + this.btnPSReset.TabIndex = 20; + this.btnPSReset.Text = "OFF"; + this.btnPSReset.UseVisualStyleBackColor = false; + this.btnPSReset.Click += new System.EventHandler(this.btnPSReset_Click); + // + // btnPSCalibrate + // + this.btnPSCalibrate.BackColor = System.Drawing.SystemColors.Control; + this.btnPSCalibrate.Image = null; + this.btnPSCalibrate.Location = new System.Drawing.Point(91, 12); + this.btnPSCalibrate.Name = "btnPSCalibrate"; + this.btnPSCalibrate.Selectable = true; + this.btnPSCalibrate.Size = new System.Drawing.Size(71, 20); + this.btnPSCalibrate.TabIndex = 19; + this.btnPSCalibrate.Text = "Single Cal"; + this.toolTip1.SetToolTip(this.btnPSCalibrate, "Perform a singal calibration. This will happen up to 5 times in a row"); + this.btnPSCalibrate.UseVisualStyleBackColor = false; + this.btnPSCalibrate.Click += new System.EventHandler(this.btnPSCalibrate_Click); + // + // labelTS140 + // + this.labelTS140.AutoSize = true; + this.labelTS140.ForeColor = System.Drawing.Color.White; + this.labelTS140.Image = null; + this.labelTS140.Location = new System.Drawing.Point(11, 90); + this.labelTS140.Name = "labelTS140"; + this.labelTS140.Size = new System.Drawing.Size(78, 13); + this.labelTS140.TabIndex = 17; + this.labelTS140.Text = "CAL Wait (sec)"; + // + // udPSCalWait + // + this.udPSCalWait.DecimalPlaces = 1; + this.udPSCalWait.Increment = new decimal(new int[] { + 1, + 0, + 0, + 65536}); + this.udPSCalWait.Location = new System.Drawing.Point(99, 88); + this.udPSCalWait.Maximum = new decimal(new int[] { + 100, + 0, + 0, + 0}); + this.udPSCalWait.Minimum = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.udPSCalWait.Name = "udPSCalWait"; + this.udPSCalWait.Size = new System.Drawing.Size(51, 20); + this.udPSCalWait.TabIndex = 16; + this.udPSCalWait.TinyStep = false; + this.toolTip1.SetToolTip(this.udPSCalWait, "Time to wait between calculating correction solutions. (Zero for fastest respons" + + "e.)"); + this.udPSCalWait.Value = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.udPSCalWait.ValueChanged += new System.EventHandler(this.udPSCalWait_ValueChanged); + // + // chkQuickAttenuate + // + this.chkQuickAttenuate.AutoSize = true; + this.chkQuickAttenuate.ForeColor = System.Drawing.SystemColors.HighlightText; + this.chkQuickAttenuate.Image = null; + this.chkQuickAttenuate.Location = new System.Drawing.Point(208, 108); + this.chkQuickAttenuate.Name = "chkQuickAttenuate"; + this.chkQuickAttenuate.Size = new System.Drawing.Size(154, 17); + this.chkQuickAttenuate.TabIndex = 49; + this.chkQuickAttenuate.Text = "Quick Attenuate Response"; + this.toolTip1.SetToolTip(this.chkQuickAttenuate, "Apply auto attenuation changes at a faster interval"); + this.chkQuickAttenuate.UseVisualStyleBackColor = true; + this.chkQuickAttenuate.CheckedChanged += new System.EventHandler(this.chkQuickAttenuate_CheckedChanged); + // + // chkAdvancedViewHidden + // + this.chkAdvancedViewHidden.AutoSize = true; + this.chkAdvancedViewHidden.BackColor = System.Drawing.SystemColors.ControlLightLight; + this.chkAdvancedViewHidden.Image = null; + this.chkAdvancedViewHidden.Location = new System.Drawing.Point(397, 189); + this.chkAdvancedViewHidden.Name = "chkAdvancedViewHidden"; + this.chkAdvancedViewHidden.Size = new System.Drawing.Size(150, 17); + this.chkAdvancedViewHidden.TabIndex = 50; + this.chkAdvancedViewHidden.Text = "chkAdvancedViewHidden"; + this.chkAdvancedViewHidden.UseVisualStyleBackColor = false; + this.chkAdvancedViewHidden.Visible = false; + // + // pbWarningSetPk + // + this.pbWarningSetPk.Image = ((System.Drawing.Image)(resources.GetObject("pbWarningSetPk.Image"))); + this.pbWarningSetPk.Location = new System.Drawing.Point(323, 35); + this.pbWarningSetPk.Name = "pbWarningSetPk"; + this.pbWarningSetPk.Size = new System.Drawing.Size(20, 20); + this.pbWarningSetPk.TabIndex = 51; + this.pbWarningSetPk.TabStop = false; + this.toolTip1.SetToolTip(this.pbWarningSetPk, resources.GetString("pbWarningSetPk.ToolTip")); + this.pbWarningSetPk.Visible = false; + // + // chkShow2ToneMeasurements + // + this.chkShow2ToneMeasurements.AutoSize = true; + this.chkShow2ToneMeasurements.ForeColor = System.Drawing.SystemColors.ControlLightLight; + this.chkShow2ToneMeasurements.Image = null; + this.chkShow2ToneMeasurements.Location = new System.Drawing.Point(389, 38); + this.chkShow2ToneMeasurements.Name = "chkShow2ToneMeasurements"; + this.chkShow2ToneMeasurements.Size = new System.Drawing.Size(158, 17); + this.chkShow2ToneMeasurements.TabIndex = 52; + this.chkShow2ToneMeasurements.Text = "Show 2Tone measurements"; + this.chkShow2ToneMeasurements.UseVisualStyleBackColor = true; + this.chkShow2ToneMeasurements.CheckedChanged += new System.EventHandler(this.chkShow2ToneMeasurements_CheckedChanged); + // + // PSForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.Black; + this.ClientSize = new System.Drawing.Size(560, 303); + this.Controls.Add(this.chkShow2ToneMeasurements); + this.Controls.Add(this.pbWarningSetPk); + this.Controls.Add(this.chkAdvancedViewHidden); + this.Controls.Add(this.chkQuickAttenuate); + this.Controls.Add(this.chkPSOnTop); + this.Controls.Add(this.lblPSTint); + this.Controls.Add(this.btnPSRestore); + this.Controls.Add(this.btnPSSave); + this.Controls.Add(this.btnPSAdvanced); + this.Controls.Add(this.comboPSTint); + this.Controls.Add(this.chkPSStbl); + this.Controls.Add(this.chkPSMap); + this.Controls.Add(this.chkPSPin); + this.Controls.Add(this.chkPSAutoAttenuate); + this.Controls.Add(this.btnPSAmpView); + this.Controls.Add(this.chkPSRelaxPtol); + this.Controls.Add(this.btnPSTwoToneGen); + this.Controls.Add(this.labelTS8); + this.Controls.Add(this.lblPSInfoFB); + this.Controls.Add(this.lblPSInfoCO); + this.Controls.Add(this.labelTS9); + this.Controls.Add(this.labelTS4); + this.Controls.Add(this.udPSMoxDelay); + this.Controls.Add(this.labelTS2); + this.Controls.Add(this.udPSPhnum); + this.Controls.Add(this.grpPSInfo); + this.Controls.Add(this.btnPSReset); + this.Controls.Add(this.btnPSCalibrate); + this.Controls.Add(this.labelTS140); + this.Controls.Add(this.udPSCalWait); + this.ForeColor = System.Drawing.SystemColors.ControlText; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Name = "PSForm"; + this.Text = "PureSignal 2.0"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.PSForm_Closing); + this.Load += new System.EventHandler(this.PSForm_Load); + ((System.ComponentModel.ISupportInitialize)(this.udPSMoxDelay)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.udPSPhnum)).EndInit(); + this.grpPSInfo.ResumeLayout(false); + this.grpPSInfo.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.udPSCalWait)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pbWarningSetPk)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + } #endregion @@ -941,7 +941,7 @@ private void InitializeComponent() private System.Windows.Forms.LabelTS labelTS1; private System.Windows.Forms.LabelTS labelTS5; private System.Windows.Forms.TextBoxTS txtPSpeak; - private System.Windows.Forms.TextBoxTS GetPSpeak; + private System.Windows.Forms.TextBoxTS txtGetPSpeak; private System.Windows.Forms.LabelTS labelTS3; private System.Windows.Forms.CheckBoxTS chkPSRelaxPtol; private System.Windows.Forms.ButtonTS btnPSAmpView; @@ -959,12 +959,12 @@ private void InitializeComponent() private System.Windows.Forms.ComboBoxTS comboPSTint; private System.Windows.Forms.ButtonTS btnPSAdvanced; private System.Windows.Forms.LabelTS lblPSTint; - private System.Windows.Forms.CheckBoxTS chkPSOnTop; - private System.Windows.Forms.CheckBoxTS chkQuickAttenuate; - private System.Windows.Forms.ButtonTS btnDefaultPeaks; - private System.Windows.Forms.CheckBoxTS chkAdvancedViewHidden; - private System.Windows.Forms.PictureBox pbWarningSetPk; - private System.Windows.Forms.ToolTip toolTip1; - private System.Windows.Forms.CheckBoxTS chkShow2ToneMeasurements; + private System.Windows.Forms.CheckBoxTS chkPSOnTop; + private System.Windows.Forms.CheckBoxTS chkQuickAttenuate; + private System.Windows.Forms.ButtonTS btnDefaultPeaks; + private System.Windows.Forms.CheckBoxTS chkAdvancedViewHidden; + private System.Windows.Forms.PictureBox pbWarningSetPk; + private System.Windows.Forms.ToolTip toolTip1; + private System.Windows.Forms.CheckBoxTS chkShow2ToneMeasurements; } } \ No newline at end of file diff --git a/Project Files/Source/Console/Thetis.csproj b/Project Files/Source/Console/Thetis.csproj index 0acf6b10..71129adf 100644 --- a/Project Files/Source/Console/Thetis.csproj +++ b/Project Files/Source/Console/Thetis.csproj @@ -511,6 +511,7 @@ frmVariablePicker.cs + diff --git a/Project Files/Source/Console/VersionInfo.cs b/Project Files/Source/Console/VersionInfo.cs new file mode 100644 index 00000000..fc1eeac4 --- /dev/null +++ b/Project Files/Source/Console/VersionInfo.cs @@ -0,0 +1,11 @@ +// +//Auto Generated Pre-Build event MW0LGE +// +using System; +namespace Thetis +{ + public static class VersionInfo + { + public static string BuildDate { get { return "02/04/26"; } } + } +} diff --git a/Project Files/Source/Console/audio.cs b/Project Files/Source/Console/audio.cs index 9dcd9f04..216c1acc 100644 --- a/Project Files/Source/Console/audio.cs +++ b/Project Files/Source/Console/audio.cs @@ -433,14 +433,13 @@ public static bool FullDuplex private static bool vfob_tx = false; public static bool VFOBTX { + get + { return vfob_tx; } + set { vfob_tx = value; } - get - { - return vfob_tx; - } } private static bool antivox_source_VAC = false; diff --git a/Project Files/Source/Console/clsDiscoveredRadioPicker.cs b/Project Files/Source/Console/clsDiscoveredRadioPicker.cs index 6c44b6d9..20792a2f 100644 --- a/Project Files/Source/Console/clsDiscoveredRadioPicker.cs +++ b/Project Files/Source/Console/clsDiscoveredRadioPicker.cs @@ -301,6 +301,13 @@ public List PickRadios(IWin32Window owner, List 0) + version += "." + radio.BetaVersion.ToString(); + break; + default: version = (radio.CodeVersion / 10.0f).ToString("F1"); if(radio.Protocol == RadioDiscoveryRadioProtocol.P2 && radio.BetaVersion > 0) diff --git a/Project Files/Source/Console/clsHardwareSpecific.cs b/Project Files/Source/Console/clsHardwareSpecific.cs index d8a8454c..907214f1 100644 --- a/Project Files/Source/Console/clsHardwareSpecific.cs +++ b/Project Files/Source/Console/clsHardwareSpecific.cs @@ -91,6 +91,13 @@ public static HPSDRModel Model NetworkIO.LRAudioSwap(1); HardwareSpecific.Hardware = HPSDRHW.Hermes; break; + case HPSDRModel.HERMESLITE: + NetworkIO.SetRxADC(1); + NetworkIO.SetMKIIBPF(0); + cmaster.SetADCSupply(0, 33); + NetworkIO.LRAudioSwap(1); + HardwareSpecific.Hardware = HPSDRHW.HermesLite; + break; case HPSDRModel.ANAN10: NetworkIO.SetRxADC(1); NetworkIO.SetMKIIBPF(0); @@ -239,18 +246,26 @@ public static bool HasVolts { get { - return _model == HPSDRModel.ANAN7000D || _model == HPSDRModel.ANAN8000D || - _model == HPSDRModel.ANVELINAPRO3 || _model == HPSDRModel.ANAN_G2 || - _model == HPSDRModel.ANAN_G2_1K || _model == HPSDRModel.REDPITAYA; + return _model == HPSDRModel.ANAN7000D || + _model == HPSDRModel.ANAN8000D || + _model == HPSDRModel.ANVELINAPRO3 || + _model == HPSDRModel.ANAN_G2 || + _model == HPSDRModel.ANAN_G2_1K || + _model == HPSDRModel.REDPITAYA || + _model == HPSDRModel.HERMESLITE; } } public static bool HasAmps { get { - return _model == HPSDRModel.ANAN7000D || _model == HPSDRModel.ANAN8000D || - _model == HPSDRModel.ANVELINAPRO3 || _model == HPSDRModel.ANAN_G2 || - _model == HPSDRModel.ANAN_G2_1K || _model == HPSDRModel.REDPITAYA; + return _model == HPSDRModel.ANAN7000D || + _model == HPSDRModel.ANAN8000D || + _model == HPSDRModel.ANVELINAPRO3 || + _model == HPSDRModel.ANAN_G2 || + _model == HPSDRModel.ANAN_G2_1K || + _model == HPSDRModel.REDPITAYA || + _model == HPSDRModel.HERMESLITE; } } public static (float, float) GetDefaultVoltCalibration() @@ -293,6 +308,8 @@ public static double PSDefaultPeak { //protocol 1 switch (_hardware) { + case HPSDRHW.HermesLite: + return 0.233; default: return 0.4072; } @@ -301,6 +318,8 @@ public static double PSDefaultPeak { //protocol 2 switch (_hardware) { + case HPSDRHW.HermesLite: + return 0.233; case HPSDRHW.Saturn: return 0.6121; default: @@ -341,7 +360,9 @@ public static HPSDRModel StringModelToEnum(string sModel) return HPSDRModel.ANAN_G2_1K; case "ANVELINA-PRO3": return HPSDRModel.ANVELINAPRO3; - case "HERMESLITE": + case "HERMES LITE": + return HPSDRModel.HERMESLITE; + case "HERMES-LITE": return HPSDRModel.HERMESLITE; case "RED-PITAYA": return HPSDRModel.REDPITAYA; @@ -745,6 +766,36 @@ public static float[] DefaultPAGainsForBands(HPSDRModel model) return gains; + case HPSDRModel.HERMESLITE: + gains[(int)Band.B160M] = 100f; + gains[(int)Band.B80M] = 100f; + gains[(int)Band.B60M] = 100f; + gains[(int)Band.B40M] = 100f; + gains[(int)Band.B30M] = 100f; + gains[(int)Band.B20M] = 100f; + gains[(int)Band.B17M] = 100f; + gains[(int)Band.B15M] = 100f; + gains[(int)Band.B12M] = 100f; + gains[(int)Band.B10M] = 100f; + gains[(int)Band.B6M] = 38.8f; + + gains[(int)Band.VHF0] = 38.8f; + gains[(int)Band.VHF1] = 38.8f; + gains[(int)Band.VHF2] = 38.8f; + gains[(int)Band.VHF3] = 38.8f; + gains[(int)Band.VHF4] = 38.8f; + gains[(int)Band.VHF5] = 38.8f; + gains[(int)Band.VHF6] = 38.8f; + gains[(int)Band.VHF7] = 38.8f; + gains[(int)Band.VHF8] = 38.8f; + gains[(int)Band.VHF9] = 38.8f; + gains[(int)Band.VHF10] = 38.8f; + gains[(int)Band.VHF11] = 38.8f; + gains[(int)Band.VHF12] = 38.8f; + gains[(int)Band.VHF13] = 38.8f; + + return gains; + default: return gains; } diff --git a/Project Files/Source/Console/cmaster.cs b/Project Files/Source/Console/cmaster.cs index ff793959..764d4735 100644 --- a/Project Files/Source/Console/cmaster.cs +++ b/Project Files/Source/Console/cmaster.cs @@ -533,7 +533,7 @@ public static void CMCreateCMaster() SetPSRxIdx(0, 0); // txid = 0, all current models use Stream0 for RX feedback SetPSTxIdx(0, 1); // txid = 0, all current models use Stream1 for TX feedback puresignal.SetPSFeedbackRate(txch, ps_rate); - puresignal.SetPSHWPeak(txch, 0.2899); + //puresignal.SetPSHWPeak(txch, 0.2899); // MI0BOT: Corrected for in CMLoadRouterAll() // setup transmitter display WDSP.TXASetSipMode(txch, 1); // 1=>call the appropriate 'analyzer' @@ -560,6 +560,11 @@ public static bool PSLoopback public static void CMLoadRouterAll(HPSDRModel model) { + int txinid = cmaster.inid(1, 0); // stream id + int txch = cmaster.chid(txinid, 0); // wdsp channel + + puresignal.SetPSHWPeak(txch, HardwareSpecific.PSDefaultPeak); // MI0BOT: Correct for correct PS value + switch (NetworkIO.CurrentRadioProtocol) { case RadioProtocol.USB: //Protocol 1 @@ -587,6 +592,7 @@ public static void CMLoadRouterAll(HPSDRModel model) LoadRouterAll((void*)0, 0, 1, 2, 8, pstreams, pfunction, pcallid); break; case HPSDRModel.HERMES: + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 case HPSDRModel.ANAN10: case HPSDRModel.ANAN100: int[] FOUR_DDC_Function = new int[48] @@ -676,6 +682,7 @@ public static void CMLoadRouterAll(HPSDRModel model) LoadRouterAll((void*)0, 0, 1, /*1*/2, 8, pstreams, pfunction, pcallid); //MW0LGE_21d DUP on top panadaptor (Warren provided info) break; case HPSDRModel.HERMES: + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 case HPSDRModel.ANAN10: case HPSDRModel.ANAN100: int[] FOUR_DDC_Function = new int[24] @@ -797,6 +804,7 @@ public static void CMLoadRouterAll(HPSDRModel model) break; case HPSDRModel.HERMES: + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 case HPSDRModel.ANAN10: case HPSDRModel.ANAN100: case HPSDRModel.ANAN10E: @@ -874,6 +882,7 @@ public static void CMLoadRouterAll(HPSDRModel model) break; case HPSDRModel.HERMES: + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 case HPSDRModel.ANAN10: case HPSDRModel.ANAN100: case HPSDRModel.ANAN10E: diff --git a/Project Files/Source/Console/console.Designer.cs b/Project Files/Source/Console/console.Designer.cs index 36062e49..ad2d7282 100644 --- a/Project Files/Source/Console/console.Designer.cs +++ b/Project Files/Source/Console/console.Designer.cs @@ -2390,6 +2390,7 @@ private void InitializeComponent() this.chkEnableMultiRX.Name = "chkEnableMultiRX"; this.toolTip1.SetToolTip(this.chkEnableMultiRX, resources.GetString("chkEnableMultiRX.ToolTip")); this.chkEnableMultiRX.CheckedChanged += new System.EventHandler(this.chkEnableMultiRX_CheckedChanged); + this.chkEnableMultiRX.MouseDown += new System.Windows.Forms.MouseEventHandler(this.chkEnableMultiRX_MouseDown); // // chkDisplayPeak // diff --git a/Project Files/Source/Console/console.cs b/Project Files/Source/Console/console.cs index 7ea39c37..fadc31e0 100644 --- a/Project Files/Source/Console/console.cs +++ b/Project Files/Source/Console/console.cs @@ -121,6 +121,9 @@ public partial class Console : Form private Thread noise_gate_update_thread; // polls the mic input during TX private Thread _overload_thread; public bool _pause_DisplayThread = true; // MW0LGE_21d initally paused + private Thread IOBoard_update_thread; // updates the HL2 I/O board (MI0BOT) + + private bool calibration_running = false; private bool displaydidit = false; public Mutex calibration_mutex = new Mutex(); @@ -798,13 +801,6 @@ public Console(string[] args) LogTool.AddLogEntry("Initialising database...", "DB"); Splash.SetStatus("Initializing Database"); // Set progress point - //Uncomment for HL2 build - //bool dbid_exists = args.Any(arg => arg.IndexOf("-dbid", StringComparison.OrdinalIgnoreCase) >= 0); - //if (!dbid_exists) - //{ - // Array.Resize(ref args, args.Length + 1); - // args[args.Length - 1] = "-dbid:HL2"; - //} bool ok = DBMan.LoadDB(args, out string broken_folder); if (!ok) { @@ -2099,6 +2095,37 @@ private void InitConsole() } // + if (HPSDRHW.HermesLite == Audio.LastRadioHardware || + HPSDRModel.HERMESLITE == HardwareSpecific.Model) // MI0BOT: Need an early indication of hardware type due to HL2 rx attenuator can be negative + { + ptbPWR.Maximum = 90; // MI0BOT: Changes for HL2 only having a 16 step output attenuator + ptbPWR.Value = 0; + ptbPWR.LargeChange = 6; + ptbPWR.SmallChange = 6; + ptbTune.Maximum = 99; + ptbTune.Value = 0; + ptbTune.LargeChange = 3; + ptbTune.SmallChange = 3; + + // MI0BOT: Changes for HL2 having a greater range of LNA + udRX1StepAttData.Maximum = 31; + udRX2StepAttData.Maximum = 31; + udRX1StepAttData.Minimum = -28; + udRX2StepAttData.Minimum = -28; + udTXStepAttData.Minimum = -28; + + comboRX2Preamp.Enabled = false; + udRX2StepAttData.Enabled = false; + lblRX2Preamp.Enabled = false; + + // MI0BOT: Remove items from main menu that are currently not used + + this.menuStrip1.Items.Remove(pIToolStripMenuItem); + this.menuStrip1.Items.Remove(wBToolStripMenuItem); + this.menuStrip1.Items.Remove(eSCToolStripMenuItem); + this.menuStrip1.Items.Remove(BPFToolStripMenuItem); + } + UpdateTXProfile(SetupForm.TXProfile); // now update the combos LogTool.AddLogEntry(" Finalising settings...", "FINSET"); @@ -6742,6 +6769,7 @@ public float CalibratedPAPower() case HPSDRModel.ANAN8000D: interval = 20.0f; break; + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 case HPSDRModel.ANAN10: case HPSDRModel.ANAN10E: interval = 1.0f; @@ -8206,7 +8234,9 @@ public void UpdateDDCs(bool rx2_enabled) bool diversity_enabled = Diversity2; if (diversity_enabled) P1_diversity = 1; - switch (HardwareSpecific.Model) + HPSDRModel hpsdr_model = HardwareSpecific.Model; + + switch (hpsdr_model) { case HPSDRModel.ANAN100D: case HPSDRModel.ANAN200D: @@ -8376,6 +8406,7 @@ public void UpdateDDCs(bool rx2_enabled) } break; case HPSDRModel.HERMES: + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 case HPSDRModel.ANAN10: case HPSDRModel.ANAN100: P1_rxcount = 4; // RX4 used for puresignal feedback @@ -8442,6 +8473,16 @@ public void UpdateDDCs(bool rx2_enabled) SyncEnable = DDC1; Rate[0] = ps_rate; Rate[1] = ps_rate; + if (hpsdr_model == HPSDRModel.HERMESLITE) // MI0BOT: HL2 can work at a high sample rate + { + Rate[0] = rx1_rate; + Rate[1] = rx1_rate; + } + else + { + Rate[0] = ps_rate; + Rate[1] = ps_rate; + } cntrl1 = 4; cntrl2 = 0; } @@ -8512,8 +8553,6 @@ public void UpdateDDCs(bool rx2_enabled) P1_DDCConfig = 5; DDCEnable = DDC0; SyncEnable = DDC1; - Rate[0] = ps_rate; - Rate[1] = ps_rate; cntrl1 = 4; cntrl2 = 0; } @@ -8598,6 +8637,7 @@ public void GetDDC(out int DDCrx1, out int DDCrx2, out int DDCsync1, out int DDC break; //case HPSDRHW.Atlas: /// ??? case HPSDRHW.Hermes: // ANAN-10 ANAN-100 Heremes + case HPSDRHW.HermesLite: // HL2 doesn't support P2 but need to have entry to correcly ID hardware case HPSDRHW.HermesII: // ANAN-10E ANAN-100B HeremesII switch (tot) { @@ -8691,6 +8731,7 @@ public void GetDDC(out int DDCrx1, out int DDCrx2, out int DDCsync1, out int DDC break; // case HPSDRHW.Atlas: /// ??? case HPSDRHW.Hermes: // ANAN-10 ANAN-100 Heremes (4 adc) + case HPSDRHW.HermesLite: // MI0BOT: Hermes Lite 2 switch (tot) { case 0: // off off off @@ -10612,8 +10653,17 @@ public int TxAttenData setTXstepAttenuatorForBand(_tx_band, _tx_attenuator_data); //[2.10.3.6]MW0LGE att_fixes #399 if (m_bATTonTX) { - NetworkIO.SetTxAttenData(_tx_attenuator_data); //[2.10.3.6]MW0LGE att_fixes + + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + NetworkIO.SetTxAttenData(31 - _tx_attenuator_data); // MI0BOT: Greater range for HL2 + else + { + NetworkIO.SetTxAttenData(_tx_attenuator_data); //[2.10.3.6]MW0LGE att_fixes + Display.TXAttenuatorOffset = _tx_attenuator_data; //[2.10.3.6]MW0LGE att_fixes + } + Display.TXAttenuatorOffset = _tx_attenuator_data; //[2.10.3.6]MW0LGE att_fixes + } else { @@ -10985,9 +11035,15 @@ public int RX1AttenuatorData if (oldData != _rx1_attenuator_data) AttenuatorDataChangedHandlers?.Invoke(1, oldData, _rx1_attenuator_data); return; } - + _from_attenuatordata[0] = true; - if (alexpresent && + + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) // MI0BOT: HL2 LNA has wider range + { + udRX1StepAttData.Maximum = (decimal)32; + udRX1StepAttData.Minimum = (decimal)-28; + } + else if (alexpresent && HardwareSpecific.Model != HPSDRModel.ANAN10 && HardwareSpecific.Model != HPSDRModel.ANAN10E && HardwareSpecific.Model != HPSDRModel.ANAN7000D && @@ -10998,7 +11054,8 @@ public int RX1AttenuatorData HardwareSpecific.Model != HPSDRModel.ANVELINAPRO3 && HardwareSpecific.Model != HPSDRModel.REDPITAYA) //DH1KLM udRX1StepAttData.Maximum = (decimal)61; - else udRX1StepAttData.Maximum = (decimal)31; + else + udRX1StepAttData.Maximum = (decimal)31; _from_attenuatordata[0] = false; _rx1_attenuator_data = validateRX1StepAttData(_rx1_attenuator_data); //[2.10.3.9]MW0LGE validated @@ -11012,7 +11069,12 @@ public int RX1AttenuatorData if (_rx1_step_att_enabled) { - if (alexpresent && + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) // MI0BOT: HL2 wider LNA range + { + NetworkIO.SetAlexAtten(0); + NetworkIO.SetADC1StepAttenData(31 - _rx1_attenuator_data); + } + else if (alexpresent && HardwareSpecific.Model != HPSDRModel.ANAN10 && HardwareSpecific.Model != HPSDRModel.ANAN10E && HardwareSpecific.Model != HPSDRModel.ANAN7000D && @@ -11152,7 +11214,13 @@ public int RX2AttenuatorData } _from_attenuatordata[1] = true; - if (alexpresent && + + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) // MI0BOT: HL2 LNA has wider range + { + udRX2StepAttData.Maximum = (decimal)32; + udRX2StepAttData.Minimum = (decimal)-28; + } + else if (alexpresent && HardwareSpecific.Model != HPSDRModel.ANAN10 && HardwareSpecific.Model != HPSDRModel.ANAN10E && HardwareSpecific.Model != HPSDRModel.ANAN7000D && @@ -11177,7 +11245,12 @@ public int RX2AttenuatorData if (_rx2_step_att_enabled) { - if (alexpresent && + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) // MI0BOT: HL2 wider LNA range + { + NetworkIO.SetAlexAtten(0); + NetworkIO.SetADC1StepAttenData(31 - _rx1_attenuator_data); + } + else if (alexpresent && HardwareSpecific.Model != HPSDRModel.ANAN10 && HardwareSpecific.Model != HPSDRModel.ANAN10E && HardwareSpecific.Model != HPSDRModel.ANAN7000D && @@ -11244,7 +11317,7 @@ public int RX2AttenuatorData } private int[] m_nTuneStepsByMode; //MW0LGE_21j - + private List tune_step_list; // A list of available tuning steps public List TuneStepList { @@ -14770,6 +14843,11 @@ public void SetupForHPSDRModel() chkDX.Visible = false; _rx2_preamp_present = false; break; + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 + chkDX.Checked = false; + chkDX.Visible = false; + _rx2_preamp_present = false; + break; case HPSDRModel.ANAN10: chkDX.Checked = false; chkDX.Visible = false; @@ -14835,6 +14913,7 @@ public void SetupForHPSDRModel() case HPSDRModel.HPSDR: break; case HPSDRModel.HERMES: + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 case HPSDRModel.ANAN10: case HPSDRModel.ANAN10E: case HPSDRModel.ANAN100: @@ -14943,11 +15022,23 @@ private void UpdateTRXAnt() { if (chkRxAnt.Checked) { - if (!Alex.trx_ant_different && !initializing) + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) { - chkRxAnt.Checked = false; - return; + // MI0BOT: Just return out to preserve the state of the rx antenna over reboots + if (initializing) + { + return; + } + } + else + { + if (!Alex.trx_ant_different && !initializing) + { + chkRxAnt.Checked = false; + return; + } } + Alex.TRxAnt = true; chkRxAnt.Text = "Tx Ant"; chkRxAnt.ForeColor = Color.Yellow; @@ -15380,6 +15471,7 @@ private void UpdateRX1DDSFreq() switch (HardwareSpecific.Model) { case HPSDRModel.HERMES: + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 case HPSDRModel.ANAN10: case HPSDRModel.ANAN10E: case HPSDRModel.ANAN100: @@ -15418,6 +15510,7 @@ private void UpdateRX2DDSFreq() switch (HardwareSpecific.Model) { case HPSDRModel.HERMES: + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 case HPSDRModel.ANAN10: case HPSDRModel.ANAN10E: case HPSDRModel.ANAN100: @@ -16894,6 +16987,15 @@ public bool CATEnabled get { return cat_enabled; } } + private bool cat_to_vfo_b = false; // MI0BOT: Flag used to identify that CAT commands should operate on VFO B + public bool CATtoVFOB + { + set + { cat_to_vfo_b = value; } + get + { return cat_to_vfo_b; } + } + // property set when An Andromeda panel is connected via a serial CAT port. // NOT used for G2 panel accessed via TCP/IP // when connection established, request ID. @@ -18411,7 +18513,11 @@ public int PWR set { value = Math.Max(0, value); // lower bound - value = Math.Min(100, value); // upper bound + + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) // Mi0BOT: Limit upper bound for HL2 + value = Math.Min(90, value); // upper bound + else + value = Math.Min(100, value); // upper bound ptbPWR.Value = value; ptbPWR_Scroll(this, EventArgs.Empty); @@ -18423,6 +18529,7 @@ public int TunePWR //MW0LGE_22b set { value = Math.Max(0, value); // lower bound + value = Math.Min(100, value); // upper bound ptbTune.Value = value; @@ -19053,7 +19160,12 @@ public bool ATTOnTX if (m_bATTonTX) { int txatt = getTXstepAttenuatorForBand(_tx_band); - NetworkIO.SetTxAttenData(txatt); //[2.10.3.6]MW0LGE att_fixes + + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + NetworkIO.SetTxAttenData(31 - txatt); // MI0BOT: Greater range for HL2 + else + NetworkIO.SetTxAttenData(txatt); //[2.10.3.6]MW0LGE att_fixes + Display.TXAttenuatorOffset = txatt; //[2.10.3.6]MW0LGE att_fixes } else @@ -19062,7 +19174,6 @@ public bool ATTOnTX Display.TXAttenuatorOffset = 0; } } - } } @@ -19265,7 +19376,9 @@ public PreampMode RX1PreampMode { if (!_rx1_step_att_enabled) { - if (nRX1ADCinUse == 0) NetworkIO.SetADC1StepAttenData(rx1_att_value); + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) // MI0BOT: Adjustment for HL2 LNA range + NetworkIO.SetADC1StepAttenData(31 - rx1_att_value); + else if (nRX1ADCinUse == 0) NetworkIO.SetADC1StepAttenData(rx1_att_value); else if (nRX1ADCinUse == 1) NetworkIO.SetADC2StepAttenData(rx1_att_value); else if (nRX1ADCinUse == 2) NetworkIO.SetADC3StepAttenData(rx1_att_value); } @@ -21225,10 +21338,30 @@ private class HistoricAttenuatorReading private int _auto_att_hold_delay_rx2 = 5; private DateTime _auto_att_last_hold_time_rx1 = DateTime.UtcNow; private DateTime _auto_att_last_hold_time_rx2 = DateTime.UtcNow; + private bool _band_change = false; public bool AutoAttRX1 { - get { return _auto_att_rx1; } - set { _auto_att_rx1 = value; } + get { + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + if (_auto_att_rx1) + lblPreamp.Text = "A-ATT"; + else + lblPreamp.Text = "S-ATT"; + + return _auto_att_rx1; + } + set + { + _auto_att_rx1 = value; + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + if (_auto_att_rx1) + { + lblPreamp.Text = "A-ATT"; + _band_change = true; + } + else + lblPreamp.Text = "S-ATT"; + } } public bool AutoAttUndoRX1 { @@ -21385,7 +21518,10 @@ overload adc_oload_num if (!string.IsNullOrEmpty(sWarning)) { sWarning = sWarning.Trim(); - infoBar.Warning(sWarning, red_warning, overload_only ? 1000 : 2000); + + if (HardwareSpecific.Model != HPSDRModel.HERMESLITE || + AutoAttRX1 == false) + infoBar.Warning(sWarning, red_warning, overload_only ? 1000 : 2000); } //adjust s-att offset @@ -21538,7 +21674,8 @@ private void handleOverload() HardwareSpecific.Model == HPSDRModel.ANAN100D || HardwareSpecific.Model == HPSDRModel.ANAN200D || HardwareSpecific.Model == HPSDRModel.ANAN7000D || HardwareSpecific.Model == HPSDRModel.ANAN8000D || HardwareSpecific.Model == HPSDRModel.ANAN_G2 || HardwareSpecific.Model == HPSDRModel.ANAN_G2_1K || - HardwareSpecific.Model == HPSDRModel.ANVELINAPRO3 || HardwareSpecific.Model == HPSDRModel.REDPITAYA; + HardwareSpecific.Model == HPSDRModel.ANVELINAPRO3 || HardwareSpecific.Model == HPSDRModel.REDPITAYA || //DH1KLM + HardwareSpecific.Model == HPSDRModel.HERMESLITE; if (_auto_att_rx1 && radioHasRx1Att) { @@ -21552,18 +21689,30 @@ private void handleOverload() if (_rx1_step_att_enabled) { - har.stepAttenuator = RX1AttenuatorData; - - int att = har.stepAttenuator + (_adc_overloaded[0] ? _adc_step_shift[0] : _adc_step_shift[1]); - if (att > 31) att = 31; - - if (att != har.stepAttenuator) + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) { - RX1AttenuatorData = att; + _band_change = false; + + if (RX1AttenuatorData < (31 - 3)) + RX1AttenuatorData += 3; + _auto_att_last_hold_time_rx1 = now; - _historic_attenuator_readings_rx1.Push(har); + } + else + { + har.stepAttenuator = RX1AttenuatorData; + + int att = har.stepAttenuator + (_adc_overloaded[0] ? _adc_step_shift[0] : _adc_step_shift[1]); + if (att > 31) att = 31; + + if (att != har.stepAttenuator) + { + RX1AttenuatorData = att; + _auto_att_last_hold_time_rx1 = now; + _historic_attenuator_readings_rx1.Push(har); AutoAttAppliedRX1 = true; + } } } else @@ -21594,6 +21743,17 @@ private void handleOverload() } } } + else if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + { + if (_band_change || + (_auto_att_undo_rx1 && (((now - _auto_att_last_hold_time_rx1).TotalSeconds > _auto_att_hold_delay_rx1)))) + { + if (RX1AttenuatorData > -28) + RX1AttenuatorData--; + + _auto_att_last_hold_time_rx1 = now; + } + } else if ((nRX1ADCinUse == 0 || nRX1ADCinUse == 1) && _historic_attenuator_readings_rx1.Any()) // no overload rx1 { if (!_auto_att_undo_rx1 || (_auto_att_undo_rx1 && ((now - _auto_att_last_hold_time_rx1).TotalSeconds >= _auto_att_hold_delay_rx1))) @@ -22567,6 +22727,7 @@ private void getMeterPixelPosAndDrawScales(int rx, Graphics g, int H, int W, dou else if ((alexpresent || pa_present) && (HardwareSpecific.Model != HPSDRModel.ANAN10 && HardwareSpecific.Model != HPSDRModel.ANAN10E && + HardwareSpecific.Model != HPSDRModel.HERMESLITE && // MI0BOT: HL2 !apollopresent)) { if (bDrawMarkers) @@ -22629,7 +22790,8 @@ private void getMeterPixelPosAndDrawScales(int rx, Graphics g, int H, int W, dou } } else if (HardwareSpecific.Model == HPSDRModel.ANAN10 || - HardwareSpecific.Model == HPSDRModel.ANAN10E) + HardwareSpecific.Model == HPSDRModel.ANAN10E || + HardwareSpecific.Model == HPSDRModel.HERMESLITE) // MI0BOT: HL2 { if (bDrawMarkers) { @@ -22817,6 +22979,7 @@ private void getMeterPixelPosAndDrawScales(int rx, Graphics g, int H, int W, dou if ((alexpresent || pa_present) && (HardwareSpecific.Model != HPSDRModel.ANAN10 && HardwareSpecific.Model != HPSDRModel.ANAN10E && + HardwareSpecific.Model != HPSDRModel.HERMESLITE && // MI0BOT: HL2 !apollopresent)) { if (bDrawMarkers) @@ -22956,7 +23119,8 @@ private void getMeterPixelPosAndDrawScales(int rx, Graphics g, int H, int W, dou } else if (HardwareSpecific.Model == HPSDRModel.ANAN10 || - HardwareSpecific.Model == HPSDRModel.ANAN10E) + HardwareSpecific.Model == HPSDRModel.ANAN10E || + HardwareSpecific.Model == HPSDRModel.HERMESLITE) { if (bDrawMarkers) { @@ -23728,6 +23892,7 @@ private void picMultiMeterDigital_Paint(object sender, System.Windows.Forms.Pain case MeterTXMode.SWR_POWER: if (HardwareSpecific.Model == HPSDRModel.ANAN10 || HardwareSpecific.Model == HPSDRModel.ANAN10E || + HardwareSpecific.Model == HPSDRModel.HERMESLITE || // MI0BOT: HL2 apollopresent) output = num.ToString(format) + " W"; else if (alexpresent || pa_present) output = num.ToString(format) + " W"; else output = num.ToString(format) + " mW"; @@ -24746,8 +24911,10 @@ public float computeHermesDCVoltage() private float _MKIIPAVolts = 0f; private float _MKIIPAAmps = 0f; + private float _MKIIHL2Temp = 0f; // MI0BOT: HL2 temperature private ConcurrentQueue _voltsQueue = new ConcurrentQueue(); private ConcurrentQueue _ampsQueue = new ConcurrentQueue(); + private ConcurrentQueue _tempQueue = new ConcurrentQueue(); // MI0BOT: HL2 temperature public float MKIIPAVolts { get { return _MKIIPAVolts; } @@ -24763,10 +24930,22 @@ private async void readMKIIPAVoltsAmps() //G8NJJ need similar code for Saturn here, but rates from Ssaturn will be different while (chkPower.Checked && HardwareSpecific.HasVolts && HardwareSpecific.HasAmps) { - int adc0 = NetworkIO.getUserADC0(); - int adc1 = NetworkIO.getUserADC1(); - _voltsQueue.Enqueue(adc0); - _ampsQueue.Enqueue(adc1); + + int adc0 = 0; + int adc1 = 0; + + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) // MI0BOT: HL2 temperature & current + { + _ampsQueue.Enqueue(NetworkIO.getUserADC0()); + _tempQueue.Enqueue(NetworkIO.getExciterPower()); + } + else + { + adc0 = NetworkIO.getUserADC0(); + adc1 = NetworkIO.getUserADC1(); + _voltsQueue.Enqueue(adc0); + _ampsQueue.Enqueue(adc1); + } bool bOk; int nTries = 0; @@ -24791,6 +24970,20 @@ private async void readMKIIPAVoltsAmps() } } + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + { + nTries = 0; + while (_tempQueue.Count > 100 && nTries < 100) // MI0BOT: HL2 temperature, keep max 100 in the queue + { + bOk = _tempQueue.TryDequeue(out int tmp); + if (!bOk) + { + await Task.Delay(1); + nTries++; + } + } + } + await Task.Delay(8); // [2.10.1.0]MW0LGE log data to VALog.txt @@ -24825,7 +25018,8 @@ private async void readMKIIPAVoltsAmps() // } _MKIIPAVolts = 0f; - _MKIIPAAmps = 0; + _MKIIPAAmps = 0f; + _MKIIHL2Temp = 0f; // MI0BOT: HL2 temperature //there is no clear for ConcurrentQueues, we need to dequeue to clear int tries; @@ -24876,10 +25070,14 @@ private void computeMKIIPAVoltsAmps() { float voltAverage = _voltsQueue.Count > 0 ? (float)_voltsQueue.Average() : 0; float ampAverage = _ampsQueue.Count > 0 ? (float)_ampsQueue.Average() : 0; + float tempAverage = _tempQueue.Count > 0 ? (float)_tempQueue.Average() : 0; // MI0BOT: HL2 temperature //volts _MKIIPAVolts = convertToVolts(voltAverage); + // MI0BOT: temp for HL2 + _MKIIHL2Temp = (3.26f * (tempAverage / 4096.0f) - 0.5f) / 0.01f; + //amps _MKIIPAAmps = convertToAmps(ampAverage); } @@ -24917,11 +25115,28 @@ private float convertToAmps(float IOreading) { float voff = _amp_voff; float sens = _amp_sens; + float amps = 0f; + float fwdvolts = (IOreading * 5000.0f) / 4095.0f; - if (fwdvolts < 0) fwdvolts = 0.0f; - float amps = ((fwdvolts - voff) / sens); - // float amps = (0.01f * adc - 2.91f); - if (amps < 0) amps = 0.0f; + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) // MI0BOT: HL2 current + { + // 3.26 Ref voltage + // 4096 steps in ADC + // Gain of x50 for sense amp + // Sense resistor is 0.04 Ohms + amps = ((3.26f * (IOreading / 4096.0f)) / 50.0f) / 0.04f; + + // Scale by resistor voltage divider 1000/(1000+270) at input of slow ADC + amps = amps / (1000.0f / 1270.0f); + } + else + { + if (fwdvolts < 0) fwdvolts = 0.0f; + amps = ((fwdvolts - voff) / sens); + // float amps = (0.01f * adc - 2.91f); + if (amps < 0) amps = 0.0f; + } + return amps; } @@ -24977,6 +25192,11 @@ public float computeRefPower() refvoltage = 5.0f; adc_cal_offset = 16; break; + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 + bridge_volt = 1.5f; + refvoltage = 3.3f; + adc_cal_offset = 6; + break; default: bridge_volt = 0.09f; if (_tx_band == Band.B6M) @@ -25046,6 +25266,11 @@ public float computeAlexFwdPower() refvoltage = 5.0f; adc_cal_offset = 18; break; + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 + bridge_volt = 1.5f; + refvoltage = 3.3f; + adc_cal_offset = 6; + break; default: bridge_volt = 0.09f; refvoltage = 3.3f; @@ -25309,6 +25534,36 @@ public float computeANANExciterPower() return (float)result; } + public void computeHermesLiteTemp() // MI0BOT: HL2 + { + float adc = 0; + float addadc = 0; + + for (int count = 0; count < 100; count++) + { + adc = NetworkIO.getExciterPower(); // This method returns temp for HL2 + addadc += adc; + Thread.Sleep(1); + } + + adc = addadc / 100.0f; + } + + public void computeHermesLitePAAmps() // MI0BOT: HL2 + { + float adc = 0; + float addadc = 0; + + for (int count = 0; count < 100; count++) + { + adc = NetworkIO.getUserADC0(); // This method returns PA current for HL2 + addadc += adc; + Thread.Sleep(1); + } + + adc = addadc / 100.0f; // Average counts + } + private float sql_data = -200.0f; private async void UpdateSQL() { @@ -25358,6 +25613,337 @@ private async void UpdateNoiseGate() } } + public void SetIOBoardAerialPorts(int rx_only_ant, int rx_ant, int tx_ant, bool tx) // MI0BOT: Control I/O Board's aerial capabilities + { + SetIOBoardAerialPorts(rx_only_ant); + + IOBoardAerialPorts = (byte) (rx_ant & 0x0f); + IOBoardAerialPorts |= (byte) (tx_ant << 4); + } + + public void SetIOBoardAerialPorts(int rx_only_ant) // MI0BOT: Control I/O Board's Alt Rx aerial facility + { + switch (rx_only_ant) + { + case 1: + IOBoardAerialMode = 2; + break; + + case 0: + default: + IOBoardAerialMode = 0; + break; + } + } + + private byte IOBoardAerialMode = 0; + private byte IOBoardAerialPorts = 0; + private bool I2CPollingPause = false; + + public void SetI2CPollingPause( bool pause ) + { + I2CPollingPause = pause; + if (pause) Thread.Sleep(45); + } + + public enum AutoTuneState + { + Disabled = 0, + Idle, + StartTune, + WaitRF, + Tuning, + Fault, + } + + public enum ProtocolEvent + { + Start = -1, // MI0BOT: Not strictly a protocol event but used to start the whole process + Idle = 0x00, + RequestTune = 0x01, + RequestRF = 0xEE, + Fault = 0xF0, + } + + private AutoTuneState auto_tuning = AutoTuneState.Disabled; // MI0BOT: Holds state when the Auto TUN button is active + private int tune_timeout = 0; // MI0BOT: Auto tune timeout + private int fault_timeout = 0; + const byte TIMEOUT = 50; + bool AutoTuningHL2(ProtocolEvent protocolEvent) + { + bool returnCode = false; + //Debug.WriteLine("State: " + state.ToString()); + + switch (protocolEvent) // Event information of the protocol + { + + case ProtocolEvent.Start: // The tune key has been pressed + if (Control.ModifierKeys == Keys.Control && + SetupForm.HL2IOBoardPresent == true && + (AutoTuneState.Idle == auto_tuning || + AutoTuneState.Fault == auto_tuning)) + { + auto_tuning = AutoTuneState.StartTune; + returnCode = true; + } + break; + + case ProtocolEvent.Idle: // Protocol is idle + switch (auto_tuning) + { + case AutoTuneState.Idle: + break; + + case AutoTuneState.StartTune: // Auto tune has been instigated from UI + ioBoard.writeRequest(IOBoard.Registers.REG_ANTENNA_TUNER, (int)ProtocolEvent.RequestTune); // Start the tune via the protocol + auto_tuning = AutoTuneState.WaitRF; + tune_timeout = 0; + fault_timeout = 0; + chkTUN.Text = "AUTO"; + break; + + case AutoTuneState.Fault: // Auto tune has had a fault time out the message + if (fault_timeout++ >= TIMEOUT) + { + infoBar.Warning(""); + auto_tuning = AutoTuneState.Idle; + fault_timeout = 0; + } + break; + + default: + tune_timeout = TIMEOUT; + break; + } + break; + + case ProtocolEvent.RequestTune: // There has been no advance of protocol state, just advance timeout + switch (auto_tuning) + { + case AutoTuneState.WaitRF: + tune_timeout++; + break; + + default: + tune_timeout = TIMEOUT; + break; + } + break; + + case ProtocolEvent.RequestRF: // Protocol has requested RF + switch (auto_tuning) + { + case AutoTuneState.WaitRF: + auto_tuning = AutoTuneState.Tuning; + chkTUN_CheckedChanged(this, EventArgs.Empty); // Call CheckedChanged directly as the check flag is already true + break; + + case AutoTuneState.Tuning: + tune_timeout++; + break; + + default: + tune_timeout = TIMEOUT; + break; + } + break; + + default: + // Unexpected return, cancel tuning by setting timeout + + if(protocolEvent >= ProtocolEvent.Fault) + { + auto_tuning = AutoTuneState.Fault; + fault_timeout = 0; + infoBar.Warning("I/O Board: Auto Tune Fault Code 0x" + ((byte)protocolEvent).ToString("X")); + } + + tune_timeout = TIMEOUT; + break; + } + + if (tune_timeout >= TIMEOUT) + { // Time out + tune_timeout = 0; + ioBoard.writeRequest(IOBoard.Registers.REG_ANTENNA_TUNER, (int)ProtocolEvent.Idle); + + if (auto_tuning != AutoTuneState.Fault) + auto_tuning = AutoTuneState.Idle; + + chkTUN.Text = "TUN"; + chkTUN.Checked = false; // Stop the tuning activity + } + + return returnCode; + } + + private IOBoard ioBoard = null; + private async void UpdateIOBoard() + { + long currentFreq, lastFreq = 0; + byte readData = 0; + byte state = 0; + byte old_IOBoardAerialPorts = 0; + byte old_IOBoardAerialMode = 0; + byte old_IOBoardMode = (Byte) DSPMode.LAST; + byte timeout = 0; + int status = 0; + + ioBoard = IOBoard.getIOBoard(this); + + // Read the hardware revision on bus 2 at address 0x41, register 0 + + while (0 != ioBoard.readRequest(IOBoard.Registers.HardwareVersion)) + { + await Task.Delay(1); + if (timeout++ >= 20) return; + } + + timeout = 0; + + do + { + await Task.Delay(1); + if (timeout++ >= 20) return; + } while (1 == ioBoard.readResponse()); + + if (ioBoard.hardwareVersion == (byte) IOBoard.HardwareVersion.Version_1) // Expect to find version 1 of the IO board + { + if (!SetupForm.HL2IOBoardPresent) + { + if (this.InvokeRequired) + this.Invoke((Action)(() => SetupForm.HL2IOBoardPresent = true)); + else + auto_tuning = AutoTuneState.Disabled; + } + + lastFreq = 0; // Force update if restarted + + bool reset = true; + + auto_tuning = AutoTuneState.Idle; + + while (chkPower.Checked && SetupForm.HL2IOBoardPresent) + { + if (reset) + { + reset = false; + ioBoard.writeRequest(IOBoard.Registers.REG_CONTROL, 1); + await Task.Delay(1); + } + + if (chkVFOATX.Checked) // Get the frequency of the current VFO select for transmision + { + currentFreq = (long)(VFOAFreq * 1000000.0); + } + else + { + currentFreq = (long)(VFOBFreq * 1000000.0); + } + + switch (state++) + { + case 3: + case 6: // Secondary receive selection + if (IOBoardAerialMode != old_IOBoardAerialMode) + { + ioBoard.writeRequest(IOBoard.Registers.REG_RF_INPUTS, IOBoardAerialMode); + old_IOBoardAerialMode = IOBoardAerialMode; + } + break; + + case 1: + case 4: + case 7: + case 10: + // Read the input pins + while (0 != ioBoard.readRequest(IOBoard.Registers.REG_INPUT_PINS)) + { + await Task.Delay(1); + if (timeout++ >= 20) return; + } + + timeout = 0; + do + { + await Task.Delay(1); + status = ioBoard.readResponse(); // [3] Input pins, [2] Ant tuner, [1] Fault, [0] Major Version + if (timeout++ >= 20) break; + } while (1 == status); + + if (status == 0) + { + if (0 != ioBoard.readRegister(IOBoard.Registers.REG_FAULT)) + { + TXInhibit = true; + infoBar.Warning("I/O Board: Fault Code " + ioBoard.readRegister(IOBoard.Registers.REG_FAULT).ToString()); + AutoTuningHL2(ProtocolEvent.Idle); + } + else + { + AutoTuningHL2((ProtocolEvent) ioBoard.readRegister(IOBoard.Registers.REG_ANTENNA_TUNER)); + } + + SetupForm.UpdateIOLedStrip(MOX, ioBoard.readRegister(IOBoard.Registers.REG_INPUT_PINS)); + } + break; + + case 8: + case 2: // Write current transmission frequency + ioBoard.setFrequency(currentFreq); + break; + + case 9: + case 5: // Aerial selection + if (IOBoardAerialPorts != old_IOBoardAerialPorts) + { + ioBoard.writeRequest(IOBoard.Registers.REG_ANTENNA, IOBoardAerialPorts); + old_IOBoardAerialPorts = IOBoardAerialPorts; + } + break; + + case 0: // Mode selection + Byte CurrentMode; + + if (VFOATX) + { + CurrentMode = (Byte) _rx1_dsp_mode; + } + else + { + CurrentMode = (Byte) _rx2_dsp_mode; + } + + if (CurrentMode != old_IOBoardMode) + { + ioBoard.writeRequest(IOBoard.Registers.REG_OP_MODE, CurrentMode); + old_IOBoardMode = CurrentMode; + } + break; + + case 11: + default: + state = 0; + break; + } + + // Delay and continue to delay if we have been paused + do + { + await Task.Delay(40); + } + while (I2CPollingPause); + } + } + + if (this.InvokeRequired) + this.Invoke((Action)(() => SetupForm.HL2IOBoardPresent = false)); + else + auto_tuning = AutoTuneState.Disabled; + + return; + } + private async void UpdateVOX() { while (chkPower.Checked) @@ -26169,8 +26755,12 @@ private void timer_cpu_volts_meter_Tick(object sender, System.EventArgs e) if (!toolStripStatusLabel_Volts.Visible) toolStripStatusLabel_Volts.Visible = true; if (!toolStripStatusLabel_Amps.Visible) toolStripStatusLabel_Amps.Visible = true; - //MW0LGE [2.9.0.7] added to prevent edge case flicker due to rounding - if (Math.Abs(_MKIIPAVolts - _oldMKIIPAVolts) >= 0.1f) + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + { + toolStripStatusLabel_Volts.Text = String.Format("{0:#0.0}C", _MKIIHL2Temp); + toolStripStatusLabel_Amps.Text = String.Format("{0:#0.00}A", _MKIIPAAmps); + } + else if (Math.Abs(_MKIIPAVolts - _oldMKIIPAVolts) >= 0.1f) //MW0LGE [2.9.0.7] added to prevent edge case flicker due to rounding { toolStripStatusLabel_Volts.Text = String.Format("{0:#0.0}V", _MKIIPAVolts); _oldMKIIPAVolts = _MKIIPAVolts; @@ -27220,7 +27810,12 @@ private void chkPower_CheckedChanged(object sender, System.EventArgs e) if (m_bATTonTX) { int txatt = getTXstepAttenuatorForBand(_tx_band); - NetworkIO.SetTxAttenData(txatt); //[2.10.3.6]MW0LGE att_fixes + + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + NetworkIO.SetTxAttenData(31 - txatt); //MI0BOT: Greater range for HL2 + else + NetworkIO.SetTxAttenData(txatt); //[2.10.3.6]MW0LGE att_fixes + Display.TXAttenuatorOffset = txatt; } else @@ -27229,6 +27824,7 @@ private void chkPower_CheckedChanged(object sender, System.EventArgs e) Display.TXAttenuatorOffset = 0; } + enableAudioAmplfier(); // MW0LGE_22b if (!IsSetupFormNull) SetupForm.BoardWarning = ""; // no board warning @@ -27257,6 +27853,22 @@ private void chkPower_CheckedChanged(object sender, System.EventArgs e) }; multimeter2_thread_rx1.Start(); } + + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) // MI0BOT: I/O Board handler + { + // MI0BOT: I/O board thread + if (IOBoard_update_thread == null || !IOBoard_update_thread.IsAlive) + { + IOBoard_update_thread = new Thread(new ThreadStart(UpdateIOBoard)) + { + Name = "I/O Board Thread", + Priority = ThreadPriority.Normal, + IsBackground = true + }; + IOBoard_update_thread.Start(); + } + } + // if (rx2_enabled) @@ -27417,6 +28029,21 @@ private void chkPower_CheckedChanged(object sender, System.EventArgs e) if (andromeda_cat_enabled) NetworkIO.ATU_Tune(1); // set default state of J16 pin 10 to high for Andromeda else NetworkIO.ATU_Tune(0); + + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + { + if (SetupForm.Ext10MHzChecked) // MI0BOT: HL2 external 10 MHz input + SetupForm.EnableCl1_10MHz(); + + if (SetupForm.Cl2Checked) // MI0BOT: HL2 CL2 clock output + SetupForm.ControlCl2(SetupForm.Cl2Checked); + } + + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) // MI0BOT: Correct audio + { + Audio.VACRXScale = Math.Pow(10.0, VACRXGain / 20.0); + Audio.VAC2RXScale = Math.Pow(10.0, VAC2RXGain / 20.0); + } } else { @@ -27490,6 +28117,14 @@ private void chkPower_CheckedChanged(object sender, System.EventArgs e) if (!rx2_meter_thread.Join(/*500*/Math.Max(meter_delay, meter_dig_delay) + 50)) //MW0LGE change to meter delay rx2_meter_thread.Abort(); } + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + { + if (IOBoard_update_thread != null) // MI0BOT: Tidy up the IO board thread + { + if (!IOBoard_update_thread.Join(500)) + IOBoard_update_thread.Abort(); + } + } //MW0LGE_[2.9.0.7] if (multimeter2_thread_rx1 != null) { @@ -27603,6 +28238,7 @@ unsafe public void UpdateAAudioMixerStates() break; // 4 & 5 DDC Models case HPSDRModel.HERMES: + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 case HPSDRModel.ANAN10: case HPSDRModel.ANAN100: case HPSDRModel.ANAN100D: @@ -27621,6 +28257,7 @@ unsafe public void UpdateAAudioMixerStates() { // 2-DDC Models case HPSDRModel.HERMES: + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 case HPSDRModel.ANAN10E: case HPSDRModel.ANAN10: case HPSDRModel.ANAN100B: @@ -28541,6 +29178,10 @@ public bool ModelIsHPSDRorHermes() return true; } if (HardwareSpecific.Model == HPSDRModel.HERMES) + { + return true; + } + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) // MI0BOT: HL2 { return true; } @@ -28601,18 +29242,53 @@ public void UpdateDriveLabel(bool bShowLimitValue, System.EventArgs e) sValue = drv.ToString(); } - if (!bShowLimitValue) + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) // MI0BOT: HL2 has only 15 output power levels { - if (ptbPWR.IsConstrained) - lblPWR.Text = "Drive: (" + sValue + ")"; + if (4 > drv) + { + drv = 0; + } + else if (3 < drv && 6 > drv) + { + drv = 6; + } + else if (87 < drv) + { + drv = 90; + } + else if (84 < drv && 88 > drv) + { + drv = 84; + } + + lblPWR.Text = "Drive: " + ((Math.Round(drv / 6.0) / 2) - 7.5).ToString() + "dB"; + + if (!bShowLimitValue) + { + if (ptbPWR.IsConstrained) + lblPWR.Text = "Drive: (" + ((Math.Round(drv / 6.0) / 2) - 7.5).ToString() + "dB)"; + } else - lblPWR.Text = "Drive: " + sValue; + { + lblPWR.Text = "Limit: " + ((Math.Round(drv / 6.0) / 2) - 7.5).ToString() + "dB"; + } } else { - lblPWR.Text = "Limit: " + sValue; + if (!bShowLimitValue) + { + if (ptbPWR.IsConstrained) + lblPWR.Text = "Drive: (" + sValue + ")"; + else + lblPWR.Text = "Drive: " + sValue; + } + else + { + lblPWR.Text = "Limit: " + sValue; + } } - } + } + private string _pa_profile_name = ""; public string PAProfileName { @@ -28793,6 +29469,29 @@ private void ptbMic_Scroll(object sender, System.EventArgs e) //[2.10.3.9]MW0LGE fix for when mic is disabled setAudioMicGain((double)ptbMic.Value); + + // MI0BOT: For HL2 Audio control is based on VFO and Mode + if (!IsSetupFormNull && HardwareSpecific.Model == HPSDRModel.HERMESLITE) + { + if (!(chkRX2.Checked && chkVAC2.Checked && chkVFOBTX.Checked)) + { + if (_rx1_dsp_mode != DSPMode.DIGU && _rx1_dsp_mode != DSPMode.DIGU) + { + lblMicVal.Text = "A " + ptbMic.Value.ToString() + " dB"; + SetupForm.VACTXGain = ptbMic.Value; + vac_tx_gain = ptbMic.Value; + } + } + else + { + if (_rx2_dsp_mode != DSPMode.DIGU && _rx2_dsp_mode != DSPMode.DIGL) + { + lblMicVal.Text = "B " + ptbMic.Value.ToString() + " dB"; + SetupForm.VAC2TXGain = ptbMic.Value; + vac2_tx_gain = ptbMic.Value; + } + } + } } if (sender.GetType() == typeof(PrettyTrackBar)) @@ -28804,13 +29503,30 @@ private void ptbMic_Scroll(object sender, System.EventArgs e) } private void setAudioMicGain(double gain_db) { - if (chkMicMute.Checked) // although it is called chkMicMute, checked = mic in use + if (chkMicMute.Checked) // although it is called chkMicMute, checked = mic in use { + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) // MI0BOT: For HL2 Audio control is based on VFO and Mode + { + if (ptbMic.Tag != null) + { + Audio.VACPreamp = (double)ptbMic.Tag; + ptbMic.Tag = null; + } + ptbMic.Enabled = true; + } + Audio.MicPreamp = Math.Pow(10.0, gain_db / 20.0); // convert to scalar _mic_muted = false; } else { + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) // MI0BOT: For HL2 Audio control is based on VFO and Mode + { + ptbMic.Enabled = false; + ptbMic.Tag = Audio.VACPreamp; + Audio.VACPreamp = 0.0; + } + Audio.MicPreamp = 0.0; _mic_muted = true; } @@ -29229,8 +29945,17 @@ private void updateAttNudsCombos() //if txing on rx1 (split or non-split), then the att combo and nud will be disabled for rx1 comboPreamp.Enabled = false; udRX1StepAttData.Enabled = false; - comboRX2Preamp.Enabled = true; - udRX2StepAttData.Enabled = true; + + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + { + comboRX2Preamp.Enabled = false; + udRX2StepAttData.Enabled = false; + } + else + { + comboRX2Preamp.Enabled = true; + udRX2StepAttData.Enabled = true; + } //move it to rx1 udTXStepAttData.Location = udRX1StepAttData.Location; @@ -29238,6 +29963,11 @@ private void updateAttNudsCombos() udTXStepAttData.BringToFront(); udTXStepAttData.Visible = m_bATTonTX; lblPreamp.Text = m_bATTonTX ? "[S-ATT]" : (_rx1_step_att_enabled ? "S-ATT" : "ATT"); + + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + { + lblPreamp.Text = m_bATTonTX ? "[S-ATT]" : (AutoAttRX1 ? "A-ATT" : "S-ATT"); + } } else if (VFOBTX && rx2_enabled) { @@ -29247,12 +29977,24 @@ private void updateAttNudsCombos() comboRX2Preamp.Enabled = false; udRX2StepAttData.Enabled = false; - //move it to rx2 - udTXStepAttData.Location = udRX2StepAttData.Location; - udTXStepAttData.Parent = udRX2StepAttData.Parent; - udTXStepAttData.BringToFront(); - udTXStepAttData.Visible = m_bATTonTX; - lblRX2Preamp.Text = m_bATTonTX ? "[S-ATT]" : (_rx2_step_att_enabled ? "S-ATT" : "ATT"); + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + { + // For the HL2 there is only one attenuator, so keep it to the RX1 control + udTXStepAttData.Location = udRX1StepAttData.Location; + udTXStepAttData.Parent = udRX1StepAttData.Parent; + udTXStepAttData.BringToFront(); + udTXStepAttData.Visible = m_bATTonTX; + lblPreamp.Text = m_bATTonTX ? "[S-ATT]" : (AutoAttRX1 ? "A-ATT" : "S-ATT"); + } + else + { + //move it to rx2 + udTXStepAttData.Location = udRX2StepAttData.Location; + udTXStepAttData.Parent = udRX2StepAttData.Parent; + udTXStepAttData.BringToFront(); + udTXStepAttData.Visible = m_bATTonTX; + lblRX2Preamp.Text = m_bATTonTX ? "[S-ATT]" : (_rx2_step_att_enabled ? "S-ATT" : "ATT"); + } } else { @@ -29268,6 +30010,11 @@ private void updateAttNudsCombos() udTXStepAttData.Visible = false; lblPreamp.Text = _rx1_step_att_enabled ? "S-ATT" : "ATT"; lblRX2Preamp.Text = _rx2_step_att_enabled ? "S-ATT" : (_rx2_preamp_present ? "ATT" : ""); + + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + { + lblPreamp.Text = AutoAttRX1 ? "A-ATT" : "S-ATT"; + } } if (_iscollapsed && !_isexpanded) @@ -29567,6 +30314,9 @@ private void chkMOX_CheckedChanged2(object sender, System.EventArgs e) SetupForm.ATTOnRX1 = getRX1stepAttenuatorForBand(rx1_band); //[2.10.3.6]MW0LGE att_fixes SetupForm.ATTOnTX = txAtt; //[2.10.3.6]MW0LGE att_fixes NOTE: this will eventually call Display.TXAttenuatorOffset with the value + + + updateAttNudsCombos(); } } @@ -29634,7 +30384,12 @@ private void chkMOX_CheckedChanged2(object sender, System.EventArgs e) Audio.RX1BlankDisplayTX = blank_rx1_on_vfob_tx; + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + + AutoTuningHL2(ProtocolEvent.Idle); // MI0BOT: Stop the auto tune + if (m_bATTonTX) + { if (HardwareSpecific.Model == HPSDRModel.HPSDR) { @@ -30003,7 +30758,12 @@ private async void chkTUN_CheckedChanged(object sender, System.EventArgs e) chk2TONE.CheckedChanged += new System.EventHandler(chk2TONE_CheckedChanged); await Task.Delay(300); } - // + + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + { + if (AutoTuningHL2(ProtocolEvent.Start)) // MI0BOT: If true, control is handed to Auto Tune routine + return; + } _tuning = true; // used for a few things chkTUN.BackColor = button_selected_color; @@ -30041,12 +30801,14 @@ private async void chkTUN_CheckedChanged(object sender, System.EventArgs e) } // remember old power //MW0LGE_22b - if (_tuneDrivePowerSource == DrivePowerSource.FIXED) + if (_tuneDrivePowerSource == DrivePowerSource.FIXED || + (HardwareSpecific.Model == HPSDRModel.HERMESLITE && auto_tuning == AutoTuneState.Tuning)) // MI0BOT: PreviousPWR = ptbPWR.Value; // set power int new_pwr = SetPowerUsingTargetDBM(out bool bUseConstrain, out double targetdBm, true, true, false); // - if (_tuneDrivePowerSource == DrivePowerSource.FIXED) + if (_tuneDrivePowerSource == DrivePowerSource.FIXED || + (HardwareSpecific.Model == HPSDRModel.HERMESLITE && auto_tuning == AutoTuneState.Tuning)) // MI0BOT: { PWRSliderLimitEnabled = false; PWR = new_pwr; @@ -30096,13 +30858,27 @@ private async void chkTUN_CheckedChanged(object sender, System.EventArgs e) NetworkIO.SetUserOut0(1); // why this?? CHECK NetworkIO.SetUserOut2(1); - if (apollopresent && apollo_tuner_enabled) - NetworkIO.EnableApolloAutoTune(1); + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + { + if (AriesStandalone) + NetworkIO.EnableApolloAutoTune(1); // MI0BOT: Cause tune dip at start + } + else + { + if (apollopresent && apollo_tuner_enabled) + NetworkIO.EnableApolloAutoTune(1); + } } else { _tune_pulse_on = false; + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) // MI0BOT: Switch of the tone gen before releasing PTT + { + radio.GetDSPTX(0).TXPostGenRun = 0; + await Task.Delay(MoxDelay); + } + chkMOX.Checked = false; // we're done await Task.Delay(100); @@ -30123,11 +30899,13 @@ private async void chkTUN_CheckedChanged(object sender, System.EventArgs e) updateVFOFreqs(chkTUN.Checked, true); - if (apollopresent) + if (apollopresent || + (HardwareSpecific.Model == HPSDRModel.HERMESLITE)) // MI0BOT: NetworkIO.EnableApolloAutoTune(0); //MW0LGE_22b - if (_tuneDrivePowerSource == DrivePowerSource.FIXED) + if (_tuneDrivePowerSource == DrivePowerSource.FIXED || + (HardwareSpecific.Model == HPSDRModel.HERMESLITE && auto_tuning == AutoTuneState.Tuning)) // MI0BOT: { PWRSliderLimitEnabled = true; PWR = PreviousPWR; @@ -31931,29 +32709,43 @@ private void modifyXVTRantenna(int rx, double freq, int rx_xvtr_index) if (!IsSetupFormNull) { int required_ant = XVTRForm.GetRXAntenna(rx_xvtr_index); - if (required_ant >= 1 && required_ant <= 3) + + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE && + required_ant == 4) // MI0BOT: HL2, setting for Alt Rx, so assume we must have an I/O Board { + chkRxAnt.Enabled = false; // MI0BOT: It doesn't make sense to have a abilty to switch Alt Rx, so disable + SetIOBoardAerialPorts(1); // MI0BOT: Switch to Alt Rx + } + else + { + chkRxAnt.Enabled = true; + + if (required_ant >= 1 && required_ant <= 3) + { Band xvtr_rx_band = BandByFreq(XVTRForm.TranslateFreq(freq), -1, current_region); - int xvtr_rx_band_ant = SetupForm.GetRXAntenna(xvtr_rx_band); - if (required_ant != xvtr_rx_band_ant) + int xvtr_rx_band_ant = SetupForm.GetRXAntenna(xvtr_rx_band); + if (required_ant != xvtr_rx_band_ant) + { + //Debug.Print("Change xvtr rx antenna to : " + required_ant.ToString()); + undoXVTRantennaModify(rx); + xvtr_rx_band_ant = SetupForm.GetRXAntenna(xvtr_rx_band); // this needs to re-obtained as the undo above might adjust revert the antennas back + _ant_before_xvtr_modify[rx] = xvtr_rx_band_ant; + _band_used_for_xvtr_modify[rx] = xvtr_rx_band; + SetupForm.SetRXAntenna(required_ant, xvtr_rx_band); + } + } + else { - //Debug.Print("Change xvtr rx antenna to : " + required_ant.ToString()); + // return to default undoXVTRantennaModify(rx); - xvtr_rx_band_ant = SetupForm.GetRXAntenna(xvtr_rx_band); // this needs to re-obtained as the undo above might adjust revert the antennas back - _ant_before_xvtr_modify[rx] = xvtr_rx_band_ant; - _band_used_for_xvtr_modify[rx] = xvtr_rx_band; - SetupForm.SetRXAntenna(required_ant, xvtr_rx_band); } } - else - { - // return to default - undoXVTRantennaModify(rx); - } } } private void undoXVTRantennaModify(int rx) { + chkRxAnt.Enabled = true; // MI0BOT: Re-enable Alt Rx + if (rx < 0 || rx > 1) return; if (_band_used_for_xvtr_modify[rx] != Band.LAST) { @@ -32515,7 +33307,8 @@ private void txtVFOBFreq_LostFocus(object sender, System.EventArgs e) } } - if (_mox && (HardwareSpecific.Hardware == HPSDRHW.Hermes || + if (_mox && (HardwareSpecific.Hardware == HPSDRHW.Hermes || + HardwareSpecific.Hardware == HPSDRHW.HermesLite || HardwareSpecific.Hardware == HPSDRHW.HermesII)) { if (chkVFOSplit.Checked) @@ -32547,6 +33340,7 @@ private void txtVFOBFreq_LostFocus(object sender, System.EventArgs e) if (_mox) { if (HardwareSpecific.Hardware == HPSDRHW.Hermes || + HardwareSpecific.Hardware == HPSDRHW.HermesLite || HardwareSpecific.Hardware == HPSDRHW.HermesII) { if (chkVFOSplit.Checked) @@ -34120,6 +34914,18 @@ private void SetRX1Mode(DSPMode new_mode) } break; case DSPMode.DIGL: + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) // MI0BOT: For HL2 Audio control is based on VFO and Mode + { + ptbRX1AF.Enabled = true; + ptbRX1AF.SmallChange = 1; + ptbRX1AF.LargeChange = 1; + ptbRX0Gain.Enabled = true; + ptbRX0Gain.SmallChange = 1; + ptbRX0Gain.LargeChange = 1; + + chkMUT_CheckedChanged(this, EventArgs.Empty); + } + radModeDIGL.BackColor = SystemColors.Control; if (vac_auto_enable && new_mode != DSPMode.DIGU && @@ -34131,6 +34937,18 @@ private void SetRX1Mode(DSPMode new_mode) if (new_mode != DSPMode.DIGU) bRecallDigiModeSettings = true; // see comment below break; case DSPMode.DIGU: + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) // MI0BOT: For HL2 Audio control is based on VFO and Mode + { + ptbRX1AF.Enabled = true; + ptbRX1AF.SmallChange = 1; + ptbRX1AF.LargeChange = 1; + ptbRX0Gain.Enabled = true; + ptbRX0Gain.SmallChange = 1; + ptbRX0Gain.LargeChange = 1; + + chkMUT_CheckedChanged(this, EventArgs.Empty); + } + radModeDIGU.BackColor = SystemColors.Control; if (vac_auto_enable && new_mode != DSPMode.DIGL && @@ -34370,6 +35188,17 @@ private void SetRX1Mode(DSPMode new_mode) Display.RXDisplayHigh = (int)sample_rate_rx1 / 2; break; case DSPMode.DIGL: + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) // MI0BOT: For HL2 Audio control is based on VFO and Mode + { + ptbRX1AF.Enabled = false; + ptbRX1AF.SmallChange = 0; + ptbRX1AF.LargeChange = 0; + ptbRX0Gain.Enabled = false; + ptbRX0Gain.SmallChange = 0; + ptbRX0Gain.LargeChange = 0; + radio.GetDSPRX(0, 0).RXOutputGain = 0.1; + } + radModeDIGL.BackColor = button_selected_color; if (chkVFOATX.Checked || !rx2_enabled) @@ -34387,6 +35216,17 @@ private void SetRX1Mode(DSPMode new_mode) } break; case DSPMode.DIGU: + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) // MI0BOT: For HL2 Audio control is based on VFO and Mode + { + ptbRX1AF.Enabled = false; + ptbRX1AF.SmallChange = 0; + ptbRX1AF.LargeChange = 0; + ptbRX0Gain.Enabled = false; + ptbRX0Gain.SmallChange = 0; + ptbRX0Gain.LargeChange = 0; + radio.GetDSPRX(0, 0).RXOutputGain = 0.1; + } + radModeDIGU.BackColor = button_selected_color; if (chkVFOATX.Checked || !rx2_enabled) //[2.10.3.7]MW0LGE added || !rx2_enabled @@ -34618,6 +35458,12 @@ private void radModeButton_CheckedChanged(object sender, System.EventArgs e) lblModeBigLabel.Text = radiobut; } + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE && + cmaster.GetCMAstate() == 0) // MI0BOT: For HL2 Audio control is based on VFO and Mode - correct label + { + ptbMic_Scroll(sender, e); + } + lSBToolStripMenuItem.Checked = radModeLSB.Checked; uSBToolStripMenuItem.Checked = radModeUSB.Checked; dSBToolStripMenuItem.Checked = radModeDSB.Checked; @@ -35595,7 +36441,14 @@ private void UpdateVFOASub() { txtVFOABand.Font = new Font("Microsoft Sans Sarif", 14.0f, FontStyle.Regular); - VFOASubFreq = saved_vfoa_sub_freq; + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) // MI0BOT: Start with the two VFOs on the same frequency + { + VFOASubFreq = VFOAFreq; + } + else + { + VFOASubFreq = saved_vfoa_sub_freq; + } if (chkPower.Checked) txtVFOABand.ForeColor = vfo_text_light_color; else txtVFOABand.ForeColor = vfo_text_dark_color; @@ -37760,6 +38613,18 @@ private void SetRX2Mode(DSPMode new_mode) } break; case DSPMode.DIGL: + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) // MI0BOT: For HL2 Audio control is based on VFO and Mode + { + ptbRX2AF.Enabled = true; + ptbRX2AF.SmallChange = 1; + ptbRX2AF.LargeChange = 1; + ptbRX2Gain.Enabled = true; + ptbRX2Gain.SmallChange = 1; + ptbRX2Gain.LargeChange = 1; + chkRX2Mute_CheckedChanged(this, EventArgs.Empty); + radio.GetDSPRX(1, 0).RXOutputGain = 0.1; + } + radRX2ModeDIGL.BackColor = SystemColors.Control; if (rx2_enabled && vac2_auto_enable && new_mode != DSPMode.DIGU && @@ -37770,6 +38635,18 @@ private void SetRX2Mode(DSPMode new_mode) if (new_mode != DSPMode.DIGU) SetDigiMode(2, DigiMode.DigiModeSettingState.dmssRecall); break; case DSPMode.DIGU: + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) // MI0BOT: For HL2 Audio control is based on VFO and Mode + { + ptbRX2AF.Enabled = true; + ptbRX2AF.SmallChange = 1; + ptbRX2AF.LargeChange = 1; + ptbRX2Gain.Enabled = true; + ptbRX2Gain.SmallChange = 1; + ptbRX2Gain.LargeChange = 1; + chkRX2Mute_CheckedChanged(this, EventArgs.Empty); + radio.GetDSPRX(1, 0).RXOutputGain = 0.1; + } + radRX2ModeDIGU.BackColor = SystemColors.Control; if (rx2_enabled && vac2_auto_enable && new_mode != DSPMode.DIGL && @@ -37949,6 +38826,17 @@ private void SetRX2Mode(DSPMode new_mode) chkRX2BIN.Enabled = false; break; case DSPMode.DIGL: + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) // MI0BOT: For HL2 Audio control is based on VFO and Mode + { + ptbRX2AF.Enabled = false; + ptbRX2AF.SmallChange = 0; + ptbRX2AF.LargeChange = 0; + ptbRX2Gain.Enabled = false; + ptbRX2Gain.SmallChange = 0; + ptbRX2Gain.LargeChange = 0; + radio.GetDSPRX(1, 0).RXOutputGain = 0.1; + } + radRX2ModeDIGL.BackColor = button_selected_color; if (chkVFOBTX.Checked && rx2_enabled) @@ -37968,6 +38856,17 @@ private void SetRX2Mode(DSPMode new_mode) break; case DSPMode.DIGU: + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) // MI0BOT: For HL2 Audio control is based on VFO and Mode + { + ptbRX2AF.Enabled = false; + ptbRX2AF.SmallChange = 0; + ptbRX2AF.LargeChange = 0; + ptbRX2Gain.Enabled = false; + ptbRX2Gain.SmallChange = 0; + ptbRX2Gain.LargeChange = 0; + radio.GetDSPRX(1, 0).RXOutputGain = 0.1; + } + radRX2ModeDIGU.BackColor = button_selected_color; if (chkVFOBTX.Checked && rx2_enabled) @@ -38023,6 +38922,11 @@ private void SetRX2Mode(DSPMode new_mode) _rx2_dsp_mode = new_mode; + + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + SelectModeDependentPanel(); // MI0BOT: For HL2 Audio control is based on VFO and Mode + + if (_rx2_dsp_mode != DSPMode.FM && _rx2_dsp_mode != DSPMode.DRM) { RX2Filter = rx2_filters[(int)new_mode].LastFilter; @@ -38119,6 +39023,12 @@ private void radRX2ModeButton_CheckedChanged(object sender, System.EventArgs e) //setRX2ModeLabels(radiobut); //MW0LGE_21j setSmallRX2ModeFilterLabels(); + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE && + cmaster.GetCMAstate() == 0) // MI0BOT: For HL2 Audio control is based on VFO and Mode - correct label + { + ptbMic_Scroll(sender, e); + } + lSBToolStripMenuItem1.Checked = radRX2ModeLSB.Checked; uSBToolStripMenuItem1.Checked = radRX2ModeUSB.Checked; dSBToolStripMenuItem1.Checked = radRX2ModeDSB.Checked; @@ -39443,7 +40353,9 @@ private void Console_Resize(object sender, System.EventArgs e) this.SetupForm.CollapsedWidth = console_basis_size.Width; if (this.SetupForm.CollapsedHeight == 0) this.SetupForm.CollapsedHeight = - (HardwareSpecific.Model == HPSDRModel.HPSDR || HardwareSpecific.Model == HPSDRModel.HERMES) ? + (HardwareSpecific.Model == HPSDRModel.HPSDR || + HardwareSpecific.Model == HPSDRModel.HERMES || + HardwareSpecific.Model == HPSDRModel.HERMESLITE) ? console_basis_size.Height - (panelRX2Filter.Height + 8) : console_basis_size.Height; } @@ -39662,6 +40574,15 @@ private void chkVFOATX_CheckedChanged(object sender, System.EventArgs e) chkVACStereo.Checked = vac_stereo; } + + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE && + cmaster.GetCMAstate() == 0) // MI0BOT: For HL2 Audio control is based on VFO and Mode + { + bool scroll = ptbMic.Value == vac_tx_gain; // if the same, no scroll event will occur when ptbMic value set, so force one if needed + ptbMic.Value = vac_tx_gain; + + if (scroll) ptbMic_Scroll(sender, e); + } } else { @@ -39674,6 +40595,9 @@ private void chkVFOATX_CheckedChanged(object sender, System.EventArgs e) if (chkVFOATX.Checked) VFOTXChangedHandlers?.Invoke(false, m_bLastVFOATXsetting, true); // MW0LGE_21k9c m_bLastVFOATXsetting = chkVFOATX.Checked; // MW0LGE_21k9d rc3 + + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + Alex.getAlex().UpdateAlexAntSelection(Band.LAST, MOX, alex_ant_ctrl_enabled, false); // MI0BOT: Need to let Alex know in case there is a different band ant } private bool psstate = false; @@ -39704,6 +40628,10 @@ private void chkVFOBTX_CheckedChanged(object sender, System.EventArgs e) { if (chkVFOBTX.Focused && !chkVFOBTX.Checked) chkVFOBTX.Checked = true; Display.TXOnVFOB = chkVFOBTX.Checked; + + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + Penny.getPenny().VFOBTX = chkVFOBTX.Checked; // MI0BOT: Needs to be set early + if (chkVFOBTX.Checked) { if (chkVFOATX.Checked) chkVFOATX.Checked = false; @@ -39745,6 +40673,15 @@ private void chkVFOBTX_CheckedChanged(object sender, System.EventArgs e) chkVACStereo.Checked = vac2_stereo; } + + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE && + cmaster.GetCMAstate() == 0) // MI0BOT: For HL2 Audio control is based on VFO and Mode + { + bool scroll = ptbMic.Value == vac2_tx_gain; // if the same, no scroll event will occur when ptbMic value set, so force one if needed + ptbMic.Value = vac2_tx_gain; + + if (scroll) ptbMic_Scroll(sender, e); + } } } else // button is unchecked @@ -39784,6 +40721,9 @@ private void chkVFOBTX_CheckedChanged(object sender, System.EventArgs e) if (chkVFOBTX.Checked) VFOTXChangedHandlers?.Invoke(true, m_bLastVFOBTXsetting, true); // MW0LGE_21k9c m_bLastVFOBTXsetting = chkVFOBTX.Checked; // MW0LGE_21k9d rc3 + + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + Alex.getAlex().UpdateAlexAntSelection(Band.LAST, MOX, alex_ant_ctrl_enabled, false); // MI0BOT: Need to let Alex know in case there is a different band ant } private void toolStripMenuItemRX1FilterConfigure_Click(object sender, EventArgs e) @@ -40767,6 +41707,7 @@ public void SetComboPreampForHPSDR() break; case HPSDRModel.HERMES: + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 if (alexpresent) { comboPreamp.Items.AddRange(on_off_preamp_settings); @@ -40774,7 +41715,6 @@ public void SetComboPreampForHPSDR() } else comboPreamp.Items.AddRange(anan100d_preamp_settings); - break; case HPSDRModel.ANAN10: case HPSDRModel.ANAN10E: @@ -42832,6 +43772,8 @@ private void radBand_CheckedChanged(object sender, EventArgs e) bandtoolStripMenuItem13.Checked = radBandGEN.Checked; repopulateForms(); + + _band_change = true; } private void eSCToolStripMenuItem_Click(object sender, EventArgs e) @@ -43007,8 +43949,22 @@ private void lblPreamp_MouseDoubleClick(object sender, MouseEventArgs e) { if (HardwareSpecific.Model != HPSDRModel.HPSDR && !_mox) { - SetupForm.RX1EnableAtt = !SetupForm.RX1EnableAtt; - if (RX1RX2usingSameADC) SetupForm.RX2EnableAtt = SetupForm.RX1EnableAtt; //MW0LGE_22b + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + { + if (AutoAttRX1) + { + AutoAttRX1 = false; + } + else + { + AutoAttRX1 = true; + } + } + else + { + SetupForm.RX1EnableAtt = !SetupForm.RX1EnableAtt; + if (RX1RX2usingSameADC) SetupForm.RX2EnableAtt = SetupForm.RX1EnableAtt; //MW0LGE_22b + } } } @@ -46512,6 +47468,20 @@ public void UpdateTuneLabel(bool bShowLimitValue, System.EventArgs e) sValue = drv.ToString(); } + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + { + if (3 > drv) + { + drv = 0; + } + else if (96 < drv) + { + drv = 99; + } + + sValue = ((Math.Round(drv / 3.0) / 2) - 16.5).ToString() + "dB"; + } + if (!bShowLimitValue) { if (ptbTune.IsConstrained) @@ -46675,17 +47645,57 @@ public int SetPowerUsingTargetDBM(out bool bConstrain, out double targetdBm, boo power_by_band[(int)_tx_band] = new_pwr; break; case 1: //tune - switch (_tuneDrivePowerSource) + DrivePowerSource tuneDrive = _tuneDrivePowerSource; + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE && auto_tuning == AutoTuneState.Tuning) // MI0BOT: Auto tune + tuneDrive = DrivePowerSource.FIXED; + + switch (tuneDrive) { case DrivePowerSource.DRIVE_SLIDER: new_pwr = ptbPWR.Value; break; case DrivePowerSource.TUNE_SLIDER: slider = ptbTune; - new_pwr = ptbTune.Value; + + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) // MI0BOT: As HL2 only has 15 step output attenuator, + { // reduce the level further + if (bConstrain) new_pwr = slider.ConstrainAValue(ptbTune.Value); + + if (new_pwr <= 51) + { + radio.GetDSPTX(0).TXPostGenToneMag = (double)(new_pwr + 40) / 100; + new_pwr = 0; + } + else + { + radio.GetDSPTX(0).TXPostGenToneMag = 0.9999; + new_pwr = (new_pwr - 54) * 2; + } + } + else + { + new_pwr = ptbTune.Value; + } + break; case DrivePowerSource.FIXED: - new_pwr = tune_power; + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + { + if (tune_power <= 51) + { + radio.GetDSPTX(0).TXPostGenToneMag = (double)(tune_power + 40) / 100; + new_pwr = 0; + } + else + { + radio.GetDSPTX(0).TXPostGenToneMag = 0.9999; + new_pwr = (tune_power - 54) * 2; + } + } + else + { + new_pwr = tune_power; + } bConstrain = false; break; } @@ -46718,6 +47728,7 @@ public int SetPowerUsingTargetDBM(out bool bConstrain, out double targetdBm, boo //constrain power if(bConstrain) new_pwr = slider.ConstrainAValue(new_pwr); // + double hl2Power = (double)new_pwr; // MI0BOT: Just use the slider value for HL2 double target_dbm = 10 * (double)Math.Log10((double)new_pwr * 1000); double gbb; @@ -46746,7 +47757,7 @@ public int SetPowerUsingTargetDBM(out bool bConstrain, out double targetdBm, boo _lastPower = new_pwr; } - if (new_pwr == 0) + if (new_pwr == 0 && HardwareSpecific.Model != HPSDRModel.HERMESLITE) // MI0BOT: HL2 always does the else { Audio.RadioVolume = 0.0; if (chkTUN.Checked) @@ -46756,9 +47767,17 @@ public int SetPowerUsingTargetDBM(out bool bConstrain, out double targetdBm, boo { if (chkTUN.Checked) radio.GetDSPTX(0).TXPostGenRun = 1; - Audio.RadioVolume = (double)Math.Min((target_volts / 0.8), 1.0); - } + if (HardwareSpecific.Model != HPSDRModel.HERMESLITE) + { + Audio.RadioVolume = (double)Math.Min((target_volts / 0.8), 1.0); + } + else + { + Audio.RadioVolume = (double)Math.Min((hl2Power * (gbb / 100)) / 93.75, 1.0); // MI0BOT: We want to jump in steps of 16 but getting 6. + } // Drive value is 0-255 but only top 4 bits used. + } // Need to correct for multiplication of 1.02 in Radio volume + // Formula - 1/((16/6)/(255/1.02)) return new_pwr; } @@ -46805,6 +47824,28 @@ public void ResetLevelCalibration(bool ignoreSet = false) UpdateRX1DisplayOffsets(); UpdateRX2DisplayOffsets(); } + + private void chkEnableMultiRX_MouseDown(object sender, MouseEventArgs e) + { + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + { + if (chkEnableMultiRX.Checked && IsRightButton(e)) + { + if (rx2_enabled) + { + double VFOA = VFOAFreq; + VFOAFreq = VFOASubFreq; + VFOASubFreq = VFOA; + } + else + { + double VFOA = VFOAFreq; + VFOAFreq = VFOBFreq; + VFOBFreq = VFOA; + } + } + } + } private async void MultiMeter2UpdateRX1() { HiPerfTimer meterDelay = new HiPerfTimer(); @@ -48524,7 +49565,11 @@ private void miAbout_Click(object sender, EventArgs e) } else { - sFW = NetworkIO.FWCodeVersion.ToString("0\\.0"); + if (HPSDRModel.HERMESLITE == HardwareSpecific.Model) + sFW = NetworkIO.FWCodeVersion.ToString("0\\.0") + NetworkIO.BetaVersion.ToString("\\.0"); + else + sFW = NetworkIO.FWCodeVersion.ToString("0\\.0"); + sProto = "1"; sSupportedProtocol = ""; } diff --git a/Project Files/Source/Console/cwx.cs b/Project Files/Source/Console/cwx.cs index 39aeb302..ff39757f 100644 --- a/Project Files/Source/Console/cwx.cs +++ b/Project Files/Source/Console/cwx.cs @@ -285,6 +285,9 @@ private void setptt(bool state) // // CWKeyer.PTTEnqueue(item); //} + if(HardwareSpecific.Model == HPSDRModel.HERMESLITE) + NetworkIO.SetCWXPTT(Convert.ToInt32(state)); + ptt = state; if (state) pttLed.BackColor = System.Drawing.Color.Red; else pttLed.BackColor = System.Drawing.Color.Black; diff --git a/Project Files/Source/Console/database.cs b/Project Files/Source/Console/database.cs index 32d7c0f6..c953d690 100644 --- a/Project Files/Source/Console/database.cs +++ b/Project Files/Source/Console/database.cs @@ -10899,6 +10899,7 @@ public static bool ImportAndMergeDatabase(string filename, out string log, bool string sRad = ""; if (getRadioSelectedFromOldRadButton(ref tempTable, "radGenModelHPSDR")) sRad = "HPSDR"; else if (getRadioSelectedFromOldRadButton(ref tempTable, "radGenModelHermes")) sRad = "HERMES"; + else if (getRadioSelectedFromOldRadButton(ref tempTable, "radGenModelHermeslite")) sRad = "HERMES LITE"; else if (getRadioSelectedFromOldRadButton(ref tempTable, "radGenModelANAN10")) sRad = "ANAN-10"; else if (getRadioSelectedFromOldRadButton(ref tempTable, "radGenModelANAN10E")) sRad = "ANAN-10E"; else if (getRadioSelectedFromOldRadButton(ref tempTable, "radGenModelANAN100")) sRad = "ANAN-100"; diff --git a/Project Files/Source/Console/enums.cs b/Project Files/Source/Console/enums.cs index fa9d4200..30d1a267 100644 --- a/Project Files/Source/Console/enums.cs +++ b/Project Files/Source/Console/enums.cs @@ -38,408 +38,408 @@ The author can be reached by email at // its original terms and is not affected by this dual-licensing statement in any way. // // Richard Samphire can be reached by email at : mw0lge@grange-lane.co.uk // //============================================================================================// - -namespace Thetis + +namespace Thetis { using System; //for [Flags] attribute - #region Enums - - public enum FocusMasterMode - { - None = 0, - Logger, - Click, - Title, - } - - public enum FWCAnt - { - NC = 0, - ANT1, - ANT2, - ANT3, - RX1IN, - RX2IN, - RX1TAP, - SIG_GEN, - } - - public enum ColorScheme - { - original = 0, - enhanced, - SPECTRAN, - BLACKWHITE, - LinLog, - LinRad, - LinAuto, - off, - Custom, - } - - public enum MultiMeterDisplayMode - { - Original = 0, - Edge, - Analog, - } - public enum MultiMeterMeasureMode - { - FIRST = -1, - SMeter, - DBM, - UV, - LAST - } - - public enum FilterWidthMode - { - Linear = 0, - Log, - Log10, - } - - public enum DisplayEngine - { - GDI_PLUS = 0, - DIRECT_X, - } - - public enum HPSDRModel - { - //IMPORTANT: Please keep the int value order on these enums, ie add new items before LAST, - //otherwise 'bad' things might happen - FIRST = -1, - HPSDR, - HERMES, - ANAN10, - ANAN10E, - ANAN100, - ANAN100B, - ANAN100D, - ANAN200D, - ORIONMKII, - ANAN7000D, - ANAN8000D, - ANAN_G2, //G8NJJ - ANAN_G2_1K, //G8NJJ - ANVELINAPRO3, - HERMESLITE, //MI0BOT - REDPITAYA, //DH1KLM - LAST - } - - public enum DisplayMode - { - FIRST = -1, - SPECTRUM, - PANADAPTER, - SCOPE, - SCOPE2, - PHASE, - PHASE2, - WATERFALL, - HISTOGRAM, - PANAFALL, - PANASCOPE, - SPECTRASCOPE, - OFF, - LAST, - } - - public enum AGCMode - { - FIRST = -1, - FIXD, - LONG, - SLOW, - MED, - FAST, - CUSTOM, - LAST, - } - - public enum MeterRXMode - { - FIRST = -1, - SIGNAL_STRENGTH, - SIGNAL_AVERAGE, - ADC_L, - ADC_R, - ADC2_L, - ADC2_R, - OFF, - LAST, - } - - public enum MeterTXMode - { - FIRST = -1, - FORWARD_POWER, - REVERSE_POWER, - SWR_POWER, - MIC, - EQ, - LEVELER, - LVL_G, - CFC_PK, - CFC_G, - COMP, - ALC, - ALC_G, - ALC_GROUP, - SWR, - OFF, - LAST, - } - - public enum KeyerLine - { - None = 0, - DTR, - RTS, - } - - public enum FRSRegion - { - FIRST = -1, - US = 0, - Spain = 1, - Europe = 2, - UK = 3, - Italy_Plus = 4, - Japan = 5, - Australia = 6, - Norway = 7, - Denmark = 8, - Latvia = 9, - Slovakia = 10, - Bulgaria = 11, - Greece = 12, - Hungary = 13, - Netherlands = 14, - France = 15, - Russia = 16, - Israel = 17, - Extended = 18, - India = 19, - Sweden = 20, - Region1 = 21, - Region2 = 22, - Region3 = 23, - Germany = 24, - LAST, - } - - public enum PreampMode - { - FIRST = -1, - HPSDR_OFF, - HPSDR_ON, - HPSDR_MINUS10, - HPSDR_MINUS20, - HPSDR_MINUS30, - HPSDR_MINUS40, - HPSDR_MINUS50, + #region Enums + + public enum FocusMasterMode + { + None = 0, + Logger, + Click, + Title, + } + + public enum FWCAnt + { + NC = 0, + ANT1, + ANT2, + ANT3, + RX1IN, + RX2IN, + RX1TAP, + SIG_GEN, + } + + public enum ColorScheme + { + original = 0, + enhanced, + SPECTRAN, + BLACKWHITE, + LinLog, + LinRad, + LinAuto, + off, + Custom, + } + + public enum MultiMeterDisplayMode + { + Original = 0, + Edge, + Analog, + } + public enum MultiMeterMeasureMode + { + FIRST = -1, + SMeter, + DBM, + UV, + LAST + } + + public enum FilterWidthMode + { + Linear = 0, + Log, + Log10, + } + + public enum DisplayEngine + { + GDI_PLUS = 0, + DIRECT_X, + } + + public enum HPSDRModel + { + //IMPORTANT: Please keep the int value order on these enums, ie add new items before LAST, + //otherwise 'bad' things might happen + FIRST = -1, + HPSDR, + HERMES, + ANAN10, + ANAN10E, + ANAN100, + ANAN100B, + ANAN100D, + ANAN200D, + ORIONMKII, + ANAN7000D, + ANAN8000D, + ANAN_G2, //G8NJJ + ANAN_G2_1K, //G8NJJ + ANVELINAPRO3, + HERMESLITE, //MI0BOT + REDPITAYA, //DH1KLM + LAST + } + + public enum DisplayMode + { + FIRST = -1, + SPECTRUM, + PANADAPTER, + SCOPE, + SCOPE2, + PHASE, + PHASE2, + WATERFALL, + HISTOGRAM, + PANAFALL, + PANASCOPE, + SPECTRASCOPE, + OFF, + LAST, + } + + public enum AGCMode + { + FIRST = -1, + FIXD, + LONG, + SLOW, + MED, + FAST, + CUSTOM, + LAST, + } + + public enum MeterRXMode + { + FIRST = -1, + SIGNAL_STRENGTH, + SIGNAL_AVERAGE, + ADC_L, + ADC_R, + ADC2_L, + ADC2_R, + OFF, + LAST, + } + + public enum MeterTXMode + { + FIRST = -1, + FORWARD_POWER, + REVERSE_POWER, + SWR_POWER, + MIC, + EQ, + LEVELER, + LVL_G, + CFC_PK, + CFC_G, + COMP, + ALC, + ALC_G, + ALC_GROUP, + SWR, + OFF, + LAST, + } + + public enum KeyerLine + { + None = 0, + DTR, + RTS, + } + + public enum FRSRegion + { + FIRST = -1, + US = 0, + Spain = 1, + Europe = 2, + UK = 3, + Italy_Plus = 4, + Japan = 5, + Australia = 6, + Norway = 7, + Denmark = 8, + Latvia = 9, + Slovakia = 10, + Bulgaria = 11, + Greece = 12, + Hungary = 13, + Netherlands = 14, + France = 15, + Russia = 16, + Israel = 17, + Extended = 18, + India = 19, + Sweden = 20, + Region1 = 21, + Region2 = 22, + Region3 = 23, + Germany = 24, + LAST, + } + + public enum PreampMode + { + FIRST = -1, + HPSDR_OFF, + HPSDR_ON, + HPSDR_MINUS10, + HPSDR_MINUS20, + HPSDR_MINUS30, + HPSDR_MINUS40, + HPSDR_MINUS50, SA_MINUS10, - SA_MINUS20, //MW0LGE_21d - SA_MINUS30, - // STEP_ATTEN, - LAST, - } - - public enum DSPMode - { - FIRST = -1, - LSB, - USB, - DSB, - CWL, - CWU, - FM, - AM, - DIGU, - SPEC, - DIGL, - SAM, - DRM, - AM_LSB, - AM_USB, - LAST, - } - - public enum Band - { - FIRST = -1, - GEN, - - //B2200M, //MW0LGE_21k8 need fix this - //B600M, - - B160M, - B80M, - B60M, - B40M, - B30M, - B20M, - B17M, - B15M, - B12M, - B10M, - B6M, - B2M, - WWV, - - VHF0, - VHF1, - VHF2, - VHF3, - VHF4, - VHF5, - VHF6, - VHF7, - VHF8, - VHF9, - VHF10, - VHF11, - VHF12, - VHF13, - - BLMF, // ke9ns move down below vhf - B120M, - B90M, - B61M, - B49M, - B41M, - B31M, - B25M, - B22M, - B19M, - B16M, - B14M, - B13M, - B11M, - - LAST, - } - - public enum Filter - { - FIRST = -1, - F1, - F2, - F3, - F4, - F5, - F6, - F7, - F8, - F9, - F10, - VAR1, - VAR2, - NONE, - LAST, - } - - public enum PTTMode - { - FIRST = -1, - NONE, - MANUAL, - MIC, - CW, - X2, - CAT, - VOX, - SPACE, - TCI, - LAST, - } - - public enum DisplayLabelAlignment - { - FIRST = -1, - LEFT, - CENTER, - RIGHT, - AUTO, - OFF, - LAST, - } - - public enum ClickTuneMode - { - Off = 0, - VFOA, - VFOB, - //VFOAC, - } - - public enum FMTXMode - { - // Order is chosen carefully here for memory form -- take care before rearranging - High = 0, // + - Simplex, // S - Low, // - - } - - public enum HPSDRHW - { - Atlas = 0, // Metis in PowerSDR, but Atlas in Thetis - Hermes = 1, // ANAN-10 ANAN100 - HermesII = 2, // ANAN-10E ANAN-100B HeremesII - Angelia = 3, // ANAN-100D - Orion = 4, // ANAN-200D - OrionMKII = 5, // AMAM-7000DLE 7000DLEMkII ANAN-8000DLE OrionMkII Anvelina-Pro3 RedPitaya - HermesLite = 6, // MI0BOT - Saturn = 10, // ANAN-G2: added G8NJJ - SaturnMKII = 11, // ANAN-G2: MKII board? - Unknown = 999, // MW0LGE - } - - public enum DSPFilterType - { - Linear_Phase = 0, - Low_Latency = 1, - } - - public enum DisplayRegion - { - freqScalePanadapterRegion, - panadapterRegion, - dBmScalePanadapterRegion, - waterfallRegion, - filterRegion, - filterRegionLow, - filterRegionHigh, - agcButtonRegion, - agcThresholdLine, - agcHangLine, - agcFixedGainLine, - //lockedPanButtonRegion, - //vfoToMidButtonRegion, - //midToVfoButtonRegion, - //clickVfoButtonRegion, - elsewhere - } - + SA_MINUS20, //MW0LGE_21d + SA_MINUS30, + // STEP_ATTEN, + LAST, + } + + public enum DSPMode + { + FIRST = -1, + LSB, + USB, + DSB, + CWL, + CWU, + FM, + AM, + DIGU, + SPEC, + DIGL, + SAM, + DRM, + AM_LSB, + AM_USB, + LAST, + } + + public enum Band + { + FIRST = -1, + GEN, + + //B2200M, //MW0LGE_21k8 need fix this + //B600M, + + B160M, + B80M, + B60M, + B40M, + B30M, + B20M, + B17M, + B15M, + B12M, + B10M, + B6M, + B2M, + WWV, + + VHF0, + VHF1, + VHF2, + VHF3, + VHF4, + VHF5, + VHF6, + VHF7, + VHF8, + VHF9, + VHF10, + VHF11, + VHF12, + VHF13, + + BLMF, // ke9ns move down below vhf + B120M, + B90M, + B61M, + B49M, + B41M, + B31M, + B25M, + B22M, + B19M, + B16M, + B14M, + B13M, + B11M, + + LAST, + } + + public enum Filter + { + FIRST = -1, + F1, + F2, + F3, + F4, + F5, + F6, + F7, + F8, + F9, + F10, + VAR1, + VAR2, + NONE, + LAST, + } + + public enum PTTMode + { + FIRST = -1, + NONE, + MANUAL, + MIC, + CW, + X2, + CAT, + VOX, + SPACE, + TCI, + LAST, + } + + public enum DisplayLabelAlignment + { + FIRST = -1, + LEFT, + CENTER, + RIGHT, + AUTO, + OFF, + LAST, + } + + public enum ClickTuneMode + { + Off = 0, + VFOA, + VFOB, + //VFOAC, + } + + public enum FMTXMode + { + // Order is chosen carefully here for memory form -- take care before rearranging + High = 0, // + + Simplex, // S + Low, // - + } + + public enum HPSDRHW + { + Atlas = 0, // Metis in PowerSDR, but Atlas in Thetis + Hermes = 1, // ANAN-10 ANAN100 + HermesII = 2, // ANAN-10E ANAN-100B HeremesII + Angelia = 3, // ANAN-100D + Orion = 4, // ANAN-200D + OrionMKII = 5, // AMAM-7000DLE 7000DLEMkII ANAN-8000DLE OrionMkII Anvelina-Pro3 RedPitaya + HermesLite = 6, // MI0BOT + Saturn = 10, // ANAN-G2: added G8NJJ + SaturnMKII = 11, // ANAN-G2: MKII board? + Unknown = 999, // MW0LGE + } + + public enum DSPFilterType + { + Linear_Phase = 0, + Low_Latency = 1, + } + + public enum DisplayRegion + { + freqScalePanadapterRegion, + panadapterRegion, + dBmScalePanadapterRegion, + waterfallRegion, + filterRegion, + filterRegionLow, + filterRegionHigh, + agcButtonRegion, + agcThresholdLine, + agcHangLine, + agcFixedGainLine, + //lockedPanButtonRegion, + //vfoToMidButtonRegion, + //midToVfoButtonRegion, + //clickVfoButtonRegion, + elsewhere + } + public enum BreakIn { Manual, Semi, QSK - } - + } + public enum RadioProtocol { USB = 0, // Protocol USB (P1) ETH, // Protocol ETH (P2) Auto, None - } - + } + public enum TXPinActions { FIRST = -1, @@ -451,17 +451,17 @@ public enum TXPinActions TUNE_TWOTONE, MOX_TUNE_TWOTONE, LAST - } - + } + public enum DrivePowerSource { DRIVE_SLIDER = 0, TUNE_SLIDER = 1, FIXED = 2 - } - + } + public enum SquelchState - { + { OFF = 0, SQL = 1, VSQL = 2, @@ -476,8 +476,8 @@ public enum StatusBarIconGroup TCPIPCat, SerialCat, TCI - } - + } + public enum VFOSYNCinit { Nothing = 0, @@ -496,6 +496,6 @@ public enum PAstatusIndicatorState HeatsinkTemperature = 1 << 4, ForwardPower = 1 << 5, Resettable = 1 << 6 - } + } #endregion } \ No newline at end of file diff --git a/Project Files/Source/Console/setup.cs b/Project Files/Source/Console/setup.cs index c980c5ae..6681b2ec 100644 --- a/Project Files/Source/Console/setup.cs +++ b/Project Files/Source/Console/setup.cs @@ -79,7 +79,7 @@ public partial class Setup : Form private readonly List CMASIO_ALWAYS_SHOW = new List() { "dl5tt", "dh1klm", "ea8djr", "ei7bmb", "kc1lko", "k1lsb", "k1sr", "k2gx", "k2tc", "kb2uka", "ki4tga", "ko6dlv", "kw4ex", "m0cke", "mw0lge", "n6mud", "nc3z", "nj2us", "nr0v", "ny8t", "oe3ide", "oz1ct", "sa3atf", "ve2jn", "ve9iou", "vk6ia", - "w1aex", "w1izz", "wr1s", "w2pa", "w3ub", "w9ac", "w9ez" }; + "w1aex", "w1izz", "wr1s", "w2pa", "w3ub", "w9ac", "w9ez", "mi0bot" }; #region Variable Declaration private Console console; @@ -840,12 +840,16 @@ public void InitAudioTab(List recoveryList = null, bool only_rates = fal // refactored 2.10.3.7 int selected_rate1_index = comboAudioSampleRate1.SelectedIndex; int selected_rate2_index = comboAudioSampleRateRX2.SelectedIndex; - + comboAudioSampleRate1.Items.Clear(); comboAudioSampleRateRX2.Items.Clear(); bool include_extra_p1_rate = HardwareSpecific.Model == HPSDRModel.REDPITAYA; //DH1KLM + // The HL supports 384K + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + include_extra_p1_rate = true; + int[] p1_rates = include_extra_p1_rate ? new int[] { 48000, 96000, 192000, 384000 } : new int[] { 48000, 96000, 192000 }; int[] p2_rates = { 48000, 96000, 192000, 384000, 768000, 1536000 }; @@ -1073,6 +1077,25 @@ public void PerformDelayedInitalistion() { EventArgs e = EventArgs.Empty; + // MI0BOT: Make sure the correct stuff is enabled + if (HPSDRHW.HermesLite == Audio.LastRadioHardware || + HPSDRModel.HERMESLITE == HardwareSpecific.Model) // MI0BOT: Changes for HL2 only having a 16 step output attenuator + { + udATTOnTX.Minimum = -28; + udMicGainMax.Maximum = 40; + chkHermesStepAttenuator.Checked = true; + udHermesStepAttenuatorData.Minimum = -28; + udHermesStepAttenuatorDataRX2.Minimum = -28; + udTXTunePower.Minimum = (Decimal)(-16.5); + //chkEnableStaticIP_CheckedChanged(this, EventArgs.Empty); + chkHL2PsSync_CheckedChanged(this, EventArgs.Empty); + lblADCLinked.Visible = false; + } + else + { + udTXTunePower.Minimum = 0; // MI0BOT: For non HL2, minimum 0 + } + chkDisable6mLNAonTX_CheckedChanged(this, e); chkDisable6mLNAonRX_CheckedChanged(this, e); chkDisableHPFonTX_CheckedChanged(this, e); @@ -2818,10 +2841,18 @@ private void ForceAllEvents() chkAntiVoxSource_CheckedChanged(this, e); // F/W Set - chkMercDither_CheckedChanged(this, e); - chkMercRandom_CheckedChanged(this, e); - showLedMirror(); - + if (HPSDRModel.HERMESLITE == HardwareSpecific.Model) + { + chkHL2BandVolts_CheckedChanged(this, e); // MI0BOT: HL2 option page now doesn't share ditter and random + chkHL2PsSync_CheckedChanged(this, e); + } + else + { + chkMercDither_CheckedChanged(this, e); + chkMercRandom_CheckedChanged(this, e); + showLedMirror(); + } + //OC tab chkAllowHotSwitching_CheckedChanged(this, e); chkUsbBCD_CheckedChanged(this, e); //[2.10.3.5]MW0LGE @@ -3966,7 +3997,16 @@ public int ATTOnTX if (udATTOnTX != null) { if (value > 31) value = 31; - if (value < 0) value = 0; //MW0LGE [2.9.0.7] added after mi0bot source review + + if (HPSDRModel.HERMESLITE == HardwareSpecific.Model) + { + if (value < -28) value = -28; //MI0BOT: HL2 has a greater range and can go negative + } + else + { + if (value < 0) value = 0; //MW0LGE [2.9.0.7] added after mi0bot source review + } + lblTXattBand.Text = console.TXBand.ToString(); if (udATTOnTX.Value == value) //[2.10.3.6]MW0LGE no event will fire if the same, so force it udATTOnTX_ValueChanged(this, EventArgs.Empty); @@ -5260,7 +5300,18 @@ public bool BPF1BPTXled public int FixedTunePower { get { return (int)udTXTunePower.Value; } - set { udTXTunePower.Value = (decimal)value; } + set + { + if (HPSDRModel.HERMESLITE == HardwareSpecific.Model) + { + udTXTunePower.Value = (decimal)(value/3 - 33)/2; // MI0BOT: Now only has a -16.5 to 0 range in HL2 for Tune power + } + else + { + udTXTunePower.Value = (decimal)value; + } + + } } public int TwoTonePower { @@ -5409,6 +5460,7 @@ public float PA10W switch (HardwareSpecific.Model) { + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 case HPSDRModel.ANAN10: case HPSDRModel.ANAN10E: rv = (float)ud10PA1W.Value; @@ -5429,6 +5481,7 @@ public float PA20W float rv = (float)ud100PA20W.Value; switch (HardwareSpecific.Model) { + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 case HPSDRModel.ANAN10: case HPSDRModel.ANAN10E: rv = (float)ud10PA2W.Value; @@ -5448,6 +5501,7 @@ public float PA30W float rv = (float)ud100PA30W.Value; switch (HardwareSpecific.Model) { + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 case HPSDRModel.ANAN10: case HPSDRModel.ANAN10E: rv = (float)ud10PA3W.Value; @@ -5467,6 +5521,7 @@ public float PA40W float rv = (float)ud100PA40W.Value; switch (HardwareSpecific.Model) { + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 case HPSDRModel.ANAN10: case HPSDRModel.ANAN10E: rv = (float)ud10PA4W.Value; @@ -5486,6 +5541,7 @@ public float PA50W float rv = (float)ud100PA50W.Value; switch (HardwareSpecific.Model) { + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 case HPSDRModel.ANAN10: case HPSDRModel.ANAN10E: rv = (float)ud10PA5W.Value; @@ -5505,6 +5561,7 @@ public float PA60W float rv = (float)ud100PA60W.Value; switch (HardwareSpecific.Model) { + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 case HPSDRModel.ANAN10: case HPSDRModel.ANAN10E: rv = (float)ud10PA6W.Value; @@ -5524,6 +5581,7 @@ public float PA70W float rv = (float)ud100PA70W.Value; switch (HardwareSpecific.Model) { + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 case HPSDRModel.ANAN10: case HPSDRModel.ANAN10E: rv = (float)ud10PA7W.Value; @@ -5543,6 +5601,7 @@ public float PA80W float rv = (float)ud100PA80W.Value; switch (HardwareSpecific.Model) { + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 case HPSDRModel.ANAN10: case HPSDRModel.ANAN10E: rv = (float)ud10PA8W.Value; @@ -5562,6 +5621,7 @@ public float PA90W float rv = (float)ud100PA90W.Value; switch (HardwareSpecific.Model) { + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 case HPSDRModel.ANAN10: case HPSDRModel.ANAN10E: rv = (float)ud10PA9W.Value; @@ -5581,6 +5641,7 @@ public float PA100W float rv = (float)ud100PA100W.Value; switch (HardwareSpecific.Model) { + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 case HPSDRModel.ANAN10: case HPSDRModel.ANAN10E: rv = (float)ud10PA10W.Value; @@ -5600,6 +5661,7 @@ public float PA110W float rv = (float)ud100PA110W.Value; switch (HardwareSpecific.Model) { + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 case HPSDRModel.ANAN10: case HPSDRModel.ANAN10E: rv = (float)ud10PA11W.Value; @@ -5619,6 +5681,7 @@ public float PA120W float rv = (float)ud100PA120W.Value; switch (HardwareSpecific.Model) { + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 case HPSDRModel.ANAN10: case HPSDRModel.ANAN10E: rv = (float)ud10PA12W.Value; @@ -5638,6 +5701,7 @@ public float PA130W float rv = (float)ud100PA130W.Value; switch (HardwareSpecific.Model) { + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 case HPSDRModel.ANAN10: case HPSDRModel.ANAN10E: rv = (float)ud10PA13W.Value; @@ -5657,6 +5721,7 @@ public float PA140W float rv = (float)ud100PA140W.Value; switch (HardwareSpecific.Model) { + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 case HPSDRModel.ANAN10: case HPSDRModel.ANAN10E: rv = (float)ud10PA14W.Value; @@ -5669,7 +5734,6 @@ public float PA140W } } - // Added 06/21/05 BT for CAT commands public int CATNB1Threshold @@ -6103,6 +6167,96 @@ public TabControl TabOtherHW { get { return tpApolloAmp; } } + private bool hl2IOBoardPresent = false; + public bool HL2IOBoardPresent + { + get + { + return hl2IOBoardPresent; + } + set + { + hl2IOBoardPresent = value; + chkHL2IOBoardPresent.Checked = value; + chkHL2IOBoardPresent.Enabled = value; + ucIOPinsLedStripHF.Enabled = value; + grpIOPinState.Enabled = value; + + radAlexR1_160.Enabled = value; + radAlexR1_80.Enabled = value; + radAlexR1_60.Enabled = value; + radAlexR1_40.Enabled = value; + radAlexR1_30.Enabled = value; + radAlexR1_20.Enabled = value; + radAlexR1_17.Enabled = value; + radAlexR1_15.Enabled = value; + radAlexR1_12.Enabled = value; + radAlexR1_10.Enabled = value; + + radAlexR2_160.Enabled = value; + radAlexR2_80.Enabled = value; + radAlexR2_60.Enabled = value; + radAlexR2_40.Enabled = value; + radAlexR2_30.Enabled = value; + radAlexR2_20.Enabled = value; + radAlexR2_17.Enabled = value; + radAlexR2_15.Enabled = value; + radAlexR2_12.Enabled = value; + radAlexR2_10.Enabled = value; + + radAlexR3_160.Enabled = value; + radAlexR3_80.Enabled = value; + radAlexR3_60.Enabled = value; + radAlexR3_40.Enabled = value; + radAlexR3_30.Enabled = value; + radAlexR3_20.Enabled = value; + radAlexR3_17.Enabled = value; + radAlexR3_15.Enabled = value; + radAlexR3_12.Enabled = value; + radAlexR3_10.Enabled = value; + + radAlexT1_160.Enabled = value; + radAlexT1_80.Enabled = value; + radAlexT1_60.Enabled = value; + radAlexT1_40.Enabled = value; + radAlexT1_30.Enabled = value; + radAlexT1_20.Enabled = value; + radAlexT1_17.Enabled = value; + radAlexT1_15.Enabled = value; + radAlexT1_12.Enabled = value; + radAlexT1_10.Enabled = value; + + radAlexT2_160.Enabled = value; + radAlexT2_80.Enabled = value; + radAlexT2_60.Enabled = value; + radAlexT2_40.Enabled = value; + radAlexT2_30.Enabled = value; + radAlexT2_20.Enabled = value; + radAlexT2_17.Enabled = value; + radAlexT2_15.Enabled = value; + radAlexT2_12.Enabled = value; + radAlexT2_10.Enabled = value; + + radAlexT3_160.Enabled = value; + radAlexT3_80.Enabled = value; + radAlexT3_60.Enabled = value; + radAlexT3_40.Enabled = value; + radAlexT3_30.Enabled = value; + radAlexT3_20.Enabled = value; + radAlexT3_17.Enabled = value; + radAlexT3_15.Enabled = value; + radAlexT3_12.Enabled = value; + radAlexT3_10.Enabled = value; + + chkBlockTxAnt2.Enabled = value; + chkBlockTxAnt3.Enabled = value; + + console.AlexAntCtrlEnabled = value; + + EnableIOLedStrip(value); + } + } + #endregion @@ -6265,13 +6419,21 @@ private void initHPSDR() } else { - chkRxOutOnTx.Enabled = true; - chkRxOutOnTx.Visible = true; - chkEXT1OutOnTx.Enabled = true; - chkEXT1OutOnTx.Visible = true; - chkEXT2OutOnTx.Enabled = true; - chkEXT2OutOnTx.Visible = true; - + if (HardwareSpecific.Model != HPSDRModel.HERMESLITE) + { + chkRxOutOnTx.Enabled = true; + chkRxOutOnTx.Visible = true; + chkEXT1OutOnTx.Enabled = true; + chkEXT1OutOnTx.Visible = true; + chkEXT2OutOnTx.Enabled = true; + chkEXT2OutOnTx.Visible = true; + grp100WattMeterTrim.BringToFront(); + } + else + { + grp10WattMeterTrim.BringToFront(); + } + // panelAlex1HPFControl.Visible = true; tpAlexFilterControl.Text = "HPF/LPF"; labelAlex1FilterHPF.Text = "HPF"; chkAlexHPFBypass.Text = "ByPass/55 MHz HPF"; @@ -6281,7 +6443,6 @@ private void initHPSDR() labelAlexFilterActive.Location = new Point(275, 0); ud6mRx2LNAGainOffset.Visible = false; lblRx26mLNA.Visible = false; - grp100WattMeterTrim.BringToFront(); chkEnableXVTRHF.Visible = false; } @@ -6296,8 +6457,12 @@ private void initHPSDR() else { tpAlexControl.Text = "Ant/Filters"; - chkHFTRRelay.Visible = true; - chkHFTRRelay.Enabled = true; + + if (HardwareSpecific.Model != HPSDRModel.HERMESLITE) + { + chkHFTRRelay.Visible = true; + chkHFTRRelay.Enabled = true; + } } if (HardwareSpecific.Model != HPSDRModel.ANAN200D && @@ -6391,7 +6556,8 @@ public void AddHPSDRPages() HardwareSpecific.Model == HPSDRModel.ANAN7000D || HardwareSpecific.Model == HPSDRModel.ANAN8000D || HardwareSpecific.Model == HPSDRModel.ANVELINAPRO3 || HardwareSpecific.Model == HPSDRModel.ANAN_G2 || HardwareSpecific.Model == HPSDRModel.ANAN_G2_1K || - HardwareSpecific.Model == HPSDRModel.REDPITAYA) //DH1KLM + HardwareSpecific.Model == HPSDRModel.REDPITAYA || //DH1KLM + HardwareSpecific.Model == HPSDRModel.HERMESLITE) { if (!tcGeneral.TabPages.Contains(tpOtherHW)) { @@ -7063,7 +7229,8 @@ private void comboAudioSampleRate1_SelectedIndexChanged(object sender, System.Ev // be sure RX2 sample rate setting is enabled, UNLESS it's a 10E or 100B if (HardwareSpecific.Model == HPSDRModel.ANAN10E || - HardwareSpecific.Model == HPSDRModel.ANAN100B) + HardwareSpecific.Model == HPSDRModel.ANAN100B || + HardwareSpecific.Model == HPSDRModel.HERMESLITE) { // if it's a 10E/100B, set RX2 sample_rate equal to RX1 rate comboAudioSampleRateRX2.Enabled = false; @@ -9218,8 +9385,17 @@ private void udTXFilterLow_ValueChanged(object sender, System.EventArgs e) private void udTransmitTunePower_ValueChanged(object sender, System.EventArgs e) { - if (initializing) return; - console.TunePower = (int)udTXTunePower.Value; + if (initializing) return; //[2.10.2.3]MW0LGE forceallevents call this + + if (HardwareSpecific.Model != HPSDRModel.HERMESLITE) + { + console.TunePower = (int)udTXTunePower.Value; + } + else + { + // MI0BOT: Range is 0 to -16.5 - convert to 99 - 0 + console.TunePower = (int) ((33 + (udTXTunePower.Value * 2)) * 3); + } } public int GetVACEnabledBitfield(string profile_name = "") @@ -10778,8 +10954,17 @@ private void comboCATPort_SelectedIndexChanged(object sender, System.EventArgs e } chkCATEnable.Enabled = false; + + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + chkCATtoVFOB.Enabled = false; + } + else + { + chkCATEnable.Enabled = true; + + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + chkCATtoVFOB.Enabled = true; } - else chkCATEnable.Enabled = true; if (Common.GetComPortNumber(comboCATPort.Text, out int port)) //[2.10.3.9]MW0LGE console.CATPort = port; @@ -11148,6 +11333,12 @@ private async void chkTestIMD_CheckedChanged(object sender, System.EventArgs e) } else { + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + { + console.radio.GetDSPTX(0).TXPostGenRun = 0; // MI0BOT: Switch of the tone gen before releasing PTT + await Task.Delay(console.MoxDelay); + } + console.MOX = false; await Task.Delay(200); //MW0LGE_21a Audio.MOX = false;// @@ -12121,7 +12312,55 @@ public string TCIOwnCallsign } private void txtGenCustomTitle_TextChanged(object sender, System.EventArgs e) { - console.CustomTitle = txtGenCustomTitle.Text; + //if (HPSDRModel.HERMESLITE != HardwareSpecific.Model) + //{ + // console.CustomTitle = txtGenCustomTitle.Lines[0]; + //} + //else + //{ // MI0BOT: Handle multi line box for display of different IP address + // string remotePort = NetworkIO.EthernetRemotePort == 0 ? "" : ":" + NetworkIO.EthernetRemotePort.ToString(); + // int line = 0; + // string ipAddress = ""; + + // if (chkEnableStaticIP.Checked) + // { + // if (radStaticIP1.Checked) + // line = 1; + // else if (radStaticIP2.Checked) + // line = 2; + // else if (radStaticIP3.Checked) + // line = 3; + // else if (radStaticIP4.Checked) + // line = 4; + + // ipAddress = console.HPSDRNetworkIPAddr; + // } + // else + // { + // line = 0; + // ipAddress = NetworkIO.HpSdrHwIpAddress.ToString(); + // } + + // if ((txtGenCustomTitle.Lines.Length - 1) < line) + // line = 0; + + // if (chkDisplayIPPort.Checked) + // if (line == 0) + // if (txtGenCustomTitle.Lines.Length == 0) + // console.CustomTitle = ipAddress + remotePort + " " + txtGenCustomTitle.Text; + // else + // console.CustomTitle = ipAddress + remotePort + " " + txtGenCustomTitle.Lines[0]; + // else + // console.CustomTitle = ipAddress + remotePort + " " + txtGenCustomTitle.Lines[line] + " " + txtGenCustomTitle.Lines[0]; + // else + // if (line == 0) + // if (txtGenCustomTitle.Lines.Length == 0) + // console.CustomTitle = ipAddress + remotePort + " " + txtGenCustomTitle.Text; + // else + // console.CustomTitle = ipAddress + remotePort + " " + txtGenCustomTitle.Lines[0]; + // else + // console.CustomTitle = txtGenCustomTitle.Lines[line] + " " + txtGenCustomTitle.Lines[0]; + //} } private void chkGenAllModeMicPTT_CheckedChanged(object sender, System.EventArgs e) @@ -13133,6 +13372,23 @@ public bool MercRandom private bool[][] _AlexRxOnlyAntCheckBoxes_old = null; private bool _tx_antenna_2_old; private bool _tx_antenna_3_old; + + // MI0BOT: Control band volts for the HL2 + private void chkHL2BandVolts_CheckedChanged(object sender, System.EventArgs e) + { + if (initializing) return; + int v = chkHL2BandVolts.Checked ? 1 : 0; + NetworkIO.SetADCDither(v); + } + + // MI0BOT: Control power supply sync for the HL2 + private void chkHL2PsSync_CheckedChanged(object sender, System.EventArgs e) + { + if (initializing) return; + int v = chkHL2PsSync.Checked ? 1 : 0; + NetworkIO.SetADCRandom(v); + } + private void InitAlexAntTables() { @@ -14016,7 +14272,10 @@ public string GetFirmwareCodeVersionString() } else { - sRet = "FW v" + NetworkIO.FWCodeVersion.ToString("0\\.0") + " Protocol_1"; + if(HPSDRModel.HERMESLITE == HardwareSpecific.Model) + sRet = "FW v" + NetworkIO.FWCodeVersion.ToString("0\\.0") + NetworkIO.BetaVersion.ToString("\\.0") + " Protocol 1"; + else + sRet = "FW v" + NetworkIO.FWCodeVersion.ToString("0\\.0") + " Protocol_1"; } } @@ -14026,6 +14285,9 @@ public string GetFirmwareCodeVersionString() public void UpdateGeneraHardware() { tpGeneralHardware.Invalidate(); + + if(HPSDRModel.HERMESLITE == HardwareSpecific.Model) + txtGenCustomTitle_TextChanged(this, EventArgs.Empty); } private void udMaxFreq_ValueChanged(object sender, System.EventArgs e) @@ -14059,48 +14321,96 @@ private void chkHERCULES_CheckedChanged(object sender, EventArgs e) } } - chkPenOCrcv1601.Checked = true; - chkPenOCxmit1601.Checked = true; - chkPenOCrcv802.Checked = true; - chkPenOCxmit802.Checked = true; - chkPenOCrcv601.Checked = true; - chkPenOCxmit601.Checked = true; - chkPenOCrcv602.Checked = true; - chkPenOCxmit602.Checked = true; - chkPenOCrcv403.Checked = true; - chkPenOCxmit403.Checked = true; - chkPenOCrcv301.Checked = true; - chkPenOCxmit301.Checked = true; - chkPenOCrcv303.Checked = true; - chkPenOCxmit303.Checked = true; - chkPenOCrcv202.Checked = true; - chkPenOCxmit202.Checked = true; - chkPenOCrcv203.Checked = true; - chkPenOCxmit203.Checked = true; - chkPenOCrcv171.Checked = true; - chkPenOCxmit171.Checked = true; - chkPenOCrcv172.Checked = true; - chkPenOCxmit172.Checked = true; - chkPenOCrcv173.Checked = true; - chkPenOCxmit173.Checked = true; - chkPenOCrcv154.Checked = true; - chkPenOCxmit154.Checked = true; - chkPenOCrcv121.Checked = true; - chkPenOCxmit121.Checked = true; - chkPenOCrcv124.Checked = true; - chkPenOCxmit124.Checked = true; - chkPenOCrcv102.Checked = true; - chkPenOCxmit102.Checked = true; - chkPenOCrcv104.Checked = true; - chkPenOCxmit104.Checked = true; - chkPenOCrcv61.Checked = true; - chkPenOCxmit61.Checked = true; - chkPenOCrcv62.Checked = true; - chkPenOCxmit62.Checked = true; - chkPenOCrcv64.Checked = true; - chkPenOCxmit64.Checked = true; - chkPenOCrcv66.Checked = true; - break; + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + { + chkPenOCrcv1601.Checked = true; + chkPenOCrcv802.Checked = true; + chkPenOCrcv807.Checked = true; + chkPenOCrcv603.Checked = true; + chkPenOCrcv607.Checked = true; + chkPenOCrcv403.Checked = true; + chkPenOCrcv407.Checked = true; + chkPenOCrcv304.Checked = true; + chkPenOCrcv307.Checked = true; + chkPenOCrcv204.Checked = true; + chkPenOCrcv207.Checked = true; + chkPenOCrcv175.Checked = true; + chkPenOCrcv177.Checked = true; + chkPenOCrcv155.Checked = true; + chkPenOCrcv157.Checked = true; + chkPenOCrcv126.Checked = true; + chkPenOCrcv127.Checked = true; + chkPenOCrcv106.Checked = true; + chkPenOCrcv107.Checked = true; + chkPenOCxmit1601.Checked = true; + chkPenOCxmit802.Checked = true; + chkPenOCxmit603.Checked = true; + chkPenOCxmit403.Checked = true; + chkPenOCxmit304.Checked = true; + chkPenOCxmit204.Checked = true; + chkPenOCxmit175.Checked = true; + chkPenOCxmit155.Checked = true; + chkPenOCxmit126.Checked = true; + chkPenOCxmit106.Checked = true; + chkOCrcv1207.Checked = true; + chkOCrcv907.Checked = true; + chkOCrcv617.Checked = true; + chkOCrcv497.Checked = true; + chkOCrcv417.Checked = true; + chkOCrcv317.Checked = true; + chkOCrcv257.Checked = true; + chkOCrcv227.Checked = true; + chkOCrcv197.Checked = true; + chkOCrcv167.Checked = true; + chkOCrcv147.Checked = true; + chkOCrcv137.Checked = true; + chkOCrcv117.Checked = true; + } + else + { + chkPenOCrcv1601.Checked = true; + chkPenOCxmit1601.Checked = true; + chkPenOCrcv802.Checked = true; + chkPenOCxmit802.Checked = true; + chkPenOCrcv601.Checked = true; + chkPenOCxmit601.Checked = true; + chkPenOCrcv602.Checked = true; + chkPenOCxmit602.Checked = true; + chkPenOCrcv403.Checked = true; + chkPenOCxmit403.Checked = true; + chkPenOCrcv301.Checked = true; + chkPenOCxmit301.Checked = true; + chkPenOCrcv303.Checked = true; + chkPenOCxmit303.Checked = true; + chkPenOCrcv202.Checked = true; + chkPenOCxmit202.Checked = true; + chkPenOCrcv203.Checked = true; + chkPenOCxmit203.Checked = true; + chkPenOCrcv171.Checked = true; + chkPenOCxmit171.Checked = true; + chkPenOCrcv172.Checked = true; + chkPenOCxmit172.Checked = true; + chkPenOCrcv173.Checked = true; + chkPenOCxmit173.Checked = true; + chkPenOCrcv154.Checked = true; + chkPenOCxmit154.Checked = true; + chkPenOCrcv121.Checked = true; + chkPenOCxmit121.Checked = true; + chkPenOCrcv124.Checked = true; + chkPenOCxmit124.Checked = true; + chkPenOCrcv102.Checked = true; + chkPenOCxmit102.Checked = true; + chkPenOCrcv104.Checked = true; + chkPenOCxmit104.Checked = true; + chkPenOCrcv61.Checked = true; + chkPenOCxmit61.Checked = true; + chkPenOCrcv62.Checked = true; + chkPenOCxmit62.Checked = true; + chkPenOCrcv64.Checked = true; + chkPenOCxmit64.Checked = true; + chkPenOCrcv66.Checked = true; + } + break; case false: foreach (Control c in grpPennyExtCtrl.Controls) { @@ -15770,8 +16080,12 @@ private void udHermesStepAttenuatorData_ValueChanged(object sender, EventArgs e) _updatingRX1HermesStepAttData = true; console.RX1AttenuatorData = (int)udHermesStepAttenuatorData.Value; - //MW0LGE_21f - if (AlexPresent && + if (HardwareSpecific.Model == HPSDRModel.HERMESLITE) + { + udHermesStepAttenuatorData.Maximum = (decimal)32; + udHermesStepAttenuatorData.Minimum = (decimal)-28; + } + else if (AlexPresent && HardwareSpecific.Model != HPSDRModel.ANAN10 && HardwareSpecific.Model != HPSDRModel.ANAN10E && HardwareSpecific.Model != HPSDRModel.ANAN7000D && @@ -15797,28 +16111,33 @@ private void chkRX2StepAtt_CheckedChanged(object sender, EventArgs e) udHermesStepAttenuatorDataRX2_ValueChanged(this, EventArgs.Empty); } - CheckBoxTS chk = sender as CheckBoxTS; - if (chk != null) // only if we click it //MW0LGE [2.9.0.6] + if (HardwareSpecific.Model != HPSDRModel.HERMESLITE) { - int rx1 = -1, rx2 = -1, sync1 = -1, sync2 = -1, psrx = -1, pstx = -1; - console.GetDDC(out rx1, out rx2, out sync1, out sync2, out psrx, out pstx); - - int nRX1ADCinUse = console.GetADCInUse(rx1); - int nRX2ADCinUse = console.GetADCInUse(rx2); + CheckBoxTS chk = sender as CheckBoxTS; - if (HardwareSpecific.HasSteppedAttenuation(2)) // dont bother setting 1 if 2 not present + if (chk != null) // only if we click it //MW0LGE [2.9.0.6] { - if (nRX1ADCinUse == nRX2ADCinUse && chkHermesStepAttenuator.Checked != chkRX2StepAtt.Checked) - { - chkHermesStepAttenuator.Checked = chkRX2StepAtt.Checked; - } - else + int rx1 = -1, rx2 = -1, sync1 = -1, sync2 = -1, psrx = -1, pstx = -1; + console.GetDDC(out rx1, out rx2, out sync1, out sync2, out psrx, out pstx); + + int nRX1ADCinUse = console.GetADCInUse(rx1); + int nRX2ADCinUse = console.GetADCInUse(rx2); + + if (HardwareSpecific.HasSteppedAttenuation(2)) // dont bother setting 1 if 2 not present { - chkHermesStepAttenuator_CheckedChanged(this, EventArgs.Empty); + if (nRX1ADCinUse == nRX2ADCinUse && chkHermesStepAttenuator.Checked != chkRX2StepAtt.Checked) + { + chkHermesStepAttenuator.Checked = chkRX2StepAtt.Checked; + } + else + { + chkHermesStepAttenuator_CheckedChanged(this, EventArgs.Empty); + } } } } } + private bool _updatingRX2HermesStepAttData = false; private void udHermesStepAttenuatorDataRX2_ValueChanged(object sender, EventArgs e) { @@ -16316,7 +16635,6 @@ private void ConfigMidi2CatSetupClosed(object sender, FormClosedEventArgs e) console.Midi2Cat.OpenMidi2Cat(); } } - private void chkRX1WaterfallAGC_CheckedChanged(object sender, EventArgs e) { if (initializing) return; @@ -16360,6 +16678,7 @@ private void btnResetWattMeterValues_Click(object sender, EventArgs e) { switch (HardwareSpecific.Model) // G8NJJ will need more work for ANAN_G2_1K (1KW PA) { + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 case HPSDRModel.ANAN10: case HPSDRModel.ANAN10E: ud10PA1W.Value = 1; @@ -19821,13 +20140,22 @@ private void comboRadioModel_SelectedIndexChanged(object sender, EventArgs e) console.SetupForHPSDRModel(); comboAudioSampleRateRX2.Enabled = true; + + // MI0BOT: Remove the HL2 option and only add back if HL2 + tcOptions.Controls.Remove(tpHL2Options); groupBoxRXOptions.Text = HardwareSpecific.ModelString + " Options"; grpHermesStepAttenuator.Text = HardwareSpecific.ModelString + " Step Atten"; console.UpdatePIVisibilty(); + if (HardwareSpecific.Model != HPSDRModel.HERMESLITE) + { + removeHL2Options(); + } + switch (HardwareSpecific.Model) + { case HPSDRModel.HERMES: chkAlexPresent.Enabled = true; @@ -19860,6 +20188,203 @@ private void comboRadioModel_SelectedIndexChanged(object sender, EventArgs e) setupAttRXControls(2); break; + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 + HardwareSpecific.Model = HPSDRModel.HERMESLITE; + tcOptions.Controls.Add(tpHL2Options); + pnlGeneralHardwareORION.Enabled = false; + chkAlexPresent.Enabled = true; + chkAlexPresent.Visible = false; + chkApolloPresent.Enabled = true; + chkApolloPresent.Visible = false; + chkGeneralRXOnly.Visible = true; + chkHermesStepAttenuator.Enabled = false; + chkHermesStepAttenuator.Checked = true; + chkRX2StepAtt.Checked = false; + chkRX2StepAtt.Enabled = false; + chkRX2StepAtt.Visible = false; + udHermesStepAttenuatorDataRX2.Visible = false; + udHermesStepAttenuatorDataRX2.Minimum = (decimal)-28; + udHermesStepAttenuatorData.Maximum = 31; + udHermesStepAttenuatorDataRX2.Maximum = 31; + chkAutoPACalibrate.Checked = false; + chkAutoPACalibrate.Visible = false; + labelRXAntControl.Text = " RX1 RX2 XVTR"; + RXAntChk1Name = "RX1"; + RXAntChk2Name = "RX2"; + RXAntChk3Name = "XVTR"; + labelATTOnTX.Visible = true; + udATTOnTX.Visible = true; + chkRxOutOnTx.Text = "RX 1 OUT on Tx"; + chkEXT1OutOnTx.Text = "RX 2 IN on Tx"; + chkEXT2OutOnTx.Text = "RX 1 IN on Tx"; + chkEXT2OutOnTx.Visible = true; + groupBoxHPSDRHW.Visible = true; + chkDisableRXOut.Visible = false; + chkBPF2Gnd.Visible = false; + chkMercDither.Enabled = false; + chkMercRandom.Enabled = false; + udMaxFreq.Value = (Decimal) 38.4; + tpOtherHW.Text = "PA Control"; + chkApolloFilter.Text = "Enable Full Duplex"; + chkApolloTuner.Text = "Enable PA"; + grpApolloCtrl.Text = "PA Control"; + tpApolloApollo.Text = "PA"; + tpPennyCtrl.Text = "Hermes Lite Control"; + chkHERCULES.Visible = true; + chkHERCULES.Text = "N2ADR Filter"; + tpAlexControl.Text = "Ant/Filters"; + comboAudioSampleRateRX2.Enabled = false; + ucIOPinsLedStripHF.DisplayBits = 6; + toolTip1.SetToolTip(chkHERCULES, "Preset pins for for N2ADR filter board"); + toolTip1.SetToolTip(chkApolloFilter, "Enables the full duplex on the HL2"); + toolTip1.SetToolTip(chkApolloTuner, "Enables HL2 power amplifier"); + chkAutoATTRx1.Enabled = true; + chkAutoATTRx2.Enabled = false; + setupAttRXControls(1); + setupAttRXControls(2); + + radDDC0ADC0.Checked = true; + radDDC1ADC0.Checked = true; + radDDC2ADC0.Checked = true; + radDDC3ADC0.Checked = true; + radDDC4ADC0.Checked = true; + radDDC5ADC0.Checked = true; + radDDC6ADC0.Checked = true; + + radDDC0ADC1.Checked = false; + radDDC1ADC1.Checked = false; + radDDC2ADC1.Checked = false; + radDDC3ADC1.Checked = false; + radDDC4ADC1.Checked = false; + radDDC5ADC1.Checked = false; + radDDC6ADC1.Checked = false; + + chkAlex160R1.Enabled = true; + chkAlex80R1.Enabled = true; + chkAlex60R1.Enabled = true; + chkAlex40R1.Enabled = true; + chkAlex30R1.Enabled = true; + chkAlex20R1.Enabled = true; + chkAlex17R1.Enabled = true; + chkAlex15R1.Enabled = true; + chkAlex12R1.Enabled = true; + chkAlex10R1.Enabled = true; + + radAlexR1_6.Enabled = false; + radAlexR1_6.Visible = false; + labelTS5.Visible = false; + labelTS5.Enabled = false; + radAlexR2_6.Enabled = false; + radAlexR2_6.Visible = false; + radAlexR3_6.Enabled = false; + radAlexR3_6.Visible = false; + chkAlex6R1.Enabled = false; + chkAlex6R1.Visible = false; + chkAlex160R2.Enabled = false; + chkAlex80R2.Enabled = false; + chkAlex60R2.Enabled = false; + chkAlex40R2.Enabled = false; + chkAlex30R2.Enabled = false; + chkAlex20R2.Enabled = false; + chkAlex17R2.Enabled = false; + chkAlex15R2.Enabled = false; + chkAlex12R2.Enabled = false; + chkAlex10R2.Enabled = false; + chkAlex6R2.Enabled = false; + chkAlex6R2.Visible = false; + chkAlex160XV.Enabled = false; + chkAlex80XV.Enabled = false; + chkAlex60XV.Enabled = false; + chkAlex40XV.Enabled = false; + chkAlex30XV.Enabled = false; + chkAlex20XV.Enabled = false; + chkAlex17XV.Enabled = false; + chkAlex15XV.Enabled = false; + chkAlex12XV.Enabled = false; + chkAlex10XV.Enabled = false; + chkAlex6XV.Enabled = false; + chkAlex6XV.Visible = false; + chkDisableRXOut.Enabled = false; + chkEXT1OutOnTx.Visible = false; + chkEXT2OutOnTx.Visible = false; + chkHFTRRelay.Visible = false; + labelTS104.Visible = false; + radAlexT1_6.Visible = false; + radAlexT2_6.Visible = false; + radAlexT3_6.Visible = false; + radAlexT1_6.Enabled = false; + radAlexT2_6.Enabled = false; + radAlexT3_6.Enabled = false; + + labelTxLatency.Visible = true; + labelPttHang.Visible = true; + udTxBufferLat.Visible = true; + udPTTHang.Visible = true; + + grpDisplay8000DLE.Text = "Hermes-Lite"; + chkANAN8000DLEDisplayVoltsAmps.Text = "Show Temp/Current"; + chkANAN8000DLEDisplayVoltsAmps.Checked = true; + + udTXTunePower.DecimalPlaces = 1; + udTXTunePower.Increment = (decimal)0.5; + udTXTunePower.Maximum = (decimal)0; + udTXTunePower.Minimum = (decimal)-16.5; + + chkCATtoVFOB.Enabled = true; + chkCATtoVFOB.Visible = true; + + txtGenCustomTitle.MaxLength = 100; + txtGenCustomTitle.Multiline = true; + txtGenCustomTitle.WordWrap = false; + txtGenCustomTitle.TextChanged += new System.EventHandler(this.txtGenCustomTitle_TextChanged); + txtGenCustomTitle.MouseEnter += new System.EventHandler(this.txtGenCustomTitle_MouseEnter); + txtGenCustomTitle.MouseLeave += new System.EventHandler(this.txtGenCustomTitle_MouseLeave); + + grpIOPinState.Enabled = true; + grpIOPinState.Visible = true; + ucIOPinsLedStripHF.Enabled = true; + ucIOPinsLedStripHF.Visible = true; + + chkHL2IOBoardPresent.Enabled = true; + chkHL2IOBoardPresent.Visible = true; + + udATTOnTX.Minimum = (decimal)-28; + + nud160M.Minimum = 0; + nud80M.Minimum = 0; + nud60M.Minimum = 0; + nud40M.Minimum = 0; + nud30M.Minimum = 0; + nud20M.Minimum = 0; + nud17M.Minimum = 0; + nud15M.Minimum = 0; + nud12M.Minimum = 0; + nud10M.Minimum = 0; + + nud160M.Increment = 1; + nud80M.Increment = 1; + nud60M.Increment = 1; + nud40M.Increment = 1; + nud30M.Increment = 1; + nud20M.Increment = 1; + nud17M.Increment = 1; + nud15M.Increment = 1; + nud12M.Increment = 1; + nud10M.Increment = 1; + + nud160M.DecimalPlaces = 0; + nud80M.DecimalPlaces = 0; + nud60M.DecimalPlaces = 0; + nud40M.DecimalPlaces = 0; + nud30M.DecimalPlaces = 0; + nud20M.DecimalPlaces = 0; + nud17M.DecimalPlaces = 0; + nud15M.DecimalPlaces = 0; + nud12M.DecimalPlaces = 0; + nud10M.DecimalPlaces = 0; + + break; + case HPSDRModel.ANAN10: chkAlexPresent.Checked = true; chkAlexPresent.Enabled = false; @@ -20440,6 +20965,12 @@ private void comboRadioModel_SelectedIndexChanged(object sender, EventArgs e) MeterManager.SetAntennaAuxText(RXAntChk1Name, RXAntChk2Name, RXAntChk3Name); } + private void removeHL2Options() + { + // Switch off and hide HL2 options + chkCATtoVFOB.Enabled = false; + chkCATtoVFOB.Visible = false; + } private void setupADCRadioButtions() { bool bADC0 = false; @@ -20449,6 +20980,7 @@ private void setupADCRadioButtions() switch (HardwareSpecific.Model) { case HPSDRModel.HERMES: + case HPSDRModel.HERMESLITE: // MI0BOT: HL2 case HPSDRModel.ANAN10: case HPSDRModel.ANAN10E: case HPSDRModel.ANAN100: @@ -20626,6 +21158,7 @@ private void btnResetP2ADC_Click(object sender, EventArgs e) switch (HardwareSpecific.Model) { case HPSDRModel.HERMES: + case HPSDRModel.HERMESLITE: case HPSDRModel.ANAN10: case HPSDRModel.ANAN10E: case HPSDRModel.ANAN100: @@ -20655,6 +21188,7 @@ private void btnResetP1ADC_Click(object sender, EventArgs e) switch (HardwareSpecific.Model) { case HPSDRModel.HERMES: + case HPSDRModel.HERMESLITE: case HPSDRModel.ANAN10: case HPSDRModel.ANAN10E: case HPSDRModel.ANAN100: @@ -20698,6 +21232,34 @@ private void checkAriesStandalone_CheckedChanged(object sender, EventArgs e) { console.AriesStandalone = checkAriesStandalone.Checked; } + + // MI0BOT: Controls the hardware tx buffer in the HL2 + + private void udTxBufferLat_ValueChanged(object sender, EventArgs e) + { + NetworkIO.SetTxLatency((int)udTxBufferLat.Value); + } + + // MI0BOT: Controls the hardware PTT hang in the HL2 + + private void udPTTHang_ValueChanged(object sender, EventArgs e) + { + NetworkIO.SetPttHang((int)udPTTHang.Value); + } + + // MI0BOT: Controls the ability to send CAT commands to VFO B + + private void chkCATtoVFOB_CheckedChanged(object sender, EventArgs e) + { + console.CATtoVFOB = chkCATtoVFOB.Checked; + } + + // MI0BOT: Controls if the HL2 will reset after an Ethernet disconnect + private void chkDisconnectReset_CheckedChanged(object sender, EventArgs e) + { + int v = chkDisconnectReset.Checked ? 1 : 0; + NetworkIO.SetResetOnDisconnect(v); + } private void chkAndrBandBtnDefault_CheckedChanged(object sender, EventArgs e) { @@ -20874,6 +21436,324 @@ private void chkVFOSyncLinksCTUN_CheckedChanged(object sender, EventArgs e) { console.LinkCTUNonVFOSync = chkVFOSyncLinksCTUN.Checked; } + + // MI0BOT: HL2 access to I2C bus + private void btnI2CRead_MouseDown(object sender, MouseEventArgs e) + { + if (!console.PowerOn) + { + MessageBox.Show("Power must be on to access the I2C bus.", + "Power is off", + MessageBoxButtons.OK, + MessageBoxIcon.Hand); + return; + } + + int bus = radI2C1.Checked ? 0 : 1; + byte[] read_data = new byte[4]; + int status; + int timeout = 0; + + console.SetI2CPollingPause(true); + + while (0 != NetworkIO.I2CReadInitiate(bus, (int) udI2CAddress.Value, (int) ((udI2CControl1.Value * 16) + udI2CControl0.Value))) + { + Thread.Sleep(1); + } + + do + { + Thread.Sleep(1); + status = NetworkIO.I2CResponse(read_data); + if (timeout++ >= 20) break; + } while (1 == status); + + if (-1 == status) + { + txtI2CByte0.Text = "or"; + txtI2CByte1.Text = "Err"; + txtI2CByte2.Text = "or"; + txtI2CByte3.Text = "Err"; + txtI2CByte0.ForeColor = Color.Red; + txtI2CByte1.ForeColor = Color.Red; + txtI2CByte2.ForeColor = Color.Red; + txtI2CByte3.ForeColor = Color.Red; + } + else + { + int byte0, byte1, byte2, byte3; + + byte0 = read_data[3]; + byte1 = read_data[2]; + byte2 = read_data[1]; + byte3 = read_data[0]; + + txtI2CByte0.ForeColor = Color.Black; + txtI2CByte1.ForeColor = Color.Black; + txtI2CByte2.ForeColor = Color.Black; + txtI2CByte3.ForeColor = Color.Black; + txtI2CByte0.Text = byte0.ToString("X2"); + txtI2CByte1.Text = byte1.ToString("X2"); + txtI2CByte2.Text = byte2.ToString("X2"); + txtI2CByte3.Text = byte3.ToString("X2"); + } + + console.SetI2CPollingPause(false); + } + + // MI0BOT: HL2 access to I2C bus + private void btnI2CWrite_MouseDown(object sender, MouseEventArgs e) + { + if (!console.PowerOn) + { + MessageBox.Show("Power must be on to access the I2C bus.", + "Power is off", + MessageBoxButtons.OK, + MessageBoxIcon.Hand); + return; + } + + console.SetI2CPollingPause(true); + + int bus = radI2C1.Checked ? 0 : 1; + + int controlReg = (int)((udI2CControl1.Value * 16) + udI2CControl0.Value); + + NetworkIO.I2CWrite(bus, (int)udI2CAddress.Value, controlReg, (int) udI2CWriteData.Value); + + if (controlReg == 169) + { + ucOutPinsLedStripHF_Click(sender, e); + } + + console.SetI2CPollingPause(false); + } + + // MI0BOT: HL2 access to I2C bus + private void chkI2CWriteEnable_CheckedChanged(object sender, EventArgs e) + { + if (chkI2CWriteEnable.Checked) + { + btnI2CWrite.Enabled = true; + udI2CWriteData.Enabled = true; + labelI2CWriteData.Enabled = true; + } + else + { + btnI2CWrite.Enabled = false; + udI2CWriteData.Enabled = false; + labelI2CWriteData.Enabled = false; + } + } + + // MI0BOT: HL2 access to I2C bus + private void chkI2CEnable_CheckedChanged(object sender, EventArgs e) + { + if (chkI2CEnable.Checked) + groupBoxI2CControl.Enabled = true; + else + groupBoxI2CControl.Enabled = false; + } + + // MI0BOT: Support for HL2 10MHz input + public bool Ext10MHzChecked + { + get { return chkExt10MHz.Checked; } + set { } + } + + // MI0BOT: Support for HL2 Cl2 clock output + public bool Cl2Checked + { + get { return chkCl2Enable.Checked; } + set { } + } + + // MI0BOT: Data to program clock generator in HL2 to accept external 10MHz on CL2 + // Data in format of Address, Data + + private byte[] clockRegisterData10MhzEnable = new byte[] { + 0x10, 0xc0, + 0x13, 0x03, + 0x10, 0x40, + 0x2d, 0x01, + 0x2e, 0x20, + 0x22, 0x03, + 0x23, 0x00, + 0x24, 0x00, + 0x25, 0x00, + 0x19, 0x00, + 0x1A, 0x00, + 0x1B, 0x00, + 0x18, 0x00, + 0x17, 0x12 }; + + private byte[] clockRegisterData10MhzDisable = new byte[] { + 0x10, 0xc0, + 0x13, 0x00, + 0x10, 0x80, + 0x2d, 0x01, + 0x2e, 0x10, + 0x22, 0x00, + 0x23, 0x00, + 0x24, 0x00, + 0x25, 0x00, + 0x19, 0x00, + 0x1A, 0x00, + 0x1B, 0x00, + 0x18, 0x40, + 0x17, 0x04 }; + + private byte[] clockRegisterDataCl2 = new byte[] { + 0x62, 0x3b, + 0x2c, 0x00, + 0x31, 0x81, + 0x3d, 0x01, + 0x3e, 0x10, + 0x32, 0x00, + 0x33, 0x00, + 0x34, 0x00, + 0x35, 0x00, + 0x63, 0x01 }; + + private byte[] clockRegisterDataCl2Off = new byte[] { + 0x62, 0x5b, + 0x2c, 0x00, + 0x31, 0x00, + 0x3d, 0x00, + 0x3e, 0x00, + 0x32, 0x00, + 0x33, 0x00, + 0x34, 0x00, + 0x35, 0x00, + 0x63, 0x00 }; + + // MI0BOT: Support for HL2 Cl2 clock output + private async Task WriteVersaClockAsync( byte[] registerData ) + { + byte Timeout = 0; + int status = 0; + + if (!initializing) + { + if (!console.PowerOn) + { + MessageBox.Show("Power must be on to set the CL2 clock frequency.", + "Power is off", + MessageBoxButtons.OK, + MessageBoxIcon.Hand); + return; + } + + console.SetI2CPollingPause(true); + + for (int i = 0; i < registerData.Length; i += 2) + { + do + { + status = NetworkIO.I2CWrite(0, 0xd4, (int)registerData[i], registerData[i + 1]); + if (Timeout++ >= 50) break; + await Task.Delay(1); + } while (status != 0); + + if (50 <= Timeout) + { + MessageBox.Show("IC2 timed out.", + "IC2 Fail", + MessageBoxButtons.OK, + MessageBoxIcon.Hand); + break; + } + + if (status == -1) + { + MessageBox.Show("IC2 write failed.", + "IC2 Fail", + MessageBoxButtons.OK, + MessageBoxIcon.Hand); + break; + } + } + + console.SetI2CPollingPause(false); + } + } + + // MI0BOT: Support for HL2 10MHz clock input + public void EnableCl1_10MHz() + { + WriteVersaClockAsync(clockRegisterData10MhzEnable); + } + + // MI0BOT: Support for HL2 10MHz clock input + public void DisableCl1_10MHz() + { + WriteVersaClockAsync(clockRegisterData10MhzDisable); + } + + // MI0BOT: Support for HL2 Cl2 clock output + public void ControlCl2(bool enable) + { + Decimal vco = (Decimal)1305.6; + + if (chkExt10MHz.Checked) + vco = 1440; + + if (enable) + { + udCl2Freq.Enabled = true; + + if (0 != udCl2Freq.Value) + { + Decimal diviser = vco / udCl2Freq.Value; + int integer = (int)Decimal.Truncate(diviser); + clockRegisterDataCl2[7] = (Byte)((integer >> 4) & 0xff); + clockRegisterDataCl2[9] = (Byte)((integer << 4) & 0xf0); + + Decimal frac = diviser - integer; + int intFrac = (int)(frac * (Decimal)(1 << 24)); + + clockRegisterDataCl2[11] = (Byte)((intFrac >> 22) & 0xff); + clockRegisterDataCl2[13] = (Byte)((intFrac >> 14) & 0xff); + clockRegisterDataCl2[15] = (Byte)((intFrac >> 6) & 0xff); + clockRegisterDataCl2[17] = (Byte)((intFrac << 2) & 0xf6); + + WriteVersaClockAsync(clockRegisterDataCl2); + } + } + else + { + udCl2Freq.Enabled = false; + WriteVersaClockAsync(clockRegisterDataCl2Off); + } + } + + // MI0BOT: Support for HL2 Cl2 clock output + private void chkCl2Enable_CheckedChanged(object sender, EventArgs e) + { + ControlCl2(chkCl2Enable.Checked); + } + + // MI0BOT: Support for HL2 Cl2 clock output + private void udCl2Freq_ValueChanged(object sender, EventArgs e) + { + ControlCl2(chkCl2Enable.Checked); + } + + // MI0BOT: Support for HL2 10MHz clock input + private void chkExt10MHz_CheckedChanged(object sender, EventArgs e) + { + if (chkExt10MHz.Checked) + { + EnableCl1_10MHz(); + } + else + { + DisableCl1_10MHz(); + } + + ControlCl2(chkCl2Enable.Checked); + } private void chkDataLineGradient_CheckedChanged(object sender, EventArgs e) { @@ -21073,7 +21953,9 @@ public void UpdateDDCTab() int nRX1ADCinUse = console.GetADCInUse(rx1); int nRX2ADCinUse = console.GetADCInUse(rx2); - ADCsLinked = nRX1ADCinUse == nRX2ADCinUse; + + if (HardwareSpecific.Model != HPSDRModel.HERMESLITE) + ADCsLinked = nRX1ADCinUse == nRX2ADCinUse; if (NetworkIO.CurrentRadioProtocol == RadioProtocol.ETH) // P2 { @@ -21721,6 +22603,19 @@ public void UpdateOCLedStrip(bool tx, int bits) ucOCPinsLedStripHF.Bits = bits; } + public void UpdateIOLedStrip(bool tx, byte bits) + { + ucIOPinsLedStripHF.TX = tx; + ucIOPinsLedStripHF.Bits = (int) bits; + } + + public void EnableIOLedStrip(bool state) + { + ucIOPinsLedStripHF.Enabled = state; + ucIOPinsLedStripHF.Visible = state; + grpIOPinState.Enabled = state; + } + private void tcOCControl_SelectedIndexChanged(object sender, EventArgs e) { switch (grpTransmitPinActionSWL.SelectedIndex) @@ -23655,6 +24550,24 @@ private void handleOldPAGainSettings(ref Dictionary getDict) if (g != 1000 && bRemoveOld) removeOldPASetting(sSetting); } break; + case HPSDRModel.HERMESLITE: + for (int n = (int)Band.B160M; n <= (int)Band.B6M; n++) + { + Band b = (Band)n; + string sSetting = "udHermesLitePAGain" + mapBandToMeters(b).ToString(); + float g = getOldVariablePAgain(sSetting, ref getDict); + if (g != 1000) p.SetGainForBand(b, g); + if (g != 1000 && bRemoveOld) removeOldPASetting(sSetting); + } + for (int n = (int)Band.VHF0; n <= (int)Band.VHF13; n++) + { + Band b = (Band)n; + string sSetting = "udHermesLitePAGainVHF" + (n - (int)Band.VHF0).ToString(); + float g = getOldVariablePAgain(sSetting, ref getDict); + if (g != 1000) p.SetGainForBand(b, g); + if (g != 1000 && bRemoveOld) removeOldPASetting(sSetting); + } + break; case HPSDRModel.FIRST: // special case for bypass case HPSDRModel.HPSDR: if (p.Model == HPSDRModel.HPSDR || (p.Model == HPSDRModel.FIRST && p.ProfileName == _sPA_PROFILE_BYPASS)) @@ -26959,6 +27872,12 @@ private bool canPasteSettings() return bPaste; } + + private void chkHL2IOBoardPresent_CheckedChanged(object sender, EventArgs e) + { + HL2IOBoardPresent = chkHL2IOBoardPresent.Checked; + } + public void ShowMultiMeterSetupTab(string sID = "") { // show multimeter tab, with meter container already selected if sID is provided @@ -27201,6 +28120,29 @@ private void tmrCheckProfile_Tick(object sender, EventArgs e) tmrCheckProfile.Enabled = true; } + + private void chkLimit2Subnet_CheckedChanged(object sender, EventArgs e) + { +// NetworkIO.enableLimitSubnet = chkLimit2Subnet.Checked; + } + + private void chkDisplayIPPort_CheckedChanged(object sender, EventArgs e) + { + txtGenCustomTitle_TextChanged(sender, e); + } + private void txtGenCustomTitle_MouseEnter(object sender, EventArgs e) + { + grpGenCustomTitleText.Height *= 2; + grpGenCustomTitleText.BringToFront(); + txtGenCustomTitle.Height *= 4; + } + + private void txtGenCustomTitle_MouseLeave(object sender, EventArgs e) + { + txtGenCustomTitle.Height /= 4; + grpGenCustomTitleText.Height /= 2; + grpGenCustomTitleText.SendToBack(); + } private void btnClearTCISpots_Click(object sender, EventArgs e) { @@ -29060,6 +30002,59 @@ private void chkCWbecomesCWUabove10mhz_CheckedChanged(object sender, EventArgs e { if (console.TCIServer != null) console.TCIServer.CWbecomesCWUabove10mhz = chkCWbecomesCWUabove10mhz.Checked; } + + private void ucOutPinsLedStripHF_Click(object sender, EventArgs e) + { + byte[] read_data = new byte[4]; + int status = 0; + int timeout = 0; + + if (HL2IOBoardPresent == true) + { + console.SetI2CPollingPause(true); + + while (0 != NetworkIO.I2CReadInitiate(1, 0x1d, 169)) + { + Thread.Sleep(1); + if (timeout++ >= 20) break; + } + + if (timeout < 20) + { + do + { + Thread.Sleep(1); + status = NetworkIO.I2CResponse(read_data); + if (timeout++ >= 20) break; + } while (1 == status); + + if (status == 0) + ucOutPinsLedStripHF.Bits = read_data[3]; + } + + console.SetI2CPollingPause(false); + } + } + + private void ucOutPinsLedStripHF_MouseDown(object sender, MouseEventArgs e) + { + if (HL2IOBoardPresent == true) + { + if (chkIOPinControl.Checked) + { + int bit = e.Location.X / 16; + byte mask = (byte)(1 << bit); + + console.SetI2CPollingPause(true); + + NetworkIO.I2CWrite(1, 0x1d, 169, ucOutPinsLedStripHF.Bits ^ mask); + + console.SetI2CPollingPause(false); + + ucOutPinsLedStripHF_Click(sender, e); + } + } + } public readonly Dictionary KenwoodAISettings = new Dictionary(); // contains settings "enabled", "port1", "port2", "port3", "port4", "tcp", all as bools private void chkKWAI_port1_CheckedChanged(object sender, EventArgs e) @@ -37066,6 +38061,12 @@ private void chkActivePeakRX2_tx_CheckedChanged(object sender, EventArgs e) Display.ActivePeakInTxRX2 = chkActivePeakRX2_tx.Checked; } + // MI0BOT: Controls if the audio over the Over Protocol 1. There was a fudge to correct a problem in some HPSDR hardware + private void chkSwapAudioChannels_CheckedChanged(object sender, EventArgs e) + { + int swap = chkSwapAudioChannels.Checked ? 1 : 0; + NetworkIO.SwapAudioChannels(swap); + } // CFC para private bool _cfc_legacy = true; private void chkCFC_legacy_CheckedChanged(object sender, EventArgs e) diff --git a/Project Files/Source/Console/setup.designer.cs b/Project Files/Source/Console/setup.designer.cs index 56dea609..0a9b7e64 100644 --- a/Project Files/Source/Console/setup.designer.cs +++ b/Project Files/Source/Console/setup.designer.cs @@ -248,6 +248,7 @@ private void InitializeComponent() this.chkGeneralRXOnly = new System.Windows.Forms.CheckBoxTS(); this.groupBoxHPSDRHW = new System.Windows.Forms.GroupBoxTS(); this.pnlAlexApollo = new System.Windows.Forms.PanelTS(); + this.chkHL2IOBoardPresent = new System.Windows.Forms.CheckBoxTS(); this.chkAlexPresent = new System.Windows.Forms.CheckBoxTS(); this.chkApolloPresent = new System.Windows.Forms.CheckBoxTS(); this.pnlGeneralHardwareORION = new System.Windows.Forms.PanelTS(); @@ -411,6 +412,46 @@ private void InitializeComponent() this.chkVFOsync_filter = new System.Windows.Forms.CheckBoxTS(); this.chkVFOsync_mode = new System.Windows.Forms.CheckBoxTS(); this.chkVFOsync_freq = new System.Windows.Forms.CheckBoxTS(); + this.tpHL2Options = new System.Windows.Forms.TabPage(); + this.groupBoxHL2RXOptions = new System.Windows.Forms.GroupBoxTS(); + this.chkSwapAudioChannels = new System.Windows.Forms.CheckBoxTS(); + this.labelCl2Freq = new System.Windows.Forms.LabelTS(); + this.udCl2Freq = new System.Windows.Forms.NumericUpDownTS(); + this.chkCl2Enable = new System.Windows.Forms.CheckBoxTS(); + this.chkExt10MHz = new System.Windows.Forms.CheckBoxTS(); + this.chkDisconnectReset = new System.Windows.Forms.CheckBoxTS(); + this.labelPttHang = new System.Windows.Forms.LabelTS(); + this.labelTxLatency = new System.Windows.Forms.LabelTS(); + this.udPTTHang = new System.Windows.Forms.NumericUpDownTS(); + this.udTxBufferLat = new System.Windows.Forms.NumericUpDownTS(); + this.chkHL2PsSync = new System.Windows.Forms.CheckBoxTS(); + this.chkHL2BandVolts = new System.Windows.Forms.CheckBoxTS(); + this.groupBoxI2CControl = new System.Windows.Forms.GroupBoxTS(); + this.txtI2CByte1 = new System.Windows.Forms.TextBoxTS(); + this.txtI2CByte2 = new System.Windows.Forms.TextBoxTS(); + this.chkI2CWriteEnable = new System.Windows.Forms.CheckBoxTS(); + this.udI2CControl1 = new System.Windows.Forms.NumericUpDownTS(); + this.txtI2CByte3 = new System.Windows.Forms.TextBoxTS(); + this.labelI2C2 = new System.Windows.Forms.LabelTS(); + this.labelI2C1 = new System.Windows.Forms.LabelTS(); + this.radI2C2 = new System.Windows.Forms.RadioButtonTS(); + this.radI2C1 = new System.Windows.Forms.RadioButtonTS(); + this.txtI2CByte0 = new System.Windows.Forms.TextBoxTS(); + this.btnI2CWrite = new System.Windows.Forms.ButtonTS(); + this.labelI2CWriteData = new System.Windows.Forms.LabelTS(); + this.udI2CWriteData = new System.Windows.Forms.NumericUpDownTS(); + this.labelI2CControl = new System.Windows.Forms.LabelTS(); + this.udI2CControl0 = new System.Windows.Forms.NumericUpDownTS(); + this.btnI2CRead = new System.Windows.Forms.ButtonTS(); + this.labelI2CAddress = new System.Windows.Forms.LabelTS(); + this.udI2CAddress = new System.Windows.Forms.NumericUpDownTS(); + this.chkI2CEnable = new System.Windows.Forms.CheckBoxTS(); + this.grpIOPinState = new System.Windows.Forms.GroupBoxTS(); + this.chkIOPinControl = new System.Windows.Forms.CheckBoxTS(); + this.labelOutState = new System.Windows.Forms.LabelTS(); + this.ucOutPinsLedStripHF = new Thetis.ucOCLedStrip(); + this.labelIOState = new System.Windows.Forms.LabelTS(); + this.ucIOPinsLedStripHF = new Thetis.ucOCLedStrip(); this.tpOptionsStartUp = new System.Windows.Forms.TabPage(); this.groupBoxTS37 = new System.Windows.Forms.GroupBoxTS(); this.chkAutoLaunchTryToClose = new System.Windows.Forms.CheckBoxTS(); @@ -3607,6 +3648,7 @@ private void InitializeComponent() this.comboCAT2databits = new System.Windows.Forms.ComboBoxTS(); this.comboCAT2stopbits = new System.Windows.Forms.ComboBoxTS(); this.grpCatControlBox = new System.Windows.Forms.GroupBoxTS(); + this.chkCATtoVFOB = new System.Windows.Forms.CheckBoxTS(); this.comboCATPort = new System.Windows.Forms.ComboBoxTS(); this.comboCATbaud = new System.Windows.Forms.ComboBoxTS(); this.lblCATBaud = new System.Windows.Forms.LabelTS(); @@ -4258,10 +4300,6 @@ private void InitializeComponent() this.chkLedIndicator_FadeOnTX = new System.Windows.Forms.CheckBoxTS(); this.chkLedIndicator_FadeOnRX = new System.Windows.Forms.CheckBoxTS(); this.tabPage9 = new System.Windows.Forms.TabPage(); - this.grpMeterItemDataOutNode = new System.Windows.Forms.GroupBoxTS(); - this.labelTS210 = new System.Windows.Forms.LabelTS(); - this.labelTS217 = new System.Windows.Forms.LabelTS(); - this.labelTS215 = new System.Windows.Forms.LabelTS(); this.tabPage10 = new System.Windows.Forms.TabPage(); this.grpMeterItemVfoDisplaySettings = new System.Windows.Forms.GroupBoxTS(); this.labelTS278 = new System.Windows.Forms.LabelTS(); @@ -4406,6 +4444,10 @@ private void InitializeComponent() this.nudMeterItem_custom_min = new System.Windows.Forms.NumericUpDownTS(); this.labelTS428 = new System.Windows.Forms.LabelTS(); this.tabPage15 = new System.Windows.Forms.TabPage(); + this.grpMeterItemDataOutNode = new System.Windows.Forms.GroupBoxTS(); + this.labelTS210 = new System.Windows.Forms.LabelTS(); + this.labelTS217 = new System.Windows.Forms.LabelTS(); + this.labelTS215 = new System.Windows.Forms.LabelTS(); this.tmrLedValid = new System.Windows.Forms.Timer(this.components); this.labelTS198 = new System.Windows.Forms.LabelTS(); this.txtboxTXProfileChangedReport = new System.Windows.Forms.TextBoxTS(); @@ -4563,6 +4605,17 @@ private void InitializeComponent() this.tpOptions3.SuspendLayout(); this.groupBoxTS57.SuspendLayout(); this.groupBoxTS58.SuspendLayout(); + this.tpHL2Options.SuspendLayout(); + this.groupBoxHL2RXOptions.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.udCl2Freq)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.udPTTHang)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.udTxBufferLat)).BeginInit(); + this.groupBoxI2CControl.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.udI2CControl1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.udI2CWriteData)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.udI2CControl0)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.udI2CAddress)).BeginInit(); + this.grpIOPinState.SuspendLayout(); this.tpOptionsStartUp.SuspendLayout(); this.groupBoxTS37.SuspendLayout(); this.grpAutoLaunchFiles.SuspendLayout(); @@ -5511,8 +5564,6 @@ private void InitializeComponent() this.pnlButtonBox_antenna_toggles.SuspendLayout(); this.tabPage8.SuspendLayout(); this.grpLedIndicator.SuspendLayout(); - this.tabPage9.SuspendLayout(); - this.grpMeterItemDataOutNode.SuspendLayout(); this.tabPage10.SuspendLayout(); this.grpMeterItemVfoDisplaySettings.SuspendLayout(); this.tabPage11.SuspendLayout(); @@ -5528,6 +5579,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.nudMeterItem_custom_high)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudMeterItem_custom_max)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudMeterItem_custom_min)).BeginInit(); + this.grpMeterItemDataOutNode.SuspendLayout(); this.grpDiagInfo.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTS5)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTS7)).BeginInit(); @@ -8514,6 +8566,7 @@ private void InitializeComponent() this.comboRadioModel.FormattingEnabled = true; this.comboRadioModel.Items.AddRange(new object[] { "HERMES", + "HERMES LITE", "ANAN-10", "ANAN-10E", "ANAN-100", @@ -8559,6 +8612,7 @@ private void InitializeComponent() // this.pnlAlexApollo.AutoScrollMargin = new System.Drawing.Size(0, 0); this.pnlAlexApollo.AutoScrollMinSize = new System.Drawing.Size(0, 0); + this.pnlAlexApollo.Controls.Add(this.chkHL2IOBoardPresent); this.pnlAlexApollo.Controls.Add(this.chkAlexPresent); this.pnlAlexApollo.Controls.Add(this.chkApolloPresent); this.pnlAlexApollo.Location = new System.Drawing.Point(5, 136); @@ -8566,6 +8620,21 @@ private void InitializeComponent() this.pnlAlexApollo.Size = new System.Drawing.Size(149, 44); this.pnlAlexApollo.TabIndex = 112; // + // chkHL2IOBoardPresent + // + this.chkHL2IOBoardPresent.AutoSize = true; + this.chkHL2IOBoardPresent.Enabled = false; + this.chkHL2IOBoardPresent.Image = null; + this.chkHL2IOBoardPresent.Location = new System.Drawing.Point(4, 23); + this.chkHL2IOBoardPresent.Name = "chkHL2IOBoardPresent"; + this.chkHL2IOBoardPresent.Size = new System.Drawing.Size(96, 17); + this.chkHL2IOBoardPresent.TabIndex = 8; + this.chkHL2IOBoardPresent.Text = "HL2 I/O Board"; + this.toolTip1.SetToolTip(this.chkHL2IOBoardPresent, "Thetis power cycle is required if the I/O board is re-enabled."); + this.chkHL2IOBoardPresent.UseVisualStyleBackColor = true; + this.chkHL2IOBoardPresent.Visible = false; + this.chkHL2IOBoardPresent.CheckedChanged += new System.EventHandler(this.chkHL2IOBoardPresent_CheckedChanged); + // // chkAlexPresent // this.chkAlexPresent.AutoSize = true; @@ -8811,6 +8880,7 @@ private void InitializeComponent() this.tcOptions.Controls.Add(this.tpOptions1); this.tcOptions.Controls.Add(this.tpOptions2); this.tcOptions.Controls.Add(this.tpOptions3); + this.tcOptions.Controls.Add(this.tpHL2Options); this.tcOptions.Controls.Add(this.tpOptionsStartUp); this.tcOptions.Dock = System.Windows.Forms.DockStyle.Fill; this.tcOptions.Location = new System.Drawing.Point(0, 0); @@ -9332,7 +9402,7 @@ private void InitializeComponent() 0, 0, 0}); - this.udHermesStepAttenuatorData.Location = new System.Drawing.Point(107, 24); + this.udHermesStepAttenuatorData.Location = new System.Drawing.Point(106, 21); this.udHermesStepAttenuatorData.Maximum = new decimal(new int[] { 31, 0, @@ -10999,6 +11069,653 @@ private void InitializeComponent() this.chkVFOsync_freq.UseVisualStyleBackColor = true; this.chkVFOsync_freq.CheckedChanged += new System.EventHandler(this.chkVFOsync_settings_changed); // + // tpHL2Options + // + this.tpHL2Options.BackColor = System.Drawing.SystemColors.Control; + this.tpHL2Options.Controls.Add(this.groupBoxHL2RXOptions); + this.tpHL2Options.Controls.Add(this.groupBoxI2CControl); + this.tpHL2Options.Controls.Add(this.chkI2CEnable); + this.tpHL2Options.Controls.Add(this.grpIOPinState); + this.tpHL2Options.Location = new System.Drawing.Point(4, 22); + this.tpHL2Options.Name = "tpHL2Options"; + this.tpHL2Options.Size = new System.Drawing.Size(716, 384); + this.tpHL2Options.TabIndex = 1; + this.tpHL2Options.Text = "HL2 Options"; + this.tpHL2Options.Enter += new System.EventHandler(this.ucOutPinsLedStripHF_Click); + // + // groupBoxHL2RXOptions + // + this.groupBoxHL2RXOptions.Controls.Add(this.chkSwapAudioChannels); + this.groupBoxHL2RXOptions.Controls.Add(this.labelCl2Freq); + this.groupBoxHL2RXOptions.Controls.Add(this.udCl2Freq); + this.groupBoxHL2RXOptions.Controls.Add(this.chkCl2Enable); + this.groupBoxHL2RXOptions.Controls.Add(this.chkExt10MHz); + this.groupBoxHL2RXOptions.Controls.Add(this.chkDisconnectReset); + this.groupBoxHL2RXOptions.Controls.Add(this.labelPttHang); + this.groupBoxHL2RXOptions.Controls.Add(this.labelTxLatency); + this.groupBoxHL2RXOptions.Controls.Add(this.udPTTHang); + this.groupBoxHL2RXOptions.Controls.Add(this.udTxBufferLat); + this.groupBoxHL2RXOptions.Controls.Add(this.chkHL2PsSync); + this.groupBoxHL2RXOptions.Controls.Add(this.chkHL2BandVolts); + this.groupBoxHL2RXOptions.Location = new System.Drawing.Point(12, 15); + this.groupBoxHL2RXOptions.Name = "groupBoxHL2RXOptions"; + this.groupBoxHL2RXOptions.Size = new System.Drawing.Size(236, 170); + this.groupBoxHL2RXOptions.TabIndex = 3; + this.groupBoxHL2RXOptions.TabStop = false; + this.groupBoxHL2RXOptions.Text = "Hermes Lite Options"; + // + // chkSwapAudioChannels + // + this.chkSwapAudioChannels.CheckAlign = System.Drawing.ContentAlignment.MiddleRight; + this.chkSwapAudioChannels.Image = null; + this.chkSwapAudioChannels.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.chkSwapAudioChannels.Location = new System.Drawing.Point(8, 145); + this.chkSwapAudioChannels.Name = "chkSwapAudioChannels"; + this.chkSwapAudioChannels.RightToLeft = System.Windows.Forms.RightToLeft.Yes; + this.chkSwapAudioChannels.Size = new System.Drawing.Size(143, 20); + this.chkSwapAudioChannels.TabIndex = 185; + this.chkSwapAudioChannels.Text = "Swap Audio Channels"; + this.chkSwapAudioChannels.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.toolTip1.SetToolTip(this.chkSwapAudioChannels, "Swap the audio channels sent ot the HL2"); + this.chkSwapAudioChannels.UseVisualStyleBackColor = true; + this.chkSwapAudioChannels.CheckedChanged += new System.EventHandler(this.chkSwapAudioChannels_CheckedChanged); + // + // labelCl2Freq + // + this.labelCl2Freq.BackColor = System.Drawing.SystemColors.Control; + this.labelCl2Freq.Image = null; + this.labelCl2Freq.Location = new System.Drawing.Point(157, 121); + this.labelCl2Freq.Name = "labelCl2Freq"; + this.labelCl2Freq.Size = new System.Drawing.Size(36, 16); + this.labelCl2Freq.TabIndex = 200; + this.labelCl2Freq.Text = "MHz"; + // + // udCl2Freq + // + this.udCl2Freq.DecimalPlaces = 3; + this.udCl2Freq.ImeMode = System.Windows.Forms.ImeMode.Off; + this.udCl2Freq.Increment = new decimal(new int[] { + 1, + 0, + 0, + 65536}); + this.udCl2Freq.Location = new System.Drawing.Point(89, 119); + this.udCl2Freq.Maximum = new decimal(new int[] { + 200, + 0, + 0, + 0}); + this.udCl2Freq.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.udCl2Freq.Name = "udCl2Freq"; + this.udCl2Freq.Size = new System.Drawing.Size(62, 20); + this.udCl2Freq.TabIndex = 199; + this.udCl2Freq.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.udCl2Freq.TinyStep = false; + this.toolTip1.SetToolTip(this.udCl2Freq, "Output frequency on CL2 output"); + this.udCl2Freq.Value = new decimal(new int[] { + 116, + 0, + 0, + 0}); + this.udCl2Freq.ValueChanged += new System.EventHandler(this.udCl2Freq_ValueChanged); + // + // chkCl2Enable + // + this.chkCl2Enable.Image = null; + this.chkCl2Enable.Location = new System.Drawing.Point(8, 120); + this.chkCl2Enable.Name = "chkCl2Enable"; + this.chkCl2Enable.Size = new System.Drawing.Size(88, 16); + this.chkCl2Enable.TabIndex = 10; + this.chkCl2Enable.Text = "Enable CL2"; + this.toolTip1.SetToolTip(this.chkCl2Enable, "Enable frequency output on CL2"); + this.chkCl2Enable.UseVisualStyleBackColor = true; + this.chkCl2Enable.CheckedChanged += new System.EventHandler(this.chkCl2Enable_CheckedChanged); + // + // chkExt10MHz + // + this.chkExt10MHz.Image = null; + this.chkExt10MHz.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.chkExt10MHz.Location = new System.Drawing.Point(8, 93); + this.chkExt10MHz.Name = "chkExt10MHz"; + this.chkExt10MHz.Size = new System.Drawing.Size(141, 16); + this.chkExt10MHz.TabIndex = 9; + this.chkExt10MHz.Text = "Ext 10MHz (CL1 Input)"; + this.toolTip1.SetToolTip(this.chkExt10MHz, "Enable external 10MHz input on CL1"); + this.chkExt10MHz.UseVisualStyleBackColor = true; + this.chkExt10MHz.CheckedChanged += new System.EventHandler(this.chkExt10MHz_CheckedChanged); + // + // chkDisconnectReset + // + this.chkDisconnectReset.CheckAlign = System.Drawing.ContentAlignment.MiddleRight; + this.chkDisconnectReset.Image = null; + this.chkDisconnectReset.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.chkDisconnectReset.Location = new System.Drawing.Point(8, 67); + this.chkDisconnectReset.Name = "chkDisconnectReset"; + this.chkDisconnectReset.RightToLeft = System.Windows.Forms.RightToLeft.Yes; + this.chkDisconnectReset.Size = new System.Drawing.Size(143, 20); + this.chkDisconnectReset.TabIndex = 8; + this.chkDisconnectReset.Text = "Reset On Disconnect"; + this.chkDisconnectReset.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.toolTip1.SetToolTip(this.chkDisconnectReset, "Hermes Lite will reset when a software program disconnect from it."); + this.chkDisconnectReset.UseVisualStyleBackColor = true; + this.chkDisconnectReset.CheckedChanged += new System.EventHandler(this.chkDisconnectReset_CheckedChanged); + // + // labelPttHang + // + this.labelPttHang.Image = null; + this.labelPttHang.Location = new System.Drawing.Point(116, 42); + this.labelPttHang.Name = "labelPttHang"; + this.labelPttHang.Size = new System.Drawing.Size(58, 20); + this.labelPttHang.TabIndex = 7; + this.labelPttHang.Text = "PTT Hang"; + this.labelPttHang.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // labelTxLatency + // + this.labelTxLatency.Image = null; + this.labelTxLatency.Location = new System.Drawing.Point(104, 19); + this.labelTxLatency.Name = "labelTxLatency"; + this.labelTxLatency.Size = new System.Drawing.Size(70, 16); + this.labelTxLatency.TabIndex = 6; + this.labelTxLatency.Text = "TX Latency"; + this.labelTxLatency.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // udPTTHang + // + this.udPTTHang.Increment = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.udPTTHang.Location = new System.Drawing.Point(180, 44); + this.udPTTHang.Maximum = new decimal(new int[] { + 30, + 0, + 0, + 0}); + this.udPTTHang.Minimum = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.udPTTHang.Name = "udPTTHang"; + this.udPTTHang.Size = new System.Drawing.Size(46, 20); + this.udPTTHang.TabIndex = 5; + this.udPTTHang.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.udPTTHang.TinyStep = false; + this.toolTip1.SetToolTip(this.udPTTHang, "Sets the msec delay in the HL2 hardware before the PTT is release after RF stops." + + ""); + this.udPTTHang.Value = new decimal(new int[] { + 12, + 0, + 0, + 0}); + this.udPTTHang.ValueChanged += new System.EventHandler(this.udPTTHang_ValueChanged); + // + // udTxBufferLat + // + this.udTxBufferLat.Increment = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.udTxBufferLat.Location = new System.Drawing.Point(180, 19); + this.udTxBufferLat.Maximum = new decimal(new int[] { + 70, + 0, + 0, + 0}); + this.udTxBufferLat.Minimum = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.udTxBufferLat.Name = "udTxBufferLat"; + this.udTxBufferLat.Size = new System.Drawing.Size(46, 20); + this.udTxBufferLat.TabIndex = 4; + this.udTxBufferLat.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.udTxBufferLat.TinyStep = false; + this.toolTip1.SetToolTip(this.udTxBufferLat, "Sets msec delay in the HL2 hardware before RF is produced."); + this.udTxBufferLat.Value = new decimal(new int[] { + 20, + 0, + 0, + 0}); + this.udTxBufferLat.ValueChanged += new System.EventHandler(this.udTxBufferLat_ValueChanged); + // + // chkHL2PsSync + // + this.chkHL2PsSync.Image = null; + this.chkHL2PsSync.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.chkHL2PsSync.Location = new System.Drawing.Point(8, 45); + this.chkHL2PsSync.Name = "chkHL2PsSync"; + this.chkHL2PsSync.Size = new System.Drawing.Size(112, 16); + this.chkHL2PsSync.TabIndex = 1; + this.chkHL2PsSync.Text = "Disable PS Sync"; + this.toolTip1.SetToolTip(this.chkHL2PsSync, "Disables the FPGA synchronisation of the power supply clock"); + this.chkHL2PsSync.UseVisualStyleBackColor = true; + this.chkHL2PsSync.CheckedChanged += new System.EventHandler(this.chkHL2PsSync_CheckedChanged); + // + // chkHL2BandVolts + // + this.chkHL2BandVolts.Image = null; + this.chkHL2BandVolts.Location = new System.Drawing.Point(8, 19); + this.chkHL2BandVolts.Name = "chkHL2BandVolts"; + this.chkHL2BandVolts.Size = new System.Drawing.Size(104, 16); + this.chkHL2BandVolts.TabIndex = 0; + this.chkHL2BandVolts.Text = "Band Volts"; + this.toolTip1.SetToolTip(this.chkHL2BandVolts, "Selects Band Volts PWM output instead of Fan Control PWM"); + this.chkHL2BandVolts.UseVisualStyleBackColor = true; + this.chkHL2BandVolts.CheckedChanged += new System.EventHandler(this.chkHL2BandVolts_CheckedChanged); + // + // groupBoxI2CControl + // + this.groupBoxI2CControl.Controls.Add(this.txtI2CByte1); + this.groupBoxI2CControl.Controls.Add(this.txtI2CByte2); + this.groupBoxI2CControl.Controls.Add(this.chkI2CWriteEnable); + this.groupBoxI2CControl.Controls.Add(this.udI2CControl1); + this.groupBoxI2CControl.Controls.Add(this.txtI2CByte3); + this.groupBoxI2CControl.Controls.Add(this.labelI2C2); + this.groupBoxI2CControl.Controls.Add(this.labelI2C1); + this.groupBoxI2CControl.Controls.Add(this.radI2C2); + this.groupBoxI2CControl.Controls.Add(this.radI2C1); + this.groupBoxI2CControl.Controls.Add(this.txtI2CByte0); + this.groupBoxI2CControl.Controls.Add(this.btnI2CWrite); + this.groupBoxI2CControl.Controls.Add(this.labelI2CWriteData); + this.groupBoxI2CControl.Controls.Add(this.udI2CWriteData); + this.groupBoxI2CControl.Controls.Add(this.labelI2CControl); + this.groupBoxI2CControl.Controls.Add(this.udI2CControl0); + this.groupBoxI2CControl.Controls.Add(this.btnI2CRead); + this.groupBoxI2CControl.Controls.Add(this.labelI2CAddress); + this.groupBoxI2CControl.Controls.Add(this.udI2CAddress); + this.groupBoxI2CControl.Enabled = false; + this.groupBoxI2CControl.Location = new System.Drawing.Point(419, 252); + this.groupBoxI2CControl.Name = "groupBoxI2CControl"; + this.groupBoxI2CControl.Size = new System.Drawing.Size(282, 123); + this.groupBoxI2CControl.TabIndex = 183; + this.groupBoxI2CControl.TabStop = false; + this.groupBoxI2CControl.Text = "I2C Control"; + // + // txtI2CByte1 + // + this.txtI2CByte1.BackColor = System.Drawing.Color.White; + this.txtI2CByte1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); + this.txtI2CByte1.ForeColor = System.Drawing.Color.Black; + this.txtI2CByte1.Location = new System.Drawing.Point(215, 64); + this.txtI2CByte1.Name = "txtI2CByte1"; + this.txtI2CByte1.ReadOnly = true; + this.txtI2CByte1.Size = new System.Drawing.Size(25, 20); + this.txtI2CByte1.TabIndex = 200; + this.txtI2CByte1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.toolTip1.SetToolTip(this.txtI2CByte1, "Data at address+1 set by I2C Reg/Control"); + // + // txtI2CByte2 + // + this.txtI2CByte2.BackColor = System.Drawing.Color.White; + this.txtI2CByte2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); + this.txtI2CByte2.ForeColor = System.Drawing.Color.Black; + this.txtI2CByte2.Location = new System.Drawing.Point(184, 64); + this.txtI2CByte2.Name = "txtI2CByte2"; + this.txtI2CByte2.ReadOnly = true; + this.txtI2CByte2.Size = new System.Drawing.Size(25, 20); + this.txtI2CByte2.TabIndex = 199; + this.txtI2CByte2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.toolTip1.SetToolTip(this.txtI2CByte2, "Data at address+2 set by I2C Reg/Control"); + // + // chkI2CWriteEnable + // + this.chkI2CWriteEnable.AutoSize = true; + this.chkI2CWriteEnable.Image = null; + this.chkI2CWriteEnable.Location = new System.Drawing.Point(256, 93); + this.chkI2CWriteEnable.Name = "chkI2CWriteEnable"; + this.chkI2CWriteEnable.Size = new System.Drawing.Size(15, 14); + this.chkI2CWriteEnable.TabIndex = 198; + this.chkI2CWriteEnable.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.toolTip1.SetToolTip(this.chkI2CWriteEnable, "Write Enable"); + this.chkI2CWriteEnable.UseVisualStyleBackColor = true; + this.chkI2CWriteEnable.CheckedChanged += new System.EventHandler(this.chkI2CWriteEnable_CheckedChanged); + // + // udI2CControl1 + // + this.udI2CControl1.Hexadecimal = true; + this.udI2CControl1.Increment = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.udI2CControl1.Location = new System.Drawing.Point(84, 64); + this.udI2CControl1.Maximum = new decimal(new int[] { + 15, + 0, + 0, + 0}); + this.udI2CControl1.Minimum = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.udI2CControl1.Name = "udI2CControl1"; + this.udI2CControl1.Size = new System.Drawing.Size(30, 20); + this.udI2CControl1.TabIndex = 188; + this.udI2CControl1.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.udI2CControl1.TinyStep = false; + this.toolTip1.SetToolTip(this.udI2CControl1, "Upper nibble of Register/Control byte"); + this.udI2CControl1.Value = new decimal(new int[] { + 15, + 0, + 0, + 0}); + // + // txtI2CByte3 + // + this.txtI2CByte3.BackColor = System.Drawing.Color.White; + this.txtI2CByte3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); + this.txtI2CByte3.ForeColor = System.Drawing.Color.Black; + this.txtI2CByte3.Location = new System.Drawing.Point(153, 64); + this.txtI2CByte3.Name = "txtI2CByte3"; + this.txtI2CByte3.ReadOnly = true; + this.txtI2CByte3.Size = new System.Drawing.Size(25, 20); + this.txtI2CByte3.TabIndex = 196; + this.txtI2CByte3.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.toolTip1.SetToolTip(this.txtI2CByte3, "Data at address+3 set by I2C Reg/Control"); + // + // labelI2C2 + // + this.labelI2C2.Image = null; + this.labelI2C2.Location = new System.Drawing.Point(135, 16); + this.labelI2C2.Name = "labelI2C2"; + this.labelI2C2.Size = new System.Drawing.Size(32, 16); + this.labelI2C2.TabIndex = 195; + this.labelI2C2.Text = "I2C 2"; + this.labelI2C2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // labelI2C1 + // + this.labelI2C1.Image = null; + this.labelI2C1.Location = new System.Drawing.Point(74, 16); + this.labelI2C1.Name = "labelI2C1"; + this.labelI2C1.Size = new System.Drawing.Size(37, 16); + this.labelI2C1.TabIndex = 194; + this.labelI2C1.Text = "I2C 1"; + this.labelI2C1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // radI2C2 + // + this.radI2C2.Image = null; + this.radI2C2.Location = new System.Drawing.Point(169, 17); + this.radI2C2.Name = "radI2C2"; + this.radI2C2.Size = new System.Drawing.Size(16, 16); + this.radI2C2.TabIndex = 193; + this.radI2C2.TextAlign = System.Drawing.ContentAlignment.BottomRight; + this.toolTip1.SetToolTip(this.radI2C2, "Selects bus 2"); + this.radI2C2.UseVisualStyleBackColor = true; + // + // radI2C1 + // + this.radI2C1.Checked = true; + this.radI2C1.Image = null; + this.radI2C1.Location = new System.Drawing.Point(113, 17); + this.radI2C1.Name = "radI2C1"; + this.radI2C1.Size = new System.Drawing.Size(16, 16); + this.radI2C1.TabIndex = 192; + this.radI2C1.TabStop = true; + this.radI2C1.TextAlign = System.Drawing.ContentAlignment.BottomRight; + this.toolTip1.SetToolTip(this.radI2C1, "Selects bus 1"); + this.radI2C1.UseVisualStyleBackColor = true; + // + // txtI2CByte0 + // + this.txtI2CByte0.BackColor = System.Drawing.Color.White; + this.txtI2CByte0.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); + this.txtI2CByte0.ForeColor = System.Drawing.Color.Black; + this.txtI2CByte0.Location = new System.Drawing.Point(246, 64); + this.txtI2CByte0.Name = "txtI2CByte0"; + this.txtI2CByte0.ReadOnly = true; + this.txtI2CByte0.Size = new System.Drawing.Size(25, 20); + this.txtI2CByte0.TabIndex = 185; + this.txtI2CByte0.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.toolTip1.SetToolTip(this.txtI2CByte0, "Data at address set by I2C Reg/Control"); + // + // btnI2CWrite + // + this.btnI2CWrite.Enabled = false; + this.btnI2CWrite.Image = null; + this.btnI2CWrite.Location = new System.Drawing.Point(165, 90); + this.btnI2CWrite.Name = "btnI2CWrite"; + this.btnI2CWrite.Selectable = true; + this.btnI2CWrite.Size = new System.Drawing.Size(75, 20); + this.btnI2CWrite.TabIndex = 191; + this.btnI2CWrite.Text = "Write"; + this.toolTip1.SetToolTip(this.btnI2CWrite, "Write byte to address given by Reg/Control"); + this.btnI2CWrite.MouseDown += new System.Windows.Forms.MouseEventHandler(this.btnI2CWrite_MouseDown); + // + // labelI2CWriteData + // + this.labelI2CWriteData.Enabled = false; + this.labelI2CWriteData.Image = null; + this.labelI2CWriteData.Location = new System.Drawing.Point(8, 90); + this.labelI2CWriteData.Name = "labelI2CWriteData"; + this.labelI2CWriteData.Size = new System.Drawing.Size(70, 16); + this.labelI2CWriteData.TabIndex = 190; + this.labelI2CWriteData.Text = "Write Data"; + this.labelI2CWriteData.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // udI2CWriteData + // + this.udI2CWriteData.Enabled = false; + this.udI2CWriteData.Hexadecimal = true; + this.udI2CWriteData.Increment = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.udI2CWriteData.Location = new System.Drawing.Point(84, 90); + this.udI2CWriteData.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.udI2CWriteData.Minimum = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.udI2CWriteData.Name = "udI2CWriteData"; + this.udI2CWriteData.Size = new System.Drawing.Size(59, 20); + this.udI2CWriteData.TabIndex = 189; + this.udI2CWriteData.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.udI2CWriteData.TinyStep = false; + this.toolTip1.SetToolTip(this.udI2CWriteData, "Byte to be written to the I2C bus"); + this.udI2CWriteData.Value = new decimal(new int[] { + 20, + 0, + 0, + 0}); + // + // labelI2CControl + // + this.labelI2CControl.Image = null; + this.labelI2CControl.Location = new System.Drawing.Point(10, 64); + this.labelI2CControl.Name = "labelI2CControl"; + this.labelI2CControl.Size = new System.Drawing.Size(70, 16); + this.labelI2CControl.TabIndex = 188; + this.labelI2CControl.Text = "Reg/Control"; + this.labelI2CControl.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // udI2CControl0 + // + this.udI2CControl0.Hexadecimal = true; + this.udI2CControl0.Increment = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.udI2CControl0.Location = new System.Drawing.Point(113, 64); + this.udI2CControl0.Maximum = new decimal(new int[] { + 15, + 0, + 0, + 0}); + this.udI2CControl0.Minimum = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.udI2CControl0.Name = "udI2CControl0"; + this.udI2CControl0.Size = new System.Drawing.Size(30, 20); + this.udI2CControl0.TabIndex = 187; + this.udI2CControl0.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.udI2CControl0.TinyStep = false; + this.toolTip1.SetToolTip(this.udI2CControl0, "Lower nibble of Register/Control byte"); + this.udI2CControl0.Value = new decimal(new int[] { + 15, + 0, + 0, + 0}); + // + // btnI2CRead + // + this.btnI2CRead.Image = null; + this.btnI2CRead.Location = new System.Drawing.Point(165, 38); + this.btnI2CRead.Name = "btnI2CRead"; + this.btnI2CRead.Selectable = true; + this.btnI2CRead.Size = new System.Drawing.Size(75, 20); + this.btnI2CRead.TabIndex = 186; + this.btnI2CRead.Text = "Read"; + this.toolTip1.SetToolTip(this.btnI2CRead, "Read two bytes from the I2C bus"); + this.btnI2CRead.MouseDown += new System.Windows.Forms.MouseEventHandler(this.btnI2CRead_MouseDown); + // + // labelI2CAddress + // + this.labelI2CAddress.Image = null; + this.labelI2CAddress.Location = new System.Drawing.Point(13, 38); + this.labelI2CAddress.Name = "labelI2CAddress"; + this.labelI2CAddress.Size = new System.Drawing.Size(70, 16); + this.labelI2CAddress.TabIndex = 184; + this.labelI2CAddress.Text = "I2C Address"; + this.labelI2CAddress.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // udI2CAddress + // + this.udI2CAddress.Hexadecimal = true; + this.udI2CAddress.Increment = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.udI2CAddress.Location = new System.Drawing.Point(84, 38); + this.udI2CAddress.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.udI2CAddress.Minimum = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.udI2CAddress.Name = "udI2CAddress"; + this.udI2CAddress.Size = new System.Drawing.Size(59, 20); + this.udI2CAddress.TabIndex = 183; + this.udI2CAddress.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.udI2CAddress.TinyStep = false; + this.toolTip1.SetToolTip(this.udI2CAddress, "Device address on the I2C bus"); + this.udI2CAddress.Value = new decimal(new int[] { + 212, + 0, + 0, + 0}); + // + // chkI2CEnable + // + this.chkI2CEnable.CheckAlign = System.Drawing.ContentAlignment.MiddleRight; + this.chkI2CEnable.Image = null; + this.chkI2CEnable.Location = new System.Drawing.Point(557, 228); + this.chkI2CEnable.Name = "chkI2CEnable"; + this.chkI2CEnable.Size = new System.Drawing.Size(144, 18); + this.chkI2CEnable.TabIndex = 184; + this.chkI2CEnable.Text = "Enable I2C control"; + this.chkI2CEnable.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.chkI2CEnable.UseVisualStyleBackColor = true; + this.chkI2CEnable.CheckedChanged += new System.EventHandler(this.chkI2CEnable_CheckedChanged); + // + // grpIOPinState + // + this.grpIOPinState.Controls.Add(this.chkIOPinControl); + this.grpIOPinState.Controls.Add(this.labelOutState); + this.grpIOPinState.Controls.Add(this.ucOutPinsLedStripHF); + this.grpIOPinState.Controls.Add(this.labelIOState); + this.grpIOPinState.Controls.Add(this.ucIOPinsLedStripHF); + this.grpIOPinState.Enabled = false; + this.grpIOPinState.Location = new System.Drawing.Point(12, 229); + this.grpIOPinState.Name = "grpIOPinState"; + this.grpIOPinState.Size = new System.Drawing.Size(236, 122); + this.grpIOPinState.TabIndex = 16; + this.grpIOPinState.TabStop = false; + this.grpIOPinState.Text = "I/O Board Pin States"; + this.grpIOPinState.Visible = false; + // + // chkIOPinControl + // + this.chkIOPinControl.AutoSize = true; + this.chkIOPinControl.Image = null; + this.chkIOPinControl.Location = new System.Drawing.Point(149, 79); + this.chkIOPinControl.Name = "chkIOPinControl"; + this.chkIOPinControl.Size = new System.Drawing.Size(77, 17); + this.chkIOPinControl.TabIndex = 12; + this.chkIOPinControl.Text = "Pin Control"; + this.toolTip1.SetToolTip(this.chkIOPinControl, "Allows the state of the I/O pins to be toggled by clicking on display box"); + // + // labelOutState + // + this.labelOutState.BackColor = System.Drawing.SystemColors.Control; + this.labelOutState.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.labelOutState.Image = null; + this.labelOutState.Location = new System.Drawing.Point(9, 60); + this.labelOutState.Name = "labelOutState"; + this.labelOutState.Size = new System.Drawing.Size(140, 16); + this.labelOutState.TabIndex = 203; + this.labelOutState.Text = "o0 o1 o2 o3 o4 o5 o6 o7"; + // + // ucOutPinsLedStripHF + // + this.ucOutPinsLedStripHF.Bits = 0; + this.ucOutPinsLedStripHF.DisplayBits = 8; + this.ucOutPinsLedStripHF.Location = new System.Drawing.Point(9, 79); + this.ucOutPinsLedStripHF.Name = "ucOutPinsLedStripHF"; + this.ucOutPinsLedStripHF.Size = new System.Drawing.Size(134, 17); + this.ucOutPinsLedStripHF.TabIndex = 202; + this.toolTip1.SetToolTip(this.ucOutPinsLedStripHF, "Display and control of the I/O Board\'s output port"); + this.ucOutPinsLedStripHF.TX = false; + this.ucOutPinsLedStripHF.Click += new System.EventHandler(this.ucOutPinsLedStripHF_Click); + this.ucOutPinsLedStripHF.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ucOutPinsLedStripHF_MouseDown); + // + // labelIOState + // + this.labelIOState.BackColor = System.Drawing.SystemColors.Control; + this.labelIOState.Image = null; + this.labelIOState.Location = new System.Drawing.Point(9, 16); + this.labelIOState.Name = "labelIOState"; + this.labelIOState.Size = new System.Drawing.Size(116, 16); + this.labelIOState.TabIndex = 201; + this.labelIOState.Text = "Rx i1 i2 i3 i4 i5 "; + // + // ucIOPinsLedStripHF + // + this.ucIOPinsLedStripHF.Bits = 0; + this.ucIOPinsLedStripHF.DisplayBits = 6; + this.ucIOPinsLedStripHF.Enabled = false; + this.ucIOPinsLedStripHF.Location = new System.Drawing.Point(9, 33); + this.ucIOPinsLedStripHF.Name = "ucIOPinsLedStripHF"; + this.ucIOPinsLedStripHF.Size = new System.Drawing.Size(134, 17); + this.ucIOPinsLedStripHF.TabIndex = 1; + this.ucIOPinsLedStripHF.TX = false; + this.ucIOPinsLedStripHF.Visible = false; + // // tpOptionsStartUp // this.tpOptionsStartUp.BackColor = System.Drawing.SystemColors.Control; @@ -14115,6 +14832,7 @@ private void InitializeComponent() // ucOCPinsLedStripHF // this.ucOCPinsLedStripHF.Bits = 0; + this.ucOCPinsLedStripHF.DisplayBits = 7; this.ucOCPinsLedStripHF.Location = new System.Drawing.Point(9, 33); this.ucOCPinsLedStripHF.Margin = new System.Windows.Forms.Padding(4); this.ucOCPinsLedStripHF.Name = "ucOCPinsLedStripHF"; @@ -47249,10 +47967,10 @@ private void InitializeComponent() 0, 0}); this.udTXTunePower.Minimum = new decimal(new int[] { + 165, 0, 0, - 0, - 0}); + -2147418112}); this.udTXTunePower.Name = "udTXTunePower"; this.udTXTunePower.Size = new System.Drawing.Size(48, 20); this.udTXTunePower.TabIndex = 4; @@ -57806,6 +58524,7 @@ private void InitializeComponent() // // grpCatControlBox // + this.grpCatControlBox.Controls.Add(this.chkCATtoVFOB); this.grpCatControlBox.Controls.Add(this.comboCATPort); this.grpCatControlBox.Controls.Add(this.comboCATbaud); this.grpCatControlBox.Controls.Add(this.lblCATBaud); @@ -57824,6 +58543,19 @@ private void InitializeComponent() this.grpCatControlBox.TabStop = false; this.grpCatControlBox.Text = "CAT1 Control"; // + // chkCATtoVFOB + // + this.chkCATtoVFOB.Enabled = false; + this.chkCATtoVFOB.Image = null; + this.chkCATtoVFOB.Location = new System.Drawing.Point(101, 9); + this.chkCATtoVFOB.Name = "chkCATtoVFOB"; + this.chkCATtoVFOB.Size = new System.Drawing.Size(59, 18); + this.chkCATtoVFOB.TabIndex = 108; + this.chkCATtoVFOB.Text = "VFO B"; + this.toolTip1.SetToolTip(this.chkCATtoVFOB, "CAT command VFO A command changes VFO B"); + this.chkCATtoVFOB.Visible = false; + this.chkCATtoVFOB.CheckedChanged += new System.EventHandler(this.chkCATtoVFOB_CheckedChanged); + // // comboCATPort // this.comboCATPort.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; @@ -67565,7 +68297,6 @@ private void InitializeComponent() // // tabPage9 // - this.tabPage9.Controls.Add(this.grpMeterItemDataOutNode); this.tabPage9.Location = new System.Drawing.Point(4, 22); this.tabPage9.Name = "tabPage9"; this.tabPage9.Size = new System.Drawing.Size(726, 463); @@ -67573,51 +68304,6 @@ private void InitializeComponent() this.tabPage9.Text = "dataout"; this.tabPage9.UseVisualStyleBackColor = true; // - // grpMeterItemDataOutNode - // - this.grpMeterItemDataOutNode.Controls.Add(this.labelTS210); - this.grpMeterItemDataOutNode.Controls.Add(this.txtDataOutNode_4charID); - this.grpMeterItemDataOutNode.Controls.Add(this.labelTS217); - this.grpMeterItemDataOutNode.Controls.Add(this.nudDataOutNode_sendinterval); - this.grpMeterItemDataOutNode.Controls.Add(this.labelTS215); - this.grpMeterItemDataOutNode.Location = new System.Drawing.Point(12, 15); - this.grpMeterItemDataOutNode.Name = "grpMeterItemDataOutNode"; - this.grpMeterItemDataOutNode.Size = new System.Drawing.Size(323, 376); - this.grpMeterItemDataOutNode.TabIndex = 105; - this.grpMeterItemDataOutNode.TabStop = false; - this.grpMeterItemDataOutNode.Text = "Data Out Node"; - this.grpMeterItemDataOutNode.Visible = false; - // - // labelTS210 - // - this.labelTS210.AutoSize = true; - this.labelTS210.Image = null; - this.labelTS210.Location = new System.Drawing.Point(35, 51); - this.labelTS210.Name = "labelTS210"; - this.labelTS210.Size = new System.Drawing.Size(52, 13); - this.labelTS210.TabIndex = 137; - this.labelTS210.Text = "4Char ID:"; - // - // labelTS217 - // - this.labelTS217.AutoSize = true; - this.labelTS217.Image = null; - this.labelTS217.Location = new System.Drawing.Point(155, 24); - this.labelTS217.Name = "labelTS217"; - this.labelTS217.Size = new System.Drawing.Size(20, 13); - this.labelTS217.TabIndex = 135; - this.labelTS217.Text = "ms"; - // - // labelTS215 - // - this.labelTS215.AutoSize = true; - this.labelTS215.Image = null; - this.labelTS215.Location = new System.Drawing.Point(14, 25); - this.labelTS215.Name = "labelTS215"; - this.labelTS215.Size = new System.Drawing.Size(73, 13); - this.labelTS215.TabIndex = 131; - this.labelTS215.Text = "Send Interval:"; - // // tabPage10 // this.tabPage10.Controls.Add(this.grpMeterItemVfoDisplaySettings); @@ -69473,6 +70159,51 @@ private void InitializeComponent() this.tabPage15.Text = "blank"; this.tabPage15.UseVisualStyleBackColor = true; // + // grpMeterItemDataOutNode + // + this.grpMeterItemDataOutNode.Controls.Add(this.labelTS210); + this.grpMeterItemDataOutNode.Controls.Add(this.txtDataOutNode_4charID); + this.grpMeterItemDataOutNode.Controls.Add(this.labelTS217); + this.grpMeterItemDataOutNode.Controls.Add(this.nudDataOutNode_sendinterval); + this.grpMeterItemDataOutNode.Controls.Add(this.labelTS215); + this.grpMeterItemDataOutNode.Location = new System.Drawing.Point(12, 15); + this.grpMeterItemDataOutNode.Name = "grpMeterItemDataOutNode"; + this.grpMeterItemDataOutNode.Size = new System.Drawing.Size(323, 376); + this.grpMeterItemDataOutNode.TabIndex = 105; + this.grpMeterItemDataOutNode.TabStop = false; + this.grpMeterItemDataOutNode.Text = "Data Out Node"; + this.grpMeterItemDataOutNode.Visible = false; + // + // labelTS210 + // + this.labelTS210.AutoSize = true; + this.labelTS210.Image = null; + this.labelTS210.Location = new System.Drawing.Point(35, 51); + this.labelTS210.Name = "labelTS210"; + this.labelTS210.Size = new System.Drawing.Size(52, 13); + this.labelTS210.TabIndex = 137; + this.labelTS210.Text = "4Char ID:"; + // + // labelTS217 + // + this.labelTS217.AutoSize = true; + this.labelTS217.Image = null; + this.labelTS217.Location = new System.Drawing.Point(155, 24); + this.labelTS217.Name = "labelTS217"; + this.labelTS217.Size = new System.Drawing.Size(20, 13); + this.labelTS217.TabIndex = 135; + this.labelTS217.Text = "ms"; + // + // labelTS215 + // + this.labelTS215.AutoSize = true; + this.labelTS215.Image = null; + this.labelTS215.Location = new System.Drawing.Point(14, 25); + this.labelTS215.Name = "labelTS215"; + this.labelTS215.Size = new System.Drawing.Size(73, 13); + this.labelTS215.TabIndex = 131; + this.labelTS215.Text = "Send Interval:"; + // // tmrLedValid // this.tmrLedValid.Interval = 500; @@ -70568,6 +71299,7 @@ private void InitializeComponent() this.Controls.Add(this.btnCancel); this.Controls.Add(this.btnOK); this.Controls.Add(this.tcSetup); + this.Controls.Add(this.grpMeterItemDataOutNode); this.DoubleBuffered = true; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); @@ -70707,6 +71439,19 @@ private void InitializeComponent() this.groupBoxTS57.PerformLayout(); this.groupBoxTS58.ResumeLayout(false); this.groupBoxTS58.PerformLayout(); + this.tpHL2Options.ResumeLayout(false); + this.groupBoxHL2RXOptions.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.udCl2Freq)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.udPTTHang)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.udTxBufferLat)).EndInit(); + this.groupBoxI2CControl.ResumeLayout(false); + this.groupBoxI2CControl.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.udI2CControl1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.udI2CWriteData)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.udI2CControl0)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.udI2CAddress)).EndInit(); + this.grpIOPinState.ResumeLayout(false); + this.grpIOPinState.PerformLayout(); this.tpOptionsStartUp.ResumeLayout(false); this.groupBoxTS37.ResumeLayout(false); this.groupBoxTS37.PerformLayout(); @@ -71882,9 +72627,6 @@ private void InitializeComponent() this.tabPage8.ResumeLayout(false); this.grpLedIndicator.ResumeLayout(false); this.grpLedIndicator.PerformLayout(); - this.tabPage9.ResumeLayout(false); - this.grpMeterItemDataOutNode.ResumeLayout(false); - this.grpMeterItemDataOutNode.PerformLayout(); this.tabPage10.ResumeLayout(false); this.grpMeterItemVfoDisplaySettings.ResumeLayout(false); this.grpMeterItemVfoDisplaySettings.PerformLayout(); @@ -71907,6 +72649,8 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.nudMeterItem_custom_high)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nudMeterItem_custom_max)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nudMeterItem_custom_min)).EndInit(); + this.grpMeterItemDataOutNode.ResumeLayout(false); + this.grpMeterItemDataOutNode.PerformLayout(); this.grpDiagInfo.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTS5)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownTS7)).EndInit(); @@ -72161,6 +72905,7 @@ protected override void Dispose(bool disposing) private TabControl tcGeneral; private TabPage tpGeneralHardware; private TabPage tpGeneralOptions; + private TabPage tpHL2Options; private TabPage tpGeneralCalibration; private NumericUpDownTS udGeneralCalFreq1; private NumericUpDownTS udGeneralCalFreq2; @@ -72538,8 +73283,11 @@ protected override void Dispose(bool disposing) private LabelTS labelTS41; private CheckBoxTS chkPennyExtCtrl; private GroupBoxTS groupBoxRXOptions; + private GroupBoxTS groupBoxHL2RXOptions; private CheckBoxTS chkMercRandom; private CheckBoxTS chkMercDither; + private CheckBoxTS chkHL2PsSync; + private CheckBoxTS chkHL2BandVolts; private NumericUpDownTS udMaxFreq; private LabelTS labelTS57; private GroupBoxTS grpVersion; @@ -74624,6 +75372,7 @@ protected override void Dispose(bool disposing) private RadioButtonTS radP1DDC0ADC1; private RadioButtonTS radP1DDC0ADC0; private TabPage tpADC; + private CheckBoxTS chkCATtoVFOB; private CheckBoxTS checkEnableAriesQuickTune; private CheckBoxTS checkAriesStandalone; private CheckBoxTS chkAndrBandBtnDefault; @@ -74642,6 +75391,12 @@ protected override void Dispose(bool disposing) private LabelTS lblActiveSpectralPeakColour; private ucLGPicker lgLinearGradientRX1; public ColorButton clrbtnGripperColour; + private CheckBoxTS chkDisconnectReset; + private LabelTS labelPttHang; + private LabelTS labelTxLatency; + private NumericUpDownTS udPTTHang; + private NumericUpDownTS udTxBufferLat; + private GroupBoxTS groupBoxI2CControl; private ButtonTS btnDeleteColourGripper; private ButtonTS btnClearColourGrippers; private CheckBoxTS chkPanadpatorGradient; @@ -74666,6 +75421,26 @@ protected override void Dispose(bool disposing) private CheckBoxTS chkN1MMEnableRX1; private LabelTS labelTS91; private TrackBarTS tbRX1WaterfallOpacity; + private LabelTS labelI2CControl; + private NumericUpDownTS udI2CControl0; + private ButtonTS btnI2CRead; + public TextBoxTS txtI2CByte0; + private LabelTS labelI2CAddress; + private NumericUpDownTS udI2CAddress; + private ButtonTS btnI2CWrite; + private LabelTS labelI2CWriteData; + private NumericUpDownTS udI2CWriteData; + private LabelTS labelI2C2; + private LabelTS labelI2C1; + private RadioButtonTS radI2C2; + private RadioButtonTS radI2C1; + private NumericUpDownTS udI2CControl1; + public TextBoxTS txtI2CByte3; + private CheckBoxTS chkI2CWriteEnable; + private CheckBoxTS chkExt10MHz; + private CheckBoxTS chkCl2Enable; + private NumericUpDownTS udCl2Freq; + private LabelTS labelCl2Freq; private LabelTS labelTS92; private TrackBarTS tbRX2WaterfallOpacity; private NumericUpDownTS udHermesStepAttenuatorDataRX2; @@ -75269,8 +76044,14 @@ protected override void Dispose(bool disposing) private LabelTS lblMMHistoryIgnore; private ButtonTS btnMeterCopySettings; private ButtonTS btnMeterPasteSettings; + public TextBoxTS txtI2CByte2; + public TextBoxTS txtI2CByte1; + private CheckBoxTS chkI2CEnable; + private GroupBoxTS grpIOPinState; private GroupBoxTS groupBoxTS28; private LabelTS labelTS161; + private ucOCLedStrip ucIOPinsLedStripHF; + private CheckBoxTS chkHL2IOBoardPresent; private NumericUpDownTS udVSQLMuteTimeConstant; private LabelTS labelTS180; private NumericUpDownTS udVSQLUnMuteTimeConstant; @@ -75413,6 +76194,10 @@ protected override void Dispose(bool disposing) private RadioButtonTS radDSPNR2NSTATRX2; private RadioButtonTS radDSPNR2NSTAT; private NumericUpDownTS udDSPNR2trainThresh; + private LabelTS labelIOState; + private ucOCLedStrip ucOutPinsLedStripHF; + private LabelTS labelOutState; + private CheckBoxTS chkIOPinControl; private NumericUpDownTS udDSPNR2trainThreshRX2; private GroupBoxTS groupBoxTS34; private LabelTS labelTS160; @@ -76346,6 +77131,7 @@ protected override void Dispose(bool disposing) private CheckBoxTS chkRecording_playkeybind; private TextBoxTS txtRecording_playkeybind; private LabelTS labelTS653; + private CheckBoxTS chkSwapAudioChannels; private ScrollableControl scrollableControl2; private CheckBoxTS chkRecording_ignore_play_tempchanges; private LabelTS labelTS655; diff --git a/Project Files/Source/Console/splash.cs b/Project Files/Source/Console/splash.cs index 1e2a43c1..47a0e2bd 100644 --- a/Project Files/Source/Console/splash.cs +++ b/Project Files/Source/Console/splash.cs @@ -329,7 +329,7 @@ static public void SetReferencePoint() // ************ Private methods ************ private void setVersion(string version) { - lblVersion.Text = string.IsNullOrEmpty(version) ? "" : version.Left(16); + lblVersion.Text = string.IsNullOrEmpty(version) ? "" : version.Left(32); } private void setBackground(string splash_screen_folder) { diff --git a/Project Files/Source/Console/ucOCLedStrip.cs b/Project Files/Source/Console/ucOCLedStrip.cs index c93ebaec..7fffc6aa 100644 --- a/Project Files/Source/Console/ucOCLedStrip.cs +++ b/Project Files/Source/Console/ucOCLedStrip.cs @@ -77,11 +77,21 @@ public int Bits } } + private int m_displayBits = 7; + public int DisplayBits + { + get { return m_displayBits; } + set + { + m_displayBits = value; + } + } + private void usOCLedStrip_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; - for(int nPin = 0; nPin < 7; nPin++) + for(int nPin = 0; nPin < m_displayBits; nPin++) { int x = nPin * 16; diff --git a/Project Files/Source/Console/ucRadioList.cs b/Project Files/Source/Console/ucRadioList.cs index f0e44b69..6fb7c7ff 100644 --- a/Project Files/Source/Console/ucRadioList.cs +++ b/Project Files/Source/Console/ucRadioList.cs @@ -1967,6 +1967,12 @@ private string buildVersionText(RadioInfo radio) } break; + case HPSDRHW.HermesLite: + versionText = (radio.CodeVersion / 10.0f).ToString("F1"); + if (radio.BetaVersion > 0) + versionText += "." + radio.BetaVersion.ToString(); + break; + default: versionText = (radio.CodeVersion / 10.0f).ToString("F1", _nfi); if (radio.Protocol == RadioDiscoveryRadioProtocol.P2 && radio.BetaVersion > 0) diff --git a/Project Files/Source/Console/xvtr.cs b/Project Files/Source/Console/xvtr.cs index 51df436d..9338625f 100644 --- a/Project Files/Source/Console/xvtr.cs +++ b/Project Files/Source/Console/xvtr.cs @@ -679,7 +679,8 @@ private void InitializeComponent() "def", "1", "2", - "3"}); + "3", + "Alt Rx"}); this.comboAnt15.Location = new System.Drawing.Point(842, 407); this.comboAnt15.Name = "comboAnt15"; this.comboAnt15.Size = new System.Drawing.Size(52, 21); @@ -695,7 +696,8 @@ private void InitializeComponent() "def", "1", "2", - "3"}); + "3", + "Alt Rx"}); this.comboAnt14.Location = new System.Drawing.Point(842, 382); this.comboAnt14.Name = "comboAnt14"; this.comboAnt14.Size = new System.Drawing.Size(52, 21); @@ -711,7 +713,8 @@ private void InitializeComponent() "def", "1", "2", - "3"}); + "3", + "Alt Rx"}); this.comboAnt13.Location = new System.Drawing.Point(842, 358); this.comboAnt13.Name = "comboAnt13"; this.comboAnt13.Size = new System.Drawing.Size(52, 21); @@ -727,7 +730,8 @@ private void InitializeComponent() "def", "1", "2", - "3"}); + "3", + "Alt Rx"}); this.comboAnt12.Location = new System.Drawing.Point(842, 332); this.comboAnt12.Name = "comboAnt12"; this.comboAnt12.Size = new System.Drawing.Size(52, 21); @@ -743,7 +747,8 @@ private void InitializeComponent() "def", "1", "2", - "3"}); + "3", + "Alt Rx"}); this.comboAnt11.Location = new System.Drawing.Point(842, 307); this.comboAnt11.Name = "comboAnt11"; this.comboAnt11.Size = new System.Drawing.Size(52, 21); @@ -759,7 +764,8 @@ private void InitializeComponent() "def", "1", "2", - "3"}); + "3", + "Alt Rx"}); this.comboAnt10.Location = new System.Drawing.Point(842, 283); this.comboAnt10.Name = "comboAnt10"; this.comboAnt10.Size = new System.Drawing.Size(52, 21); @@ -775,7 +781,8 @@ private void InitializeComponent() "def", "1", "2", - "3"}); + "3", + "Alt Rx"}); this.comboAnt9.Location = new System.Drawing.Point(842, 259); this.comboAnt9.Name = "comboAnt9"; this.comboAnt9.Size = new System.Drawing.Size(52, 21); @@ -791,7 +798,8 @@ private void InitializeComponent() "def", "1", "2", - "3"}); + "3", + "Alt Rx"}); this.comboAnt8.Location = new System.Drawing.Point(842, 235); this.comboAnt8.Name = "comboAnt8"; this.comboAnt8.Size = new System.Drawing.Size(52, 21); @@ -807,7 +815,8 @@ private void InitializeComponent() "def", "1", "2", - "3"}); + "3", + "Alt Rx"}); this.comboAnt7.Location = new System.Drawing.Point(842, 211); this.comboAnt7.Name = "comboAnt7"; this.comboAnt7.Size = new System.Drawing.Size(52, 21); @@ -823,7 +832,8 @@ private void InitializeComponent() "def", "1", "2", - "3"}); + "3", + "Alt Rx"}); this.comboAnt6.Location = new System.Drawing.Point(842, 187); this.comboAnt6.Name = "comboAnt6"; this.comboAnt6.Size = new System.Drawing.Size(52, 21); @@ -839,7 +849,8 @@ private void InitializeComponent() "def", "1", "2", - "3"}); + "3", + "Alt Rx"}); this.comboAnt5.Location = new System.Drawing.Point(842, 163); this.comboAnt5.Name = "comboAnt5"; this.comboAnt5.Size = new System.Drawing.Size(52, 21); @@ -855,7 +866,8 @@ private void InitializeComponent() "def", "1", "2", - "3"}); + "3", + "Alt Rx"}); this.comboAnt4.Location = new System.Drawing.Point(842, 139); this.comboAnt4.Name = "comboAnt4"; this.comboAnt4.Size = new System.Drawing.Size(52, 21); @@ -871,7 +883,8 @@ private void InitializeComponent() "def", "1", "2", - "3"}); + "3", + "Alt Rx"}); this.comboAnt3.Location = new System.Drawing.Point(842, 115); this.comboAnt3.Name = "comboAnt3"; this.comboAnt3.Size = new System.Drawing.Size(52, 21); @@ -887,7 +900,8 @@ private void InitializeComponent() "def", "1", "2", - "3"}); + "3", + "Alt Rx"}); this.comboAnt2.Location = new System.Drawing.Point(842, 91); this.comboAnt2.Name = "comboAnt2"; this.comboAnt2.Size = new System.Drawing.Size(52, 21); @@ -903,7 +917,8 @@ private void InitializeComponent() "def", "1", "2", - "3"}); + "3", + "Alt Rx"}); this.comboAnt1.Location = new System.Drawing.Point(842, 67); this.comboAnt1.Name = "comboAnt1"; this.comboAnt1.Size = new System.Drawing.Size(52, 21); @@ -919,7 +934,8 @@ private void InitializeComponent() "def", "1", "2", - "3"}); + "3", + "Alt Rx"}); this.comboAnt0.Location = new System.Drawing.Point(842, 43); this.comboAnt0.Name = "comboAnt0"; this.comboAnt0.Size = new System.Drawing.Size(52, 21); @@ -5200,6 +5216,7 @@ private void InitializeComponent() this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "XVTRForm"; this.Text = "XVTR Setup"; + this.Activated += new System.EventHandler(this.XVTRForm_Activated); this.Closing += new System.ComponentModel.CancelEventHandler(this.XVTRForm_Closing); ((System.ComponentModel.ISupportInitialize)(this.udRXGain15)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.udRXGain14)).EndInit(); @@ -6031,5 +6048,53 @@ private void comboAnt0_SelectedIndexChanged(object sender, EventArgs e) console.VFOAFreq = console.VFOAFreq; } } + + private void XVTRForm_Activated(object sender, EventArgs e) + { + if (console.SetupForm.HL2IOBoardPresent == true) // MI0BOT: Make Alt rx option available only for the HL2 with I/O Board + { + if (!comboAnt0.Items.Contains("Alt Rx")) + { + comboAnt0.Items.Add("Alt Rx"); + comboAnt1.Items.Add("Alt Rx"); + comboAnt2.Items.Add("Alt Rx"); + comboAnt3.Items.Add("Alt Rx"); + comboAnt4.Items.Add("Alt Rx"); + comboAnt5.Items.Add("Alt Rx"); + comboAnt6.Items.Add("Alt Rx"); + comboAnt7.Items.Add("Alt Rx"); + comboAnt8.Items.Add("Alt Rx"); + comboAnt9.Items.Add("Alt Rx"); + comboAnt10.Items.Add("Alt Rx"); + comboAnt11.Items.Add("Alt Rx"); + comboAnt12.Items.Add("Alt Rx"); + comboAnt13.Items.Add("Alt Rx"); + comboAnt14.Items.Add("Alt Rx"); + comboAnt15.Items.Add("Alt Rx"); + } + } + else + { + if (comboAnt0.Items.Contains("Alt Rx")) + { + comboAnt0.Items.Remove("Alt Rx"); + comboAnt1.Items.Remove("Alt Rx"); + comboAnt2.Items.Remove("Alt Rx"); + comboAnt3.Items.Remove("Alt Rx"); + comboAnt4.Items.Remove("Alt Rx"); + comboAnt5.Items.Remove("Alt Rx"); + comboAnt6.Items.Remove("Alt Rx"); + comboAnt7.Items.Remove("Alt Rx"); + comboAnt8.Items.Remove("Alt Rx"); + comboAnt9.Items.Remove("Alt Rx"); + comboAnt10.Items.Remove("Alt Rx"); + comboAnt11.Items.Remove("Alt Rx"); + comboAnt12.Items.Remove("Alt Rx"); + comboAnt13.Items.Remove("Alt Rx"); + comboAnt14.Items.Remove("Alt Rx"); + comboAnt15.Items.Remove("Alt Rx"); + } + } + } } } diff --git a/Project Files/Source/Midi2Cat/Midi2Cat.Data/CatCmdDb.cs b/Project Files/Source/Midi2Cat/Midi2Cat.Data/CatCmdDb.cs index 075c5111..69504fbb 100644 --- a/Project Files/Source/Midi2Cat/Midi2Cat.Data/CatCmdDb.cs +++ b/Project Files/Source/Midi2Cat/Midi2Cat.Data/CatCmdDb.cs @@ -530,6 +530,10 @@ public enum CatCmd APFType_biquad = 315, [CatCommandAttribute("Toggle Wheel to VFOA/VFOB ", ControlType.Button)] //-W2PA Added a toggle between A/B for main wheel - ToggleVFOWheel = 700 + ToggleVFOWheel = 700, + [CatCommandAttribute("CWX Key ", ControlType.Button)] //MI0BOT: Added ability to key via MIDI + CWXKey = 800, + [CatCommandAttribute("CWX PTT ", ControlType.Button)] //MI0BOT: Added ability to PTT via MIDI + CWXPTT = 801 } }// namespace diff --git a/Project Files/Source/Thetis-Installer/Product.wxs b/Project Files/Source/Thetis-Installer/Product.wxs index bc694047..b440a7ee 100644 --- a/Project Files/Source/Thetis-Installer/Product.wxs +++ b/Project Files/Source/Thetis-Installer/Product.wxs @@ -8,15 +8,15 @@ - - - + + + - + @@ -65,6 +65,7 @@ + @@ -118,7 +119,7 @@ - + @@ -138,7 +139,7 @@ - + + + + + @@ -158,6 +169,13 @@ Target="[INSTALLFOLDER]Thetis.exe" WorkingDirectory="INSTALLFOLDER" /> +