{"WWV",&bandstackWWV,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,0LL,0LL,0LL,0LL,0},
{"GEN",&bandstackGEN,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,0LL,0LL,0LL,0LL,0},
// XVTRS
- {"",&bandstack_xvtr_0,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,0LL,0LL,0LL,0LL,0},
- {"",&bandstack_xvtr_1,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,0LL,0LL,0LL,0LL,0},
- {"",&bandstack_xvtr_2,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,0LL,0LL,0LL,0LL,0},
- {"",&bandstack_xvtr_3,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,0LL,0LL,0LL,0LL,0},
- {"",&bandstack_xvtr_4,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,0LL,0LL,0LL,0LL,0},
- {"",&bandstack_xvtr_5,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,0LL,0LL,0LL,0LL,0},
- {"",&bandstack_xvtr_6,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,0LL,0LL,0LL,0LL,0},
- {"",&bandstack_xvtr_7,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,0LL,0LL,0LL,0LL,0}
+ {"",&bandstack_xvtr_0,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,0LL,0LL,0LL,0LL,1},
+ {"",&bandstack_xvtr_1,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,0LL,0LL,0LL,0LL,1},
+ {"",&bandstack_xvtr_2,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,0LL,0LL,0LL,0LL,1},
+ {"",&bandstack_xvtr_3,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,0LL,0LL,0LL,0LL,1},
+ {"",&bandstack_xvtr_4,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,0LL,0LL,0LL,0LL,1},
+ {"",&bandstack_xvtr_5,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,0LL,0LL,0LL,0LL,1},
+ {"",&bandstack_xvtr_6,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,0LL,0LL,0LL,0LL,1},
+ {"",&bandstack_xvtr_7,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,0LL,0LL,0LL,0LL,1}
};
CHANNEL band_channels_60m_UK[UK_CHANNEL_ENTRIES] =
int b=GPOINTER_TO_UINT(data);
set_button_text_color(last_band,"black");
last_band=widget;
+ //fprintf(stderr,"%s: %d\n",__FUNCTION__,b);
set_button_text_color(last_band,"orange");
#ifdef CLIENT_SERVER
if(radio_is_remote) {
#include <unistd.h>
#include <math.h>
+#include "band.h"
#include "receiver.h"
#include "meter.h"
#include "radio.h"
}
-void meter_update(RECEIVER *rx,int meter_type,double value,double reverse,double alc,double swr) {
+void meter_update(RECEIVER *rx,int meter_type,double value,double reverse,double exciter,double alc,double swr) {
double level;
char sf[32];
char *units="W";
double interval=10.0;
cairo_t *cr = cairo_create (meter_surface);
+ BAND *band=band_get_current_band();
if(meter_type==POWER) {
level=value;
- switch(pa_power) {
- case PA_1W:
- units="mW";
- interval=100.0;
- level=level*1000.0;
- reverse=reverse*1000; // scale reverse as well to get correct SWR
- break;
- case PA_10W:
- interval=1.0;
- break;
- case PA_30W:
- interval=3.0;
- break;
- case PA_50W:
- interval=5.0;
- break;
- case PA_100W:
- interval=10.0;
- break;
- case PA_200W:
- interval=20.0;
- break;
- case PA_500W:
- interval=50.0;
- break;
+ if(level==0.0 || band->disablePA || !pa_enabled) {
+ level=exciter;
+ }
+ if(band->disablePA || !pa_enabled) {
+ units="mW";
+ interval=100.0;
+ level=level*1000.0;
+ } else {
+ switch(pa_power) {
+ case PA_1W:
+ units="mW";
+ interval=100.0;
+ level=level*1000.0;
+ break;
+ case PA_10W:
+ interval=1.0;
+ break;
+ case PA_30W:
+ interval=3.0;
+ break;
+ case PA_50W:
+ interval=5.0;
+ break;
+ case PA_100W:
+ interval=10.0;
+ break;
+ case PA_200W:
+ interval=20.0;
+ break;
+ case PA_500W:
+ interval=50.0;
+ break;
+ }
}
}
char *units="W";
double interval=10.0;
- switch(pa_power) {
- case PA_1W:
- units="mW";
- interval=100.0;
- break;
- case PA_10W:
- interval=1.0;
- break;
- case PA_30W:
- interval=3.0;
- break;
- case PA_50W:
- interval=5.0;
- break;
- case PA_100W:
- interval=10.0;
- break;
- case PA_200W:
- interval=20.0;
- break;
- case PA_500W:
- interval=50.0;
- break;
+
+ if(band->disablePA || !pa_enabled) {
+ units="mW";
+ interval=100.0;
+ } else {
+ switch(pa_power) {
+ case PA_1W:
+ units="mW";
+ interval=100.0;
+ break;
+ case PA_10W:
+ interval=1.0;
+ break;
+ case PA_30W:
+ interval=3.0;
+ break;
+ case PA_50W:
+ interval=5.0;
+ break;
+ case PA_100W:
+ interval=10.0;
+ break;
+ case PA_200W:
+ interval=20.0;
+ break;
+ case PA_500W:
+ interval=50.0;
+ break;
+ }
}
for(i=0;i<=100;i++) {
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
- sprintf(sf,"%0.1f %s",max_level,units);
+ //sprintf(sf,"%0.1f%s",max_level,units);
+ sprintf(sf,"%d%s",(int)max_level,units);
cairo_move_to(cr, 80, meter_height-22);
cairo_show_text(cr, sf);
}
max_count++;
- sprintf(sf,"FWD: %0.1f %s",max_level,units);
+ sprintf(sf,"FWD: %d%s",(int)max_level,units);
cairo_move_to(cr, 10, 35);
cairo_show_text(cr, sf);
#define POWER 1
extern GtkWidget* meter_init(int width,int height,GtkWidget *parent);
-extern void meter_update(RECEIVER *rx,int meter_type,double value,double reverse,double alc,double swr);
+extern void meter_update(RECEIVER *rx,int meter_type,double value,double reverse,double exciter,double alc,double swr);
#endif
}
}
-/*
-static void process_bandscope_buffer(char *buffer) {
-}
-*/
-
void ozy_send_buffer() {
int txmode=get_tx_mode();
int txvfo=get_tx_vfo();
int i;
- BAND *band;
+ int power;
int num_hpsdr_receivers=how_many_receivers();
int rx1channel = first_receiver_channel();
int rx2channel = second_receiver_channel();
+ BAND *rxband=band_get_band(vfo[VFO_A].band);
+ BAND *txband=band_get_band(vfo[txvfo].band);
+
output_buffer[SYNC0]=SYNC;
output_buffer[SYNC1]=SYNC;
output_buffer[SYNC2]=SYNC;
if(classE) {
output_buffer[C2]|=0x01;
}
- band=band_get_band(vfo[VFO_A].band);
if(isTransmitting()) {
- band=band_get_band(vfo[txvfo].band);
- output_buffer[C2]|=band->OCtx<<1;
+ output_buffer[C2]|=txband->OCtx<<1;
if(tune) {
if(OCmemory_tune_time!=0) {
struct timeval te;
}
}
} else {
- output_buffer[C2]|=band->OCrx<<1;
+ output_buffer[C2]|=rxband->OCrx<<1;
}
output_buffer[C3] = (receiver[0]->alex_attenuation) & 0x03; // do not set higher bits
}
break;
case 3:
- {
- BAND *band=band_get_current_band();
- int power=0;
+ power=0;
//static int last_power=0;
//
// Some HPSDR apps for the RedPitaya generate CW inside the FPGA, but while
// last_power=power;
//}
+ //fprintf(stderr,"%s: TXband=%s disablePA=%d\n",__FUNCTION__,txband->title,txband->disablePA);
output_buffer[C0]=0x12;
if((filter_board==APOLLO) && tune) {
output_buffer[C2]|=0x10;
}
- if (device==DEVICE_HERMES_LITE2) {
- // do not set any Apollo/Alex bits,
- // ADDR=0x09 bit 19 follows "PA enable" state
- // ADDR=0x09 bit 20 follows "TUNE" state
- // ADDR=0x09 bit 18 always cleared (external tuner enabled)
- output_buffer[C2]= 0x00;
- if (pa_enabled) output_buffer[C2] |= 0x08;
- if (tune) output_buffer[C2] |= 0x10;
- }
if(band_get_current()==band6) {
output_buffer[C3]=output_buffer[C3]|0x40; // Alex 6M low noise amplifier
}
- if(band->disablePA) {
- output_buffer[C2]=output_buffer[C2]|0x40; // Manual Filter Selection
- output_buffer[C3]=output_buffer[C3]|0x20; // bypass all RX filters
- output_buffer[C3]=output_buffer[C3]|0x80; // disable Alex T/R relay
+ if (txband->disablePA || !pa_enabled) {
+ output_buffer[C3]|=0x80; // disable Alex T/R relay
+ if(isTransmitting()) {
+ output_buffer[C2]|=0x40; // Manual Filter Selection
+ output_buffer[C3]|=0x20; // bypass all RX filters
+ }
}
#ifdef PURESIGNAL
//
}
}
#endif
+ if (device==DEVICE_HERMES_LITE2) {
+ // do not set any Apollo/Alex bits (ADDR=0x09 bits 0:23)
+ // ADDR=0x09 bit 19 follows "PA enable" state
+ // ADDR=0x09 bit 20 follows "TUNE" state
+ // ADDR=0x09 bit 18 always cleared (external tuner enabled)
+ output_buffer[C2]= 0x00;
+ output_buffer[C3]= 0x00;
+ output_buffer[C4]= 0x00;
+ if (pa_enabled || txband->disablePA) output_buffer[C2] |= 0x08;
+ if (tune) output_buffer[C2] |= 0x10;
}
command=4;
break;
int err;
pa_buffer_attr attr;
- attr.maxlength = (uint32_t) -1;
- attr.tlength = (uint32_t) -1;
- attr.prebuf = (uint32_t) 3072; // about 64 msec "pre-filling"
- attr.minreq = (uint32_t) -1;
- attr.fragsize = (uint32_t) -1;
+ attr.maxlength = (uint32_t) 4800;
+ attr.tlength = (uint32_t) 3800;
+ attr.prebuf = (uint32_t) 3072; // about 64 msec "pre-filling"
+ attr.minreq = (uint32_t) -1;
+ attr.fragsize = (uint32_t) -1;
if(rx->audio_name==NULL) {
result=-1;
g_signal_connect(rx_gain_calibration_b,"value_changed",G_CALLBACK(rx_gain_calibration_value_changed_cb),NULL);
col++;
- if ((protocol == ORIGINAL_PROTOCOL && device == DEVICE_HERMES_LITE2) ||
- (protocol == NEW_PROTOCOL && device == NEW_DEVICE_HERMES_LITE2)) {
- GtkWidget *PA_enable_b=gtk_check_button_new_with_label("HL2 PA enable");
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (PA_enable_b), pa_enabled);
- gtk_grid_attach(GTK_GRID(grid),PA_enable_b,col,row,1,1);
- g_signal_connect(PA_enable_b,"toggled",G_CALLBACK(PA_enable_cb),NULL);
- }
+ GtkWidget *PA_enable_b=gtk_check_button_new_with_label("PA enable");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (PA_enable_b), pa_enabled);
+ gtk_grid_attach(GTK_GRID(grid),PA_enable_b,col,row,1,1);
+ g_signal_connect(PA_enable_b,"toggled",G_CALLBACK(PA_enable_cb),NULL);
}
row++;
g_mutex_unlock(&rx->display_mutex);
if(active_receiver==rx) {
rx->meter=GetRXAMeter(rx->id,smeter)+meter_calibration;
- // the three "unused" parameters are the TX rev, alc, and swr values
- meter_update(rx,SMETER,rx->meter,0.0,0.0,0.0);
+ meter_update(rx,SMETER,rx->meter,0.0,0.0,0.0,0.0);
}
return TRUE;
}
waterfall_update(rx);
}
if(active_receiver==rx) {
- // the three "unused" parameters are the TX rev, alc, and swr values
- meter_update(rx,SMETER,rx->meter,0.0,0.0,0.0);
+ meter_update(rx,SMETER,rx->meter,0.0,0.0,0.0,0.0);
}
g_mutex_unlock(&rx->display_mutex);
}
echo "installing fftw"
sudo apt-get -y install libfftw3-3
-echo "installing librtlsdr0"
-sudo apt-get -y install librtlsdr0
+echo "installing gppiod"
+sudo apt-get -y install libgpuiod2
+echo "installing pulseaudio"
+sudo apt-get -y install libpulse0
+sudo apt-get -y install libpulse-mainloop-glib0
echo "removing old versions of pihpsdr"
sudo rm -rf /usr/local/bin/pihpsdr
echo "creating start script"
cp pihpsdr.desktop ~/.local/share/applications
echo "removing old versions of shared libraries"
sudo rm -rf /usr/local/lib/libwdsp.so
-sudo rm -rf /usr/local/lib/libLimeSuite*
-sudo rm -rf /usr/local/lib/libSoapySDR*
-sudo rm -rf /usr/local/lib/SoapySDR
echo "copying udev rules"
-sudo cp 64-limesuite.rules /etc/udev/rules.d/
sudo cp 90-ozy.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules
sudo udevadm trigger
sudo cp pihpsdr /usr/local/bin
echo "installing shared libraries"
sudo cp libwdsp.so /usr/local/lib
-sudo cp libLimeSuite.so.19.04.1 /usr/local/lib
-sudo cp libSoapySDR.so.0.8.0 /usr/local/lib
-sudo cp -R SoapySDR /usr/local/lib
cd /usr/local/lib
-sudo ln -s libLimeSuite.so.19.04.1 libLimeSuite.so.19.04-1
-sudo ln -s libLimeSuite.so.19.04-1 libLimeSuite.so
-sudo ln -s libSoapySDR.so.0.8.0 libSoapySDR.so.0.8
-sudo ln -s libSoapySDR.so.0.8 libSoapySDR.so
sudo ldconfig
-
+if test -f "/boot/config.txt"; then
+ if grep -q "gpio=4-13,16-27=ip,pu" /boot/config.txt; then
+ echo "/boot/config.txt already contains gpio setup."
+ else
+ echo "/boot/config.txt does not contain gpio setup - adding it."
+ echo "Please reboot system for this to take effect."
+ cat <<EGPIO | sudo tee -a /boot/config.txt > /dev/null
+[all]
+# setup GPIO for pihpsdr controllers
+gpio=4-13,16-27=ip,pu
+EGPIO
+ fi
+fi
//
tx->fwd=compute_power(tx->fwd);
tx->rev=compute_power(tx->rev);
+ tx->exciter=compute_power(tx->exciter);
//
// Calculate SWR and store as tx->swr.
}
if(!duplex) {
- meter_update(active_receiver,POWER,tx->fwd,tx->rev,tx->alc,tx->swr);
+ meter_update(active_receiver,POWER,tx->fwd,tx->rev,tx->exciter,tx->alc,tx->swr);
}
return TRUE; // keep going
cairo_set_source_rgb(cr,1.0,0.2,0.0);
cairo_set_font_size(cr, DISPLAY_FONT_SIZE3);
- if(transmitter->fwd<0.0001) {
+ if(transmitter->fwd<0.0001 || band->disablePA || !pa_enabled) {
sprintf(text,"FWD %0.3f W",transmitter->exciter);
} else {
static int max_count=0;
cairo_move_to(cr,10,45);
cairo_show_text(cr, text);
-/*
- sprintf(text,"FWD: %0.8f",transmitter->fwd);
- cairo_move_to(cr,10,60);
- cairo_show_text(cr, text);
-
- sprintf(text,"EXC: %0.3f",transmitter->exciter);
- cairo_move_to(cr,10,75);
- cairo_show_text(cr, text);
-*/
}
//
// If the SWR protection has been triggered, display message for three seconds
void vfo_band_changed(int id,int b) {
BANDSTACK *bandstack;
+ //fprintf(stderr,"%s: %d\n",__FUNCTION__,b);
#ifdef CLIENT_SERVER
if(radio_is_remote) {
send_band(client_socket,id,b);
vfo[id].bandstack=bandstack->current_entry;
}
- BAND *band=band_get_band(b);
+ BAND *band=band_set_current(b);
BANDSTACK_ENTRY *entry=&bandstack->entry[vfo[id].bandstack];
vfo[id].band=b;
vfo[id].frequency=entry->frequency;