From: c vw Date: Fri, 9 Aug 2019 14:52:57 +0000 (+0200) Subject: finalized antenna routing X-Git-Url: https://git.rkrishnan.org/Site/listings/$sch_link?a=commitdiff_plain;h=4e1f390817d49979cd8da5c4b79c83f85e73ad84;p=pihpsdr.git finalized antenna routing --- diff --git a/alex.h b/alex.h index fffd69f..14b3093 100644 --- a/alex.h +++ b/alex.h @@ -42,19 +42,14 @@ #define ALEX_RX_ANTENNA_XVTR 0x00000100 // route XVTR-in to RX1 (bit 8) #define ALEX_RX_ANTENNA_EXT1 0x00000200 // route EXT1 to RX1 (bit 9) #define ALEX_RX_ANTENNA_EXT2 0x00000400 // route EXT2 to RX1 (bit 10) -#define ALEX_RX_ANTENNA_BYPASS 0x00000800 // connect BYPASS to RX1 (bit 11) +#define ALEX_RX_ANTENNA_BYPASS 0x00000800 // activate BYPASS (bit 11) +#define ANAN7000_RX_SELECT 0x00004000 // Master RX select (bit 14) #define ALEX_TX_ANTENNA_1 0x01000000 // route TX to ANT1 #define ALEX_TX_ANTENNA_2 0x02000000 // route TX to ANT2 #define ALEX_TX_ANTENNA_3 0x04000000 // route TX to ANT3 // -// Anan-7000 in contrast to ANAN-8000 has the TX relays in series (not parallel) -// -#define ANAN7000_TX_ANTENNA_1 0x00000000 // K8 off, K11 off, K14 off -#define ANAN7000_TX_ANTENNA_2 0x03000000 // K8 on, K11 on, K14 off -#define ANAN7000_TX_ANTENNA_3 0x05000000 // K8 on, K11 off, K14 on - // Note: DO NOT SET attenuator bits on ANAN-7000/8000 // since ALEX0(14) is used for a different purpose! // @@ -113,10 +108,6 @@ // // These bits only have a function on ANAN-7000 -#define ALEX_ANAN7000_RX_ANT_NONE 0x00000000 -#define ALEX_ANAN7000_RX_ANT_EXT1 0x00004200 // bits 9, 14 -#define ALEX_ANAN7000_RX_ANT_XVTR 0x00004100 // bits 8, 14 -#define ALEX_ANAN7000_RX_ANT_BYPASS 0x00000800 // bit 11 #define ALEX_ANAN7000_RX_30_20_17_BPF 0x00000002 // bit 1, 11.0 - 20.9 MHz #define ALEX_ANAN7000_RX_15_12_BPF 0x00000004 // bit 2, 21.0 - 26.9 MHz diff --git a/hpsdrsim.c b/hpsdrsim.c index d41e1d8..0352032 100644 --- a/hpsdrsim.c +++ b/hpsdrsim.c @@ -9,7 +9,7 @@ * * This device has four "RF sources" * - * RF1: ADC noise plus a 800 Hz signal at -100dBm + * RF1: ADC noise plus a 800 Hz signal at -73dBm * RF2: ADC noise * RF3: TX feedback signal with some distortion. * RF4: normalized undistorted TX signal @@ -167,6 +167,8 @@ static double last_i_sample=0.0; static double last_q_sample=0.0; static int txptr=0; +static double txlevel; + int main(int argc, char *argv[]) { int i, j, size; @@ -542,6 +544,7 @@ int main(int argc, char *argv[]) last_q_sample=dqsample; if (j == 62) bp+=8; // skip 8 SYNC/C&C bytes of second block } + txlevel=txdrv_dbl*txdrv_dbl*sum * 0.0079365; // wrap-around of ring buffer if (txptr >= OLDRTXLEN) txptr=0; } @@ -1103,11 +1106,41 @@ void *handler_ep6(void *arg) pointer = buffer + i * 516 - i % 2 * 4 + 8; memcpy(pointer, header + header_offset, 8); - header_offset = header_offset >= 32 ? 0 : header_offset + 8; - + switch (header_offset) { + case 0: + // no CW bits + header_offset=8; + break; + case 8: + // AIN5: Exciter power + *(pointer+4)=0; // about 500 mW + *(pointer+5)=txdrive; + // AIN1: Forward Power + j=(int) ((4095.0/c1)*sqrt(100.0*txlevel*c2)); + *(pointer+6)=(j >> 8) & 0xFF; + *(pointer+7)=(j ) & 0xFF; + header_offset=16; + break; + case 16: + // AIN2: Reverse power + // AIN3: + header_offset=24; + break; + case 24: + // AIN4: + // AIN5: supply voltage + *(pointer+6) = 0; + *(pointer+7) = 63; + header_offset=32; + break; + case 32: + header_offset=0; + break; + } + pointer += 8; memset(pointer, 0, 504); - fac1=rxatt_dbl[0]*0.00001; // Amplitude of 800-Hz-signal to ADC1 + fac1=rxatt_dbl[0]*0.0002239; // Amplitude of 800-Hz-signal to ADC1 if (diversity) { fac2=0.0001*rxatt_dbl[0]; // Amplitude of broad "man-made" noise to ADC1 fac4=0.0002*rxatt_dbl[1]; // Amplitude of broad "man-made" noise to ADC2 diff --git a/new_protocol.c b/new_protocol.c index edbb13d..abf0c8c 100644 --- a/new_protocol.c +++ b/new_protocol.c @@ -859,6 +859,11 @@ static void new_protocol_high_priority() { // new ANAN-7000/8000 band-pass RX filters // This info comes from file bpf2_select.v in the // P1 firmware +// +// To support the ANAN-8000 we +// should bypass BPFs while transmitting in PURESIGNAL, +// but this causes unnecessary "relay chatter" on ANAN-7000 +// So if it should be done, 20 lines below it is shown how. // if(rxFrequency<1500000L) { alex0|=ALEX_ANAN7000_RX_BYPASS_BPF; @@ -879,11 +884,12 @@ static void new_protocol_high_priority() { default: // // Old (ANAN-100/200) high-pass filters -// Bypass HPFs while using EXT1 for PURESIGNAL feedback! // i=0; // flag used here for "filter bypass" if (rxFrequency<1800000L) i=1; #ifdef PURESIGNAL + // Bypass HPFs (only) if using EXT1 for PURESIGNAL feedback! + // "relay chatter" is not necessary if using bypass input if (isTransmitting() && transmitter->puresignal && receiver[PS_RX_FEEDBACK]->alex_antenna == 6) i=1; #endif if (i) { @@ -965,33 +971,44 @@ static void new_protocol_high_priority() { } #endif if (device == NEW_DEVICE_ORION2) i +=100; + if (new_pa_board) i += 1000; + // + // There are combinations which the user may have selected but do not work, + // for example, using EXT1 for PS input on "new PA" or ANAN-7000 (i==106, 1006) + // and here we do not set any bit. + // switch(i) { - case 6: // EXT 1 for PS feedback - case 3: // EXT 1 - alex0|=ALEX_RX_ANTENNA_EXT1; - break; - case 4: // EXT 2 - alex0|=ALEX_RX_ANTENNA_EXT2; + case 3: // EXT1 with old pa board + case 6: // EXT1-on-TX with old pa board + alex0 |= ALEX_RX_ANTENNA_EXT1 | ALEX_RX_ANTENNA_BYPASS; break; - case 5: // XVTR - alex0|=ALEX_RX_ANTENNA_XVTR; + case 4: // EXT with old pa board + alex0 |= ALEX_RX_ANTENNA_EXT2 | ALEX_RX_ANTENNA_BYPASS; break; - case 7: // RX_Bypass_In for PS feedback - alex0|=ALEX_RX_ANTENNA_BYPASS; + case 5: // XVTR with old pa board + alex0 |= ALEX_RX_ANTENNA_XVTR | ALEX_RX_ANTENNA_BYPASS; break; - case 103: // EXT1 on ANAN-7000 - case 106: // EXT1 on ANAN-7000 for PS feedback - alex0|=ALEX_ANAN7000_RX_ANT_EXT1; + case 103: // EXT1 with ANAN-7000 + alex0 |= ALEX_RX_ANTENNA_EXT1 | ANAN7000_RX_SELECT; break; - case 104: - // no EXT2 jacket on ANAN7000! - break; - case 105: - alex0|=ALEX_ANAN7000_RX_ANT_XVTR; - break; - case 107: // RxBypassIn on ANAN-7000 - alex0|=ALEX_ANAN7000_RX_ANT_BYPASS; + case 105: // XVTR with ANAN-7000 + alex0 |= ALEX_RX_ANTENNA_XVTR | ANAN7000_RX_SELECT; break; + case 107: // ByPass-on-TX with ANAN-7000 + alex0 |= ALEX_RX_ANTENNA_BYPASS; + break; + case 1003: // EXT1 with new pa board + alex0 |= ALEX_RX_ANTENNA_EXT1; + break; + case 1004: // EXT 2 with new pa board + alex0 |= ALEX_RX_ANTENNA_EXT2; + break; + case 1005: // XVTR with new pa board + alex0 |= ALEX_RX_ANTENNA_XVTR; + break; + case 1007: // ByPass-on-TX with new pa board + alex0 |= ALEX_RX_ANTENNA_BYPASS; + break; } // @@ -999,10 +1016,22 @@ static void new_protocol_high_priority() { // if(isTransmitting()) { i=transmitter->alex_antenna; + // + // TX antenna outside allowd range: this cannot happen. + // Out of paranoia: print warning and choose ANT1 + // + if (i<0 || i>2) { + fprintf(stderr,"WARNING: illegal TX antenna chosen, using ANT1\n"); + transmitter->alex_antenna=0; + i=0; + } } else { i=receiver[0]->alex_antenna; + // + // Not using ANT1,2,3: can leave relais in TX state unless using new PA board + // + if (i > 2 && !new_pa_board) i=transmitter->alex_antenna; } - if (device == NEW_DEVICE_ORION2) device +=100; // Only valid for ANAN-7000 not ANAN-8000! switch(i) { case 0: // ANT 1 alex0|=ALEX_TX_ANTENNA_1; @@ -1013,29 +1042,6 @@ static void new_protocol_high_priority() { case 2: // ANT 3 alex0|=ALEX_TX_ANTENNA_3; break; - case 100: //ANT 1 on ANAN-7000 - alex0|=ANAN7000_TX_ANTENNA_1; - break; - case 101: //ANT 1 on ANAN-7000 - alex0|=ANAN7000_TX_ANTENNA_2; - break; - case 102: //ANT 1 on ANAN-7000 - alex0|=ANAN7000_TX_ANTENNA_3; - break; - default: - // If RXing, this means EXT1 etc. is activated, but - // we should not arrive here in TX case. Out of paranoia, - // connect ANT1 in this case - if (isTransmitting()) { - fprintf(stderr,"WARNING: illegal TX antenna chosen, using ANT1\n"); - transmitter->alex_antenna=0; - if (device == NEW_DEVICE_ORION2) { - alex0|=ANAN7000_TX_ANTENNA_1; - } else { - alex0|=ALEX_TX_ANTENNA_1; - } - } - break; } high_priority_buffer_to_radio[1432]=(alex0>>24)&0xFF; diff --git a/newhpsdrsim.c b/newhpsdrsim.c index ba72616..dd96968 100644 --- a/newhpsdrsim.c +++ b/newhpsdrsim.c @@ -1086,7 +1086,7 @@ void *send_highprio_thread(void *data) { *p++ = 0; // no PTT and CW attached *p++ = 0; // no ADC overload *p++ = 0; - *p++ = 190; // 500 mw exciter power + *p++ = txdrive; p +=6; diff --git a/old_protocol.c b/old_protocol.c index b662c7c..ac92510 100644 --- a/old_protocol.c +++ b/old_protocol.c @@ -549,7 +549,7 @@ static gpointer receive_thread(gpointer arg) { // // -static int rx_feedback_receiver() { +static int rx_feedback_channel() { // // Depending on the device, return channel number of RX feedback receiver // @@ -574,7 +574,7 @@ static int rx_feedback_receiver() { return ret; } -static int tx_feedback_receiver() { +static int tx_feedback_channel() { // // Depending on the device, return channel number of TX feedback receiver // @@ -599,7 +599,7 @@ static int tx_feedback_receiver() { return ret; } -static int first_receiver() { +static int first_receiver_channel() { // // Depending on the device and whether we compiled for PURESIGNAL, // return the channel number of the first receiver @@ -607,7 +607,7 @@ static int first_receiver() { return 0; } -static int second_receiver() { +static int second_receiver_channel() { // // Depending on the device and whether we compiled for PURESIGNAL, // return the channel number of the second receiver @@ -624,65 +624,61 @@ static long long channel_freq(int chan) { // Depending on PURESIGNAL and DIVERSITY, return // the frequency associated with the current HPSDR // RX channel (0 <= chan <= 4). - // Note that for the RX channels which the firmware - // associates with the TX DAC the frequency need not - // be set. // // This function returns the TX frequency if chan is // outside the allowed range, and thus can be used // to set the TX frequency. // - // If transmitting with PURESIGNAL, the frequency of - // the "antenna" feedback channel is set to the TX freq. + // If transmitting with PURESIGNAL, the frequencies of + // the feedback and TX DAC channels are set to the TX freq. // // This subroutine is the ONLY place here where the VFO // frequencies are looked at. // - int v; + int vfonum; long long freq; switch (chan) { #ifdef PURESIGNAL case 0: case 1: - v=receiver[0]->id; + vfonum=receiver[0]->id; break; case 2: case 3: + case 4: if (diversity_enabled) { - v=receiver[0]->id; + vfonum=receiver[0]->id; } else { - v=receiver[1]->id; + vfonum=receiver[1]->id; } break; - case 4: // RX5 associated with TX DAC frequency - v=-1; - break; #else case 0: - v=receiver[0]->id; + vfonum=receiver[0]->id; break; case 1: if (diversity_enabled) { - v=receiver[0]->id; + vfonum=receiver[0]->id; } else { - v=receiver[1]->id; + vfonum=receiver[1]->id; } break; #endif default: // hook for determining the TX frequency - v=-1; + vfonum=-1; break; } // - // When transmitting with PURESIGNAL, set frequency of PS feedback channel to tx freq + // When transmitting with PURESIGNAL, set frequency of PS feedback and TX DAC channels + // to the tx frequency // - if (isTransmitting() && transmitter->puresignal && chan == rx_feedback_receiver()) { - v = -1; + if (isTransmitting() && transmitter->puresignal && (chan == rx_feedback_channel() || chan == tx_feedback_channel())) { + vfonum = -1; } - if (v < 0) { + if (vfonum < 0) { // - // v=-1 indicates that we should use the TX frequency. + // indicates that we should use the TX frequency. // if(active_receiver->id==VFO_A) { if(split) { @@ -699,15 +695,15 @@ static long long channel_freq(int chan) { } } else { // - // determine frequency associated with VFO v + // determine frequency associated with VFO #vfonum // - freq=vfo[v].frequency-vfo[v].lo; - if(vfo[v].rit_enabled) { - freq+=vfo[v].rit; + freq=vfo[vfonum].frequency-vfo[vfonum].lo; + if(vfo[vfonum].rit_enabled) { + freq+=vfo[vfonum].rit; } - if(vfo[v].mode==modeCWU) { + if(vfo[vfonum].mode==modeCWU) { freq-=(long long)cw_keyer_sidetone_frequency; - } else if(vfo[v].mode==modeCWL) { + } else if(vfo[vfonum].mode==modeCWL) { freq+=(long long)cw_keyer_sidetone_frequency; } } @@ -767,10 +763,10 @@ static void process_ozy_input_buffer(unsigned char *buffer) { int tx_vfo=split?VFO_B:VFO_A; int num_hpsdr_receivers=how_many_receivers(); - int rxfdbk = rx_feedback_receiver(); - int txfdbk = tx_feedback_receiver(); - int rx1channel = first_receiver(); - int rx2channel = second_receiver(); + int rxfdbk = rx_feedback_channel(); + int txfdbk = tx_feedback_channel(); + int rx1channel = first_receiver_channel(); + int rx2channel = second_receiver_channel(); if(buffer[b++]==SYNC && buffer[b++]==SYNC && buffer[b++]==SYNC) { // extract control bytes @@ -803,9 +799,6 @@ static void process_ozy_input_buffer(unsigned char *buffer) { #endif } - //if(vfo[tx_vfo].mode==modeCWL || vfo[tx_vfo].mode==modeCWU) { - // local_ptt=local_ptt|dot|dash; - // } if(previous_ptt!=local_ptt) { g_idle_add(ext_mox_update,(gpointer)(long)(local_ptt)); } @@ -1141,27 +1134,40 @@ void ozy_send_buffer() { #ifdef PURESIGNAL if (isTransmitting() && transmitter->puresignal) i=receiver[PS_RX_FEEDBACK]->alex_antenna; #endif + if (device == DEVICE_ORION2) i +=100; + if (new_pa_board) i +=1000; switch(i) { - case 6: // EXT1 used for PS feedback - case 3: // EXT1 (RX2_IN) - output_buffer[C3]|=0xC0; + case 3: // EXT1 with old pa board + case 6: // EXT1-on-TX with old pa board + output_buffer[C3] |= 0xC0; break; - case 4: // EXT2 (RX1_IN) (activates ByPass on ANAN-7000) - output_buffer[C3]|=0xA0; + case 4: // EXT2 with old pa board + output_buffer[C3] |= 0xA0; break; - case 5: // XVTR - output_buffer[C3]|=0xE0; + case 5: // XVTR with old pa board + output_buffer[C3] |= 0xE0; break; - case 7: // Bypass - if (device == DEVICE_ORION2) { - output_buffer[C3]|=0x20; // works on ANAN-7000 - } else { - output_buffer[C3]|=0x80; // meant to work on ANAN-100/200 with Rev.24 PA board - } - break; - default: - // RX1_ANT, RX1_OUT bits remain zero + case 103: // EXT1 with ANAN-7000 + output_buffer[C3]|= 0x40; + break; + case 105: // XVTR with ANAN-7000 + output_buffer[C3]|= 0x60; break; + case 107: // Bypass-on-TX with ANAN-7000 + output_buffer[C3]|= 0x20; + break; + case 1003: // EXT1 with new PA board + output_buffer[C3] |= 0x40; + break; + case 1004: // EXT2 with new PA board + output_buffer[C3] |= 0x20; + break; + case 1005: // XVRT with new PA board + output_buffer[C3] |= 0x60; + break; + case 1007: // Bypass-on-TX with new PA board + output_buffer[C3] |= 0x80; + break; } @@ -1170,23 +1176,29 @@ void ozy_send_buffer() { // 0 ... 7 maps on 1 ... 8 receivers output_buffer[C4]|=(num_hpsdr_receivers-1)<<3; - // Set ALEX TX_RELAY (that is, TX_ANT) +// +// Now we set the bits for Ant1/2/3 (RX and TX may be different) +// if(isTransmitting()) { - switch(transmitter->alex_antenna) { - case 0: // ANT 1 - output_buffer[C4]|=0x00; - break; - case 1: // ANT 2 - output_buffer[C4]|=0x01; - break; - case 2: // ANT 3 - output_buffer[C4]|=0x02; - break; - default: - break; + i=transmitter->alex_antenna; + // + // TX antenna outside allowd range: this cannot happen. + // Out of paranoia: print warning and choose ANT1 + // + if (i<0 || i>2) { + fprintf(stderr,"WARNING: illegal TX antenna chosen, using ANT1\n"); + transmitter->alex_antenna=0; + i=0; } } else { - switch(receiver[0]->alex_antenna) { + i=receiver[0]->alex_antenna; + // + // Not using ANT1,2,3: can leave relais in TX state unless using new PA board + // + if (i > 2 && !new_pa_board) i=transmitter->alex_antenna; + } + + switch(i) { case 0: // ANT 1 output_buffer[C4]|=0x00; break; @@ -1196,23 +1208,13 @@ void ozy_send_buffer() { case 2: // ANT 3 output_buffer[C4]|=0x02; break; - case 3: // EXT 1 - case 4: // EXT 2 - case 5: // XVTR - switch(transmitter->alex_antenna) { - case 0: // ANT 1 - output_buffer[C4]|=0x00; - break; - case 1: // ANT 2 - output_buffer[C4]|=0x01; - break; - case 2: // ANT 3 - output_buffer[C4]|=0x02; - break; - } + default: + // this happens only with the new pa board and using EXT1/EXT2/XVTR + // here we have to disconnect ANT1,2,3 + output_buffer[C4]|=0x03; break; - } } + // end of "C0=0" packet } else { // // metis_offset !=8: send the other C&C packets in round-robin @@ -1252,6 +1254,7 @@ void ozy_send_buffer() { // is sent the next time "command 3" is performed, but this often is too late and // CW is generated with zero DriveLevel. // Therefore, when in CW mode, send the TX drive level also when receiving. + // (it would be sufficient to do so only with internal CW). // if(split) { mode=vfo[1].mode; @@ -1453,7 +1456,7 @@ void ozy_send_buffer() { if (isTransmitting()) { if(mode==modeCWU || mode==modeCWL) { // -// If CW is done on the HPSDR board, we should not set +// For "internal" CW, we should not set // the MOX bit, everything is done in the FPGA. // // However, if we are doing CAT CW, local CW or tuning/TwoTone, diff --git a/ps_menu.c b/ps_menu.c index acd90ad..db1b33a 100644 --- a/ps_menu.c +++ b/ps_menu.c @@ -440,24 +440,29 @@ void ps_menu(GtkWidget *parent) { col++; GtkWidget *ps_ant_auto=gtk_radio_button_new_with_label(NULL,"Internal"); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ps_ant_auto), - (receiver[PS_RX_FEEDBACK]->alex_antenna == 0) ); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ps_ant_auto), (receiver[PS_RX_FEEDBACK]->alex_antenna == 0) ); gtk_widget_show(ps_ant_auto); gtk_grid_attach(GTK_GRID(grid), ps_ant_auto, col, row, 1, 1); g_signal_connect(ps_ant_auto,"toggled", G_CALLBACK(ps_ant_cb), (gpointer) (long) 0); col++; + // + // ANAN-7000: you can use both EXT1 and ByPass (although Bypass is to be preferred), + // ANAN-100/200 old PA: you can only use EXT1 + // ANAN-100/200 new PA: you can only use ByPass + // + // We would need much logic at various places to guarantee that non-reasonable settings + // cannot become effective, therefore we let the user choose both possibilities on all hardware + // GtkWidget *ps_ant_ext1=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(ps_ant_auto),"EXT1"); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ps_ant_ext1), - (receiver[PS_RX_FEEDBACK]->alex_antenna==6) ); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ps_ant_ext1), (receiver[PS_RX_FEEDBACK]->alex_antenna==6) ); gtk_widget_show(ps_ant_ext1); gtk_grid_attach(GTK_GRID(grid), ps_ant_ext1, col, row, 1, 1); g_signal_connect(ps_ant_ext1,"toggled", G_CALLBACK(ps_ant_cb), (gpointer) (long) 6); col++; - GtkWidget *ps_ant_ext2=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(ps_ant_auto),"ByPass IN"); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ps_ant_ext2), - (receiver[PS_RX_FEEDBACK]->alex_antenna==7) ); + GtkWidget *ps_ant_ext2=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(ps_ant_auto),"ByPass"); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ps_ant_ext2), (receiver[PS_RX_FEEDBACK]->alex_antenna==7) ); gtk_widget_show(ps_ant_ext2); gtk_grid_attach(GTK_GRID(grid), ps_ant_ext2, col, row, 1, 1); g_signal_connect(ps_ant_ext2,"toggled", G_CALLBACK(ps_ant_cb), (gpointer) (long) 7); diff --git a/radio.c b/radio.c index 94922ba..6d82af4 100644 --- a/radio.c +++ b/radio.c @@ -225,6 +225,7 @@ int vfo_encoder_divisor=15; int protocol; int device; +int new_pa_board=0; // Indicates Rev.24 PA board for HERMES/ANGELIA/ORION int ozy_software_version; int mercury_software_version; int penelope_software_version; @@ -529,22 +530,15 @@ void start_radio() { //fprintf(stderr,"meter_calibration=%f display_calibration=%f\n", meter_calibration, display_calibration); radioRestoreState(); + // -// DL1YCF: we send one buffer of TX samples in one shot. For the old -// protocol, their number is buffer_size, but for the new -// protocol, the number is 4*buffer_size. -// Since current hardware has a FIFO of 4096 IQ sample pairs, -// buffer_size should be limited to 2048 for the old protocol and -// to 512 for the new protocol. +// It is possible that an option has been read in +// which is not compatible with the hardware. +// Change setting to reasonable value then. +// // - switch (protocol) { - case ORIGINAL_PROTOCOL: - if (buffer_size > 2048) buffer_size=2048; - break; - case NEW_PROTOCOL: - if (buffer_size > 512) buffer_size=512; - break; - } + if (protocol == ORIGINAL_PROTOCOL && buffer_size > 2048) buffer_size=2048; + if (protocol == NEW_PROTOCOL && buffer_size > 512) buffer_size= 512; radio_change_region(region); @@ -1176,6 +1170,8 @@ fprintf(stderr,"radioRestoreState: %s\n",property_path); #endif loadProperties(property_path); + value=getProperty("new_pa_board"); + if (value) new_pa_board=atoi(value); value=getProperty("region"); if(value) region=atoi(value); value=getProperty("buffer_size"); @@ -1390,6 +1386,8 @@ void radioSaveState() { #else sem_wait(&property_sem); #endif + sprintf(value,"%d",new_pa_board); + setProperty("new_pa_board",value); sprintf(value,"%d",region); setProperty("region",value); sprintf(value,"%d",buffer_size); diff --git a/radio.h b/radio.h index 16b3cca..f1898ae 100644 --- a/radio.h +++ b/radio.h @@ -179,6 +179,7 @@ extern int vfo_encoder_divisor; extern int protocol; extern int device; +extern int new_pa_board; extern int ozy_software_version; extern int mercury_software_version; extern int penelope_software_version; diff --git a/radio_menu.c b/radio_menu.c index 9d40fdb..97e8719 100644 --- a/radio_menu.c +++ b/radio_menu.c @@ -125,6 +125,14 @@ static void none_cb(GtkWidget *widget, gpointer data) { } } +static void newpa_cb(GtkWidget *widget, gpointer data) { + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) { + new_pa_board=1; + } else { + new_pa_board=0; + } +} + static void alex_cb(GtkWidget *widget, gpointer data) { if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) { filter_board = ALEX; @@ -356,6 +364,20 @@ void radio_menu(GtkWidget *parent) { g_signal_connect(apollo_b, "toggled", G_CALLBACK(apollo_cb), NULL); g_signal_connect(charly25_b, "toggled", G_CALLBACK(charly25_cb), NULL); + if ((protocol == NEW_PROTOCOL && (device == NEW_DEVICE_HERMES || device == NEW_DEVICE_ANGELIA || device == NEW_DEVICE_ORION)) || + (protocol == ORIGINAL_PROTOCOL && (device == DEVICE_HERMES || device == DEVICE_ANGELIA || device == DEVICE_ORION))) { + + // + // ANAN-100/200: There is an "old" (Rev. 15/16) and "new" (Rev. 24) PA board + // around which differs in relay settings for using EXT1,2 and + // differs in how to do PS feedback. + // + GtkWidget *new_pa_b = gtk_check_button_new_with_label("ANAN 100/200 new PA board"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(new_pa_b), new_pa_board); + gtk_grid_attach(GTK_GRID(grid), new_pa_b, x, 6, 1, 1); + g_signal_connect(new_pa_b, "toggled", G_CALLBACK(newpa_cb), NULL); + } + x++; }