From 41dee04de1abf069a95e624089f50413b0ab2be8 Mon Sep 17 00:00:00 2001 From: c vw Date: Thu, 25 Jul 2019 20:06:17 +0200 Subject: [PATCH] P2: ALEX bits, added some schedule_xxxx() for P2 --- alex.h | 106 +++++++++++++--- meter.c | 15 ++- new_protocol.c | 317 ++++++++++++++++++++++++++---------------------- newhpsdrsim.c | 4 +- old_discovery.c | 2 +- ps_menu.c | 11 +- receiver.h | 1 - vfo.c | 15 ++- 8 files changed, 293 insertions(+), 178 deletions(-) diff --git a/alex.h b/alex.h index b2e0af6..ca9c38b 100644 --- a/alex.h +++ b/alex.h @@ -20,36 +20,102 @@ #ifndef _ALEX_H #define _ALEX_H -#define ALEX_RX_ANTENNA_NONE 0x00000000 -#define ALEX_RX_ANTENNA_XVTR 0x00000900 -#define ALEX_RX_ANTENNA_EXT1 0x00000A00 -#define ALEX_RX_ANTENNA_EXT2 0x00000C00 -#define ALEX_RX_ANTENNA_BYPASS 0x00000800 +// +// This defines the "standard" ALEX0 bits. For some gear, +// we need different definitions, but some bits are highly conserved +// Note that in the standard case, RX signals from Ant1,2,3 go through +// the TX low-pass filters! +// For ANAN-7000/8000, there are furthermore ALEX1 bits for the filter +// board of the second RX. +// +#define ALEX_RX_ANTENNA_NONE 0x00000000 // route Ant1,2,2 to RX1 +#define ALEX_RX_ANTENNA_XVTR 0x00000900 // route XVTR-in to RX1 +#define ALEX_RX_ANTENNA_EXT1 0x00000A00 // route EXT1 to RX1 +#define ALEX_RX_ANTENNA_EXT2 0x00000C00 // jOUTE EXT2 to RX1 +#define ALEX_RX_ANTENNA_BYPASS 0x00000800 // disconnect RX1 from Ant1,2,3 -#define ALEX_TX_ANTENNA_1 0x01000000 -#define ALEX_TX_ANTENNA_2 0x02000000 -#define ALEX_TX_ANTENNA_3 0x04000000 +#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 +// +// Note: DO NOT SET attenuator bits on ANAN-7000/8000 +// since ALEX0(14) is used for a different purpose! +// #define ALEX_ATTENUATION_0dB 0x00000000 -#define ALEX_ATTENUATION_10dB 0x00004000 -#define ALEX_ATTENUATION_20dB 0x00002000 -#define ALEX_ATTENUATION_30dB 0x00006000 - -#define ALEX_30_20_LPF 0x00100000 -#define ALEX_60_40_LPF 0x00200000 -#define ALEX_80_LPF 0x00400000 -#define ALEX_160_LPF 0x00800000 -#define ALEX_6_BYPASS_LPF 0x20000000 -#define ALEX_12_10_LPF 0x40000000 -#define ALEX_17_15_LPF 0x80000000 +#define ALEX_ATTENUATION_10dB 0x00004000 // activate 10 dB attenuator for RX1 +#define ALEX_ATTENUATION_20dB 0x00002000 // activate 20 dB attenuator for RX1 +#define ALEX_ATTENUATION_30dB 0x00006000 // activate both attenuators for RX1 +// +// Note: Anan 100/200: If RX signal comes from Ant1,2,3 it also goes +// through the TX LPFs +// +#define ALEX_30_20_LPF 0x00100000 // activate 30/20m TX LPF +#define ALEX_60_40_LPF 0x00200000 // activate 60/20m TX LPF +#define ALEX_80_LPF 0x00400000 // activate 80m TX LPF +#define ALEX_160_LPF 0x00800000 // activate 160m TX LPF +#define ALEX_6_BYPASS_LPF 0x20000000 // activate 6m TX LPF +#define ALEX_12_10_LPF 0x40000000 // activate 12/10m TX LPF +#define ALEX_17_15_LPF 0x80000000 // activate 17/15m TX LPF + +// +// ALEX RX high-pass filters (Valid for ANAN-100/200) +// #define ALEX_13MHZ_HPF 0x00000002 #define ALEX_20MHZ_HPF 0x00000004 +#define ALEX_6M_PREAMP 0x00000008 // 35 MHz HPF + low-noise amplifier #define ALEX_9_5MHZ_HPF 0x00000010 #define ALEX_6_5MHZ_HPF 0x00000020 #define ALEX_1_5MHZ_HPF 0x00000040 #define ALEX_BYPASS_HPF 0x00001000 -#define ALEX_6M_PREAMP 0x00000008 +// +// Bit that controls the RX/TX relay +// +#define ALEX_TX_RELAY 0x08000000 + +// +// Bit used for PURESIGNAL +// +#define ALEX_PS_BIT 0x00040000 + +// +// From this point on, we define bits that have a slightly +// different meaning +// + + +// +// ALEX bits for ANAN-7000 and ANAN-8000 +// Note that we here also have Alex1 bits which control the filters +// for the second ADC. The RX input is also very different and now used +// bit14 which is used for switching attenuators in the general case +// On the RX side, we now have band-pass filters and the RX signals +// from Ant1,2,3 DO NOT PASS the TX low-pass filters. +// The TX bits are just as for the "generic" case. +// + +// 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 +#define ALEX_ANAN7000_RX_10_6_PRE_BPF 0x00000008 // bit 3, 27.0 - 61.4 MHz with preamp +#define ALEX_ANAN7000_RX_40_30_BPF 0x00000010 // bit 4, 5.5 - 10.9 MHz +#define ALEX_ANAN7000_RX_80_60_BPF 0x00000020 // bit 5, 2.1 - 5.4 MHz +#define ALEX_ANAN7000_RX_160_BPF 0x00000040 // bit 6, 1.5 - 2.0 MHz +#define ALEX_ANAN7000_RX_BYPASS_BPF 0x00001000 // bit 12 + +#define ALEX1_ANAN7000_RX_GNDonTX 0x00000100 // bit 8 +// +// For ANAN7000,8000 there also is byte 1400 in the high-priority packet +// which directs the output of the DUC directly to the "XVTR OUT" jack +// (bit0) and which we should set when using "XVRT IN" +// +#define ANAN7000_XVTR_OUT 0x00000001 // #endif diff --git a/meter.c b/meter.c index 4f90e91..137eb05 100644 --- a/meter.c +++ b/meter.c @@ -421,8 +421,12 @@ if(analog_meter) { cairo_move_to(cr, 80, meter_height-22); cairo_show_text(cr, sf); - double swr=(max_level+reverse)/(max_level-reverse); - if(swr<0.0) swr=1.0; + double swr; + if (max_level > reverse) { + swr=(max_level+reverse)/(max_level-reverse); + } else { + swr=999.9; + } sprintf(sf,"SWR: %1.1f:1",swr); cairo_move_to(cr, 60, meter_height-12); cairo_show_text(cr, sf); @@ -674,7 +678,12 @@ if(analog_meter) { cairo_move_to(cr, 10, 35); cairo_show_text(cr, sf); - double swr=(max_level+reverse)/(max_level-reverse); + double swr; + if (max_level > reverse) { + swr=(max_level+reverse)/(max_level-reverse); + } else { + swr=999.9; + } cairo_select_font_face(cr, "FreeMono", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); diff --git a/new_protocol.c b/new_protocol.c index 13fcda4..5d83fa3 100644 --- a/new_protocol.c +++ b/new_protocol.c @@ -607,7 +607,6 @@ static void new_protocol_general() { static void new_protocol_high_priority() { int i; BAND *band; - int xvtr; long long rxFrequency; long long txFrequency; long phase; @@ -638,7 +637,7 @@ static void new_protocol_high_priority() { } #ifdef LOCALCW if (cw_keyer_internal == 0) { - // set the ptt if we're not in breakin mode and mox is on + // set the ptt if we are not in breakin mode and mox is on if(cw_breakin == 0 && getMox()) high_priority_buffer_to_radio[4]|=0x02; } #endif @@ -649,7 +648,9 @@ static void new_protocol_high_priority() { } } -// rx +// +// Set DDC frequencies +// if (diversity_enabled) { // @@ -715,7 +716,10 @@ static void new_protocol_high_priority() { } } - // tx +// +// Set DUC frequency +// + if(active_receiver->id==VFO_A) { txFrequency=vfo[VFO_A].frequency-vfo[VFO_A].lo; if(split) { @@ -744,7 +748,9 @@ static void new_protocol_high_priority() { phase=(long)((4294967296.0*(double)txFrequency)/122880000.0); if(isTransmitting() && transmitter->puresignal) { - // set DDC0 and DDC1 frequency to transmit frequency + // + // Set DDC0 and DDC1 (synchronized) to the transmit frequency + // high_priority_buffer_to_radio[9]=phase>>24; high_priority_buffer_to_radio[10]=phase>>16; high_priority_buffer_to_radio[11]=phase>>8; @@ -776,12 +782,9 @@ static void new_protocol_high_priority() { if(split) { band=band_get_band(vfo[VFO_B].band); - xvtr=vfo[VFO_B].band>=BANDS; } else { band=band_get_band(vfo[VFO_A].band); - xvtr=vfo[VFO_A].band>=BANDS; } - // TODO: set word 1400 for ANAN-8000 high_priority_buffer_to_radio[1401]=band->OCtx<<1; if(tune) { if(OCmemory_tune_time!=0) { @@ -800,230 +803,248 @@ static void new_protocol_high_priority() { high_priority_buffer_to_radio[1401]=band->OCrx<<1; } - long filters=0x00000000; +// +// ANAN-7000/8000: route TXout to XvtrOut out when not using PA +// + if ((device==NEW_DEVICE_ORION2) && band->disablePA) { + high_priority_buffer_to_radio[1400] |= ANAN7000_XVTR_OUT; + } + +// +// ALEX bits +// + long alex0=0x00000000; + long alex1=0x00000000; if(isTransmitting()) { - filters=0x08000000; // Bit 27 + alex0 |= ALEX_TX_RELAY; if(transmitter->puresignal) { - filters|=0x00040000; // Bit 18 + alex0 |= ALEX_PS_BIT; // Bit 18 } } +// +// The following code is based upon the assumption that +// the frequency of VFO_A is used with ADC0, and that the +// frequency of VFO_B can safely be used to control the +// filters of ADC1 (if there are any). +// rxFrequency=vfo[VFO_A].frequency-vfo[VFO_A].lo; switch(device) { case NEW_DEVICE_ORION2: +// +// new ANAN-7000/8000 band-pass RX filters +// This info comes from file bpf2_select.v in the +// P1 firmware +// if(rxFrequency<1500000L) { - filters|=ALEX_BYPASS_HPF; + alex0|=ALEX_ANAN7000_RX_BYPASS_BPF; } else if(rxFrequency<2100000L) { - filters|=ALEX_1_5MHZ_HPF; + alex0|=ALEX_ANAN7000_RX_160_BPF; } else if(rxFrequency<5500000L) { - filters|=ALEX_6_5MHZ_HPF; + alex0|=ALEX_ANAN7000_RX_80_60_BPF; } else if(rxFrequency<11000000L) { - filters|=ALEX_9_5MHZ_HPF; - } else if(rxFrequency<22000000L) { - filters|=ALEX_13MHZ_HPF; + alex0|=ALEX_ANAN7000_RX_40_30_BPF; + } else if(rxFrequency<20900000L) { + alex0|=ALEX_ANAN7000_RX_30_20_17_BPF; } else if(rxFrequency<35000000L) { - filters|=ALEX_20MHZ_HPF; + alex0|=ALEX_ANAN7000_RX_15_12_BPF; } else { - filters|=ALEX_6M_PREAMP; + alex0|=ALEX_ANAN7000_RX_10_6_PRE_BPF; } break; default: +// +// Old (ANAN-100/200) high-pass filters +// if(rxFrequency<1800000L) { - filters|=ALEX_BYPASS_HPF; + alex0|=ALEX_BYPASS_HPF; } else if(rxFrequency<6500000L) { - filters|=ALEX_1_5MHZ_HPF; + alex0|=ALEX_1_5MHZ_HPF; } else if(rxFrequency<9500000L) { - filters|=ALEX_6_5MHZ_HPF; + alex0|=ALEX_6_5MHZ_HPF; } else if(rxFrequency<13000000L) { - filters|=ALEX_9_5MHZ_HPF; + alex0|=ALEX_9_5MHZ_HPF; } else if(rxFrequency<20000000L) { - filters|=ALEX_13MHZ_HPF; + alex0|=ALEX_13MHZ_HPF; } else if(rxFrequency<50000000L) { - filters|=ALEX_20MHZ_HPF; + alex0|=ALEX_20MHZ_HPF; } else { - filters|=ALEX_6M_PREAMP; + alex0|=ALEX_6M_PREAMP; } break; } +// +// Pre-Orion2 boards: If using Ant1/2/3, the RX signal goes through the TX low-pass +// filters. Therefore we must set these according to the ADC0 +// (receive) frequency while RXing. +// + if (!isTransmitting() && device != NEW_DEVICE_ORION2 && receiver[0]->alex_antenna < 3) { + txFrequency = rxFrequency; + } switch(device) { case NEW_DEVICE_ORION2: if(txFrequency>32000000) { - filters|=ALEX_6_BYPASS_LPF; + alex0|=ALEX_6_BYPASS_LPF; } else if(txFrequency>22000000) { - filters|=ALEX_12_10_LPF; + alex0|=ALEX_12_10_LPF; } else if(txFrequency>15000000) { - filters|=ALEX_17_15_LPF; + alex0|=ALEX_17_15_LPF; } else if(txFrequency>8000000) { - filters|=ALEX_30_20_LPF; + alex0|=ALEX_30_20_LPF; } else if(txFrequency>4500000) { - filters|=ALEX_60_40_LPF; + alex0|=ALEX_60_40_LPF; } else if(txFrequency>2400000) { - filters|=ALEX_80_LPF; + alex0|=ALEX_80_LPF; } else { - filters|=ALEX_160_LPF; + alex0|=ALEX_160_LPF; } break; default: if(txFrequency>35600000) { - filters|=ALEX_6_BYPASS_LPF; + alex0|=ALEX_6_BYPASS_LPF; } else if(txFrequency>24000000) { - filters|=ALEX_12_10_LPF; + alex0|=ALEX_12_10_LPF; } else if(txFrequency>16500000) { - filters|=ALEX_17_15_LPF; + alex0|=ALEX_17_15_LPF; } else if(txFrequency>8000000) { - filters|=ALEX_30_20_LPF; + alex0|=ALEX_30_20_LPF; } else if(txFrequency>5000000) { - filters|=ALEX_60_40_LPF; + alex0|=ALEX_60_40_LPF; } else if(txFrequency>2500000) { - filters|=ALEX_80_LPF; + alex0|=ALEX_80_LPF; } else { - filters|=ALEX_160_LPF; + alex0|=ALEX_160_LPF; } break; - } - switch(receiver[0]->alex_antenna) { - case 0: // ANT 1 - break; - case 1: // ANT 2 - break; - case 2: // ANT 3 - break; +// +// Set bits that route Ext1/Ext2/XVRTin to the RX +// +// If transmitting with PURESIGNAL, we must use the alex_antenna +// settings of the PS_RX_FEEDBACK receiver +// +// ANAN-7000 routes signals differently (these bits have no function on ANAN-80000) +// and uses ALEX0(14) to connnect Ext/XvrtIn to the RX. +// + i=receiver[0]->alex_antenna; + if (isTransmitting() && transmitter->puresignal) { + i=receiver[PS_RX_FEEDBACK]->alex_antenna; // 0, 3, or 4 + } + if (device == NEW_DEVICE_ORION2) i +=100; + switch(i) { case 3: // EXT 1 - filters|=ALEX_RX_ANTENNA_EXT2; + alex0|=ALEX_RX_ANTENNA_EXT1; break; case 4: // EXT 2 - filters|=ALEX_RX_ANTENNA_EXT1; + alex0|=ALEX_RX_ANTENNA_EXT2; break; case 5: // XVTR - if(!xvtr) { - filters|=ALEX_RX_ANTENNA_XVTR; - } - break; - default: - // invalid value - set to 0 - band->alexRxAntenna=0; + alex0|=ALEX_RX_ANTENNA_XVTR; break; + case 103: // EXT1 on ANAN-7000 + alex0|=ALEX_ANAN7000_RX_ANT_EXT1; + break; + case 104: // EXT2 means RxBypass on ANAN-7000 + alex0|=ALEX_ANAN7000_RX_ANT_BYPASS; + break; + case 105: + alex0|=ALEX_ANAN7000_RX_ANT_XVTR; + break; } - if(isTransmitting()) { - if(!xvtr) { - switch(transmitter->alex_antenna) { - case 0: // ANT 1 - filters|=ALEX_TX_ANTENNA_1; - break; - case 1: // ANT 2 - filters|=ALEX_TX_ANTENNA_2; - break; - case 2: // ANT 3 - filters|=ALEX_TX_ANTENNA_3; - break; - default: - // invalid value - set to 0 - filters|=ALEX_TX_ANTENNA_1; - band->alexRxAntenna=0; - break; - } - } +// +// Now we set the bits for Ant1/2/3 (RX and TX may be different) +// If RX is from none of Ant1/2/3, do not switch (leave these relays +// in TX state) +// + if(isTransmitting() || (receiver[0]->alex_antenna > 2)) { + i=transmitter->alex_antenna; } else { - switch(receiver[0]->alex_antenna) { - case 0: // ANT 1 - filters|=ALEX_TX_ANTENNA_1; - break; - case 1: // ANT 2 - filters|=ALEX_TX_ANTENNA_2; - break; - case 2: // ANT 3 - filters|=ALEX_TX_ANTENNA_3; - break; - case 3: // EXT 1 - case 4: // EXT 2 - case 5: // XVTR - if(!xvtr) { - switch(transmitter->alex_antenna) { - case 0: // ANT 1 - filters|=ALEX_TX_ANTENNA_1; - break; - case 1: // ANT 2 - filters|=ALEX_TX_ANTENNA_2; - break; - case 2: // ANT 3 - filters|=ALEX_TX_ANTENNA_3; - break; - } - } - break; - } + i=receiver[0]->alex_antenna; + } + // i has value 0, 1, or 2. + switch(i) { + default: + // should not happen, ignore silently and connect to ANT1 + /* FALLTHROUGH */ + case 0: // ANT 1 + alex0|=ALEX_TX_ANTENNA_1; + break; + case 1: // ANT 2 + alex0|=ALEX_TX_ANTENNA_2; + break; + case 2: // ANT 3 + alex0|=ALEX_TX_ANTENNA_3; + break; } - // TODO: ALEX1 bits 0-15 for ANAN-7000 and ANAN-8000 in 1430 and 1431 - high_priority_buffer_to_radio[1432]=(filters>>24)&0xFF; - high_priority_buffer_to_radio[1433]=(filters>>16)&0xFF; - high_priority_buffer_to_radio[1434]=(filters>>8)&0xFF; - high_priority_buffer_to_radio[1435]=filters&0xFF; - -//fprintf(stderr,"filters: txrx0: %02X %02X %02X %02X for rx=%lld tx=%lld\n",high_priority_buffer_to_radio[1432],high_priority_buffer_to_radio[1433],high_priority_buffer_to_radio[1434],high_priority_buffer_to_radio[1435],rxFrequency,txFrequency); + high_priority_buffer_to_radio[1432]=(alex0>>24)&0xFF; + high_priority_buffer_to_radio[1433]=(alex0>>16)&0xFF; + high_priority_buffer_to_radio[1434]=(alex0>>8)&0xFF; + high_priority_buffer_to_radio[1435]=alex0&0xFF; - filters=0x00000000; - rxFrequency=vfo[VFO_B].frequency-vfo[VFO_B].lo; +//fprintf(stderr,"ALEX0 bits: %02X %02X %02X %02X for rx=%lld tx=%lld\n",high_priority_buffer_to_radio[1432],high_priority_buffer_to_radio[1433],high_priority_buffer_to_radio[1434],high_priority_buffer_to_radio[1435],rxFrequency,txFrequency); - switch(device) { - case NEW_DEVICE_ORION2: +// +// Orion2 boards: set RX2 filters according ro VFOB frequency +// + if (device == NEW_DEVICE_ORION2) { + rxFrequency=vfo[VFO_B].frequency-vfo[VFO_B].lo; +// +// new ANAN-7000/8000 band-pass RX filters +// This info comes from file bpf2_select.v in the +// P1 firmware +// if(rxFrequency<1500000L) { - filters|=ALEX_BYPASS_HPF; + alex1|=ALEX_ANAN7000_RX_BYPASS_BPF; } else if(rxFrequency<2100000L) { - filters|=ALEX_1_5MHZ_HPF; + alex1|=ALEX_ANAN7000_RX_160_BPF; } else if(rxFrequency<5500000L) { - filters|=ALEX_6_5MHZ_HPF; + alex1|=ALEX_ANAN7000_RX_80_60_BPF; } else if(rxFrequency<11000000L) { - filters|=ALEX_9_5MHZ_HPF; - } else if(rxFrequency<22000000L) { - filters|=ALEX_13MHZ_HPF; + alex1|=ALEX_ANAN7000_RX_40_30_BPF; + } else if(rxFrequency<20900000L) { + alex1|=ALEX_ANAN7000_RX_30_20_17_BPF; } else if(rxFrequency<35000000L) { - filters|=ALEX_20MHZ_HPF; - } else { - filters|=ALEX_6M_PREAMP; - } - break; - default: - if(rxFrequency<1800000L) { - filters|=ALEX_BYPASS_HPF; - } else if(rxFrequency<6500000L) { - filters|=ALEX_1_5MHZ_HPF; - } else if(rxFrequency<9500000L) { - filters|=ALEX_6_5MHZ_HPF; - } else if(rxFrequency<13000000L) { - filters|=ALEX_9_5MHZ_HPF; - } else if(rxFrequency<20000000L) { - filters|=ALEX_13MHZ_HPF; - } else if(rxFrequency<50000000L) { - filters|=ALEX_20MHZ_HPF; + alex1|=ALEX_ANAN7000_RX_15_12_BPF; } else { - filters|=ALEX_6M_PREAMP; + alex1|=ALEX_ANAN7000_RX_10_6_PRE_BPF; } - break; - } - //high_priority_buffer_to_radio[1428]=(filters>>24)&0xFF; - //high_priority_buffer_to_radio[1429]=(filters>>16)&0xFF; - high_priority_buffer_to_radio[1430]=(filters>>8)&0xFF; - high_priority_buffer_to_radio[1431]=filters&0xFF; +// +// The main purpose of RX2 is DIVERSITY. Therefore, +// ground RX2 upon TX *always* +// + if (isTransmitting()) { + alex1|=ALEX1_ANAN7000_RX_GNDonTX; + } -//fprintf(stderr,"filters: rx1: %02X %02X for rx=%lld\n",high_priority_buffer_to_radio[1430],high_priority_buffer_to_radio[1431],rxFrequency); + high_priority_buffer_to_radio[1430]=(alex1>>8)&0xFF; + high_priority_buffer_to_radio[1431]=alex1&0xFF; +//fprintf(stderr,"ALEX1 bits: rx1: %02X %02X for rx=%lld\n",high_priority_buffer_to_radio[1430],high_priority_buffer_to_radio[1431],rxFrequency); + } -//fprintf(stderr,"new_protocol_high_priority: OC=%02X filters=%04X for frequency=%lld\n", high_priority_buffer_to_radio[1401], filters, rxFrequency); +// +// Upon transmitting, set the attenuator of ADC0 to the "transmitter attenuation" +// (used in PURESIGNAL signal strength adjustment) and the attenuator of ADC1 +// to the maximum value (to protect RX2 in DIVERSITY setups). +// if(isTransmitting()) { high_priority_buffer_to_radio[1443]=transmitter->attenuation; + high_priority_buffer_to_radio[1442]=31; } else { high_priority_buffer_to_radio[1443]=adc_attenuation[0]; high_priority_buffer_to_radio[1442]=adc_attenuation[1]; } +// +// Voila mes amis. Envoyons les 1444 octets "high priority" au radio +// int rc; if((rc=sendto(data_socket,high_priority_buffer_to_radio,sizeof(high_priority_buffer_to_radio),0,(struct sockaddr*)&high_priority_addr,high_priority_addr_length))<0) { fprintf(stderr,"sendto socket failed for high priority: rc=%d errno=%d\n",rc,errno); diff --git a/newhpsdrsim.c b/newhpsdrsim.c index ddf1197..bc4eaa1 100644 --- a/newhpsdrsim.c +++ b/newhpsdrsim.c @@ -1076,8 +1076,8 @@ void *send_highprio_thread(void *data) { *p++ = (seqnum >> 0) & 0xFF; *p++ = 0; // no PTT and CW attached *p++ = 0; // no ADC overload - *p++ = 1; - *p++ = 126; // 1 W exciter power + *p++ = 0; + *p++ = 190; // 500 mw exciter power p +=6; diff --git a/old_discovery.c b/old_discovery.c index 8517d84..086a3b9 100644 --- a/old_discovery.c +++ b/old_discovery.c @@ -425,7 +425,7 @@ fprintf(stderr,"discover_receive_thread\n"); break; case DEVICE_ORION2: - strcpy(discovered[devices].name,"Orion 2"); + strcpy(discovered[devices].name,"Orion2"); break; case DEVICE_STEMLAB: // This is in principle the same as HERMES so pretend a HERMES diff --git a/ps_menu.c b/ps_menu.c index cbddbc6..acadd84 100644 --- a/ps_menu.c +++ b/ps_menu.c @@ -271,6 +271,9 @@ static void ps_ant_cb(GtkWidget *widget, gpointer data) { case 3: // EXT1, feedback goes to first ADC case 4: // EXT2, feedback goes to first ADC receiver[PS_RX_FEEDBACK]->alex_antenna = val; + if (protocol == NEW_PROTOCOL) { + schedule_high_priority(); + } break; } } @@ -327,6 +330,7 @@ static void twotone_cb(GtkWidget *widget, gpointer data) { void ps_menu(GtkWidget *parent) { GtkWidget *b; int i; + const char *cp; parent_window=parent; @@ -440,7 +444,12 @@ void ps_menu(GtkWidget *parent) { g_signal_connect(ps_ant_ext1,"toggled", G_CALLBACK(ps_ant_cb), (gpointer) (long) 3); col++; - GtkWidget *ps_ant_ext2=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(ps_ant_auto),"EXT2"); + cp="EXT2"; + // On ANAN-7000 there is no EXT2 jacket. This function is now called "RX ByPass" + // On ANAN-8000 this must be done by physical re-wiring + if ((protocol == ORIGINAL_PROTOCOL && device == DEVICE_ORION2) || + (protocol == NEW_PROTOCOL && device == NEW_DEVICE_ORION2)) cp="RxByPass"; + GtkWidget *ps_ant_ext2=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(ps_ant_auto),cp); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ps_ant_ext2), (receiver[PS_RX_FEEDBACK]->alex_antenna==4) ); gtk_widget_show(ps_ant_ext2); diff --git a/receiver.h b/receiver.h index 9954a78..0327a99 100644 --- a/receiver.h +++ b/receiver.h @@ -39,7 +39,6 @@ typedef enum _audio_t audio_t; typedef struct _receiver { int id; - int ddc; int adc; double volume; diff --git a/vfo.c b/vfo.c index 3aac001..c6af0c8 100644 --- a/vfo.c +++ b/vfo.c @@ -303,6 +303,13 @@ void vfo_band_changed(int b) { tx_set_mode(transmitter,vfo[VFO_A].mode); } calcDriveLevel(); +// +// New protocol: communicate changes to radio +// HighPrio is scheduled anyway through calcDriveLevel +// + if (protocol == NEW_PROTOCOL) { + schedule_general(); // for PA disable + } g_idle_add(ext_vfo_update,NULL); } @@ -379,9 +386,13 @@ void vfo_mode_changed(int m) { } else { tx_set_mode(transmitter,vfo[VFO_A].mode); } - // changing from CWL to CWU changes BFO frequency. + // + // changing modes may change BFO frequency + // and SDR need to be informed about "CW or not CW" + // if (protocol == NEW_PROTOCOL) { - schedule_high_priority(); + schedule_high_priority(); // update frequencies + schedule_transmit_specific(); // update "CW" flag } g_idle_add(ext_vfo_update,NULL); } -- 2.45.2