From: John Melton - G0ORX/N6LYT Date: Thu, 25 Aug 2016 08:49:15 +0000 (+0000) Subject: Fixed New Protocol CW. Updated header files so only included once. X-Git-Url: https://git.rkrishnan.org/components/-?a=commitdiff_plain;h=ee7430a7ad6595a31cdb2a0e92dc69ca4de6aa8b;p=pihpsdr.git Fixed New Protocol CW. Updated header files so only included once. --- diff --git a/agc.h b/agc.h index c64de97..2fcb04f 100644 --- a/agc.h +++ b/agc.h @@ -17,9 +17,13 @@ * */ +#ifndef _AGC_H +#define _AGC_H + #define AGC_OFF 0 #define AGC_LONG 1 #define AGC_SLOW 2 #define AGC_MEDIUM 3 #define AGC_FAST 4 +#endif diff --git a/alex.h b/alex.h index a9178cb..ee1ce66 100644 --- a/alex.h +++ b/alex.h @@ -17,6 +17,9 @@ * */ +#ifndef _ALEX_H +#define _ALEX_H + #define ALEX_RX_ANTENNA_NONE 0x00000000 #define ALEX_RX_ANTENNA_XVTR 0x00000900 #define ALEX_RX_ANTENNA_EXT1 0x00000A00 @@ -48,3 +51,5 @@ #define ALEX_BYPASS_HPF 0x00000800 #define ALEX_6M_PREAMP 0x00000008 + +#endif diff --git a/audio.h b/audio.h index cedea09..89e90d8 100644 --- a/audio.h +++ b/audio.h @@ -17,6 +17,9 @@ * */ +#ifndef _AUDIO_H +#define _AUDIO_H + extern int audio; extern int audio_buffer_size; @@ -26,3 +29,5 @@ void audio_write(short left_sample,short right_sample); /* void audio_write(double *buffer,int samples); */ + +#endif diff --git a/band.h b/band.h index 4c35de6..7a21b10 100644 --- a/band.h +++ b/band.h @@ -17,6 +17,9 @@ * */ +#ifndef _BAND_H +#define _BAND_H + #include #include "bandstack.h" @@ -99,3 +102,4 @@ BAND_LIMITS* getBandLimits(long long minDisplay,long long maxDisplay); XVTR_ENTRY* getXvtrEntry(int i); */ +#endif diff --git a/bandstack.h b/bandstack.h index c40a09e..4506c5f 100644 --- a/bandstack.h +++ b/bandstack.h @@ -17,8 +17,9 @@ * */ -#ifndef BANDSTACK_H -#define BANDSTACK_H +#ifndef _BANDSTACK_H +#define _BANDSTACK_H + /* --------------------------------------------------------------------------*/ /** * @brief Bandstack definition diff --git a/channel.h b/channel.h index f4c0c57..48da4d0 100644 --- a/channel.h +++ b/channel.h @@ -17,6 +17,9 @@ * */ +#ifndef _CHANNEL_H +#define _CHANNEL_H + #define CHANNEL_RX0 0 #define CHANNEL_RX1 1 #define CHANNEL_RX2 2 @@ -32,3 +35,5 @@ #define CHANNEL_PSK 11 #endif +#endif + diff --git a/configure.h b/configure.h index 3750463..5f3f84a 100644 --- a/configure.h +++ b/configure.h @@ -18,6 +18,11 @@ */ +#ifndef _CONFIGURE_H +#define _CONFIGURE_H + #ifdef INCLUDE_GPIO void configure_gpio(GtkWidget *parent); #endif + +#endif diff --git a/discovered.h b/discovered.h index 5b76d87..28b41e0 100644 --- a/discovered.h +++ b/discovered.h @@ -17,6 +17,9 @@ * */ +#ifndef _DISCOVERED_H +#define _DISCOVERED_H + #include #ifdef LIMESDR #include @@ -82,3 +85,4 @@ extern int selected_device; extern int devices; extern DISCOVERED discovered[MAX_DEVICES]; +#endif diff --git a/filter.h b/filter.h index e0cbe07..8c91cfe 100644 --- a/filter.h +++ b/filter.h @@ -17,6 +17,9 @@ * */ +#ifndef _FILTER_H +#define _FILTER_H + #include "mode.h" // disable Var1 and Var2 (change to 12 to enable) @@ -61,3 +64,4 @@ int filterVar2High; FILTER *filters[MODES]; +#endif diff --git a/freedv.h b/freedv.h index 0b4c817..36bdd2b 100644 --- a/freedv.h +++ b/freedv.h @@ -1,3 +1,25 @@ +/* Copyright (C) +* 2016 - John Melton, G0ORX/N6LYT +* +* 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. +* +*/ + +#ifndef _FREEDV_H +#define _FREEDV_H + extern int n_speech_samples; extern int n_max_modem_samples; extern short *demod_in; @@ -16,3 +38,4 @@ int demod_sample_freedv(short sample); int mod_sample_freedv(short sample); void reset_freedv_tx_text_index(); +#endif diff --git a/frequency.h b/frequency.h index 2aa1007..9c9199f 100644 --- a/frequency.h +++ b/frequency.h @@ -24,9 +24,8 @@ * */ -// -// frequency.h -// +#ifndef _FREQUENCY_H +#define _FREQUENCY_H /* --------------------------------------------------------------------------*/ /** @@ -44,3 +43,5 @@ struct frequency_info { char* getFrequencyInfo(long long frequency); int getBand(long long frequency); int canTransmit(); + +#endif diff --git a/gpio.h b/gpio.h index d94de81..4ed7155 100644 --- a/gpio.h +++ b/gpio.h @@ -17,6 +17,9 @@ * */ +#ifndef _GPIO_H +#define _GPIO_H + extern int ENABLE_VFO_ENCODER; extern int ENABLE_VFO_PULLUP; extern int VFO_ENCODER_A; @@ -67,3 +70,5 @@ int mode_get_state(); int filter_get_state(); int noise_get_state(); int mox_get_state(); + +#endif diff --git a/lime_discovery.h b/lime_discovery.h index 999944e..6c73d73 100644 --- a/lime_discovery.h +++ b/lime_discovery.h @@ -1 +1,25 @@ +/* Copyright (C) +* 2015 - John Melton, G0ORX/N6LYT +* +* 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. +* +*/ + +#ifndef _LIME_DISCOVERY_H +#define _LIME_DISCOVERY_H + void lime_discovery(); + +#endif diff --git a/lime_protocol.h b/lime_protocol.h index aa349d3..ec2fd96 100644 --- a/lime_protocol.h +++ b/lime_protocol.h @@ -1,3 +1,25 @@ +/* Copyright (C) +* 2015 - John Melton, G0ORX/N6LYT +* +* 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. +* +*/ + +#ifndef _LIME_PROTOCOL_H +#define _LIME_PROTOCOL_H + #define BUFFER_SIZE 1024 void lime_protocol_init(int rx,int pixels); @@ -5,3 +27,5 @@ void lime_protocol_stop(); void lime_protocol_set_frequency(long long f); void lime_protocol_set_antenna(int ant); void lime_protocol_set_attenuation(int attenuation); + +#endif diff --git a/main.c b/main.c index 4142cc1..771a9f1 100644 --- a/main.c +++ b/main.c @@ -166,16 +166,21 @@ gint update(gpointer data) { DISCOVERED *d=&discovered[selected_device]; double constant1=3.3; - double constant2=0.09; + double constant2=0.095; if(d->protocol==ORIGINAL_PROTOCOL) { switch(d->device) { case DEVICE_METIS: + constant1=3.3; + constant2=0.09; break; case DEVICE_HERMES: - //constant2=0.095; HERMES 2 + constant1=3.3; + constant2=0.095; break; case DEVICE_ANGELIA: + constant1=3.3; + constant2=0.095; break; case DEVICE_ORION: constant1=5.0; @@ -256,9 +261,11 @@ gint update(gpointer data) { } } -//fprintf(stderr,"drive=%d tune_drive=%d alex_forward_power=%d alex_reverse_power=%d exciter_power=%d fwd=%f rev=%f exciter=%f\n", -// drive, tune_drive, alex_forward_power, alex_reverse_power, exciter_power, fwd, rev, exciter); +/* +fprintf(stderr,"alex_forward_power=%d alex_reverse_power=%d exciter_power=%d fwd=%f rev=%f exciter=%f\n", + alex_forward_power, alex_reverse_power, exciter_power, fwd, rev, exciter); meter_update(POWER,fwd,rev,exciter,alc); +*/ } return TRUE; diff --git a/main.h b/main.h index 1250362..ba49d5b 100644 --- a/main.h +++ b/main.h @@ -17,6 +17,9 @@ * */ +#ifndef _MAIN_H +#define _MAIN_H + #include extern struct utsname unameData; void reconfigure_display(); @@ -25,3 +28,4 @@ void show_psk(); void show_waterfall(); #endif +#endif diff --git a/menu.h b/menu.h index 90f6b2d..52c3e6f 100644 --- a/menu.h +++ b/menu.h @@ -18,4 +18,9 @@ */ +#ifndef _MENU_H +#define _MENU_H + GtkWidget* menu_init(int width,int height,GtkWidget *parent); + +#endif diff --git a/meter.h b/meter.h index d02adcf..44df101 100644 --- a/meter.h +++ b/meter.h @@ -17,6 +17,9 @@ * */ +#ifndef _METER_H +#define _METER_H + #define SMETER 0 #define POWER 1 #ifdef PSK @@ -26,3 +29,5 @@ GtkWidget* meter_init(int width,int height,GtkWidget *parent); void meter_update(int meter_type,double value,double reverse,double exciter,double alc); + +#endif diff --git a/mode.h b/mode.h index aa1d4fd..e2839d2 100644 --- a/mode.h +++ b/mode.h @@ -17,6 +17,9 @@ * */ +#ifndef _MODE_H +#define _MODE_H + #define modeLSB 0 #define modeUSB 1 #define modeDSB 2 @@ -51,3 +54,4 @@ int mode; char *mode_string[MODES]; +#endif diff --git a/new_discovery.h b/new_discovery.h index 84b98dc..9851f22 100644 --- a/new_discovery.h +++ b/new_discovery.h @@ -17,5 +17,9 @@ * */ +#ifndef _NEW_DISCOVERY_H +#define _NEW_DISCOVERY_H void new_discovery(void); + +#endif diff --git a/new_protocol.c b/new_protocol.c index ea7ee55..316dc45 100644 --- a/new_protocol.c +++ b/new_protocol.c @@ -149,7 +149,7 @@ static int psk_samples=0; static int psk_resample=6; // convert from 48000 to 8000 #endif -static void new_protocol_high_priority(int run,int tx,double drive); +static void new_protocol_high_priority(int run); static void* new_protocol_thread(void* arg); static void* new_protocol_timer_thread(void* arg); static void process_iq_data(unsigned char *buffer); @@ -242,11 +242,11 @@ void new_protocol_init(int rx,int pixels) { } void new_protocol_new_sample_rate(int rate) { - new_protocol_high_priority(0,0,0); + new_protocol_high_priority(0); sample_rate=rate; new_protocol_calc_buffers(); wdsp_new_sample_rate(rate); - new_protocol_high_priority(1,0,drive); + new_protocol_high_priority(1); } static void new_protocol_general() { @@ -264,11 +264,11 @@ fprintf(stderr,"new_protocol_general: receiver=%d\n", receiver); // use defaults apart from buffer[37]=0x08; // phase word (not frequency) buffer[38]=0x01; // enable hardware timer - //buffer[58]=pa; // enable PA 0x01 + buffer[58]=0x01; // enable PA 0x01 - //if((filter_board==APOLLO) && tune) { + if(filter_board==APOLLO) { - buffer[58]|=0x02; + buffer[58]|=0x02; // enable APOLLO tuner } if(filter_board==ALEX) { @@ -283,11 +283,11 @@ fprintf(stderr,"new_protocol_general: receiver=%d\n", receiver); general_sequence++; } -static void new_protocol_high_priority(int run,int tx,double drive) { +static void new_protocol_high_priority(int run) { unsigned char buffer[1444]; BAND *band=band_get_current_band(); -//fprintf(stderr,"new_protocol_high_priority: run=%d tx=%d drive=%f\n", run, tx, drive); +fprintf(stderr,"new_protocol_high_priority: run=%d\n", run); memset(buffer, 0, sizeof(buffer)); buffer[0]=high_priority_sequence>>24; @@ -295,7 +295,16 @@ static void new_protocol_high_priority(int run,int tx,double drive) { buffer[2]=high_priority_sequence>>8; buffer[3]=high_priority_sequence; - buffer[4]=run|(tx<<1); + buffer[4]=run; + if(mode==modeCWU || mode==modeCWL) { + if(tune) { + buffer[4]|=0x02; + } + } else { + if(isTransmitting()) { + buffer[4]|=0x02; + } + } long rxFrequency=ddsFrequency; if(mode==modeCWU) { @@ -320,11 +329,15 @@ static void new_protocol_high_priority(int run,int tx,double drive) { buffer[331]=phase>>8; buffer[332]=phase; - - double d=drive*((double)band->pa_calibration/100.0); + double d=drive; + if(tune) { + d=tune_drive; + } + d=d*((double)band->pa_calibration/100.0); int power=(int)(d*255.0); buffer[345]=power&0xFF; +fprintf(stderr,"power=%d\n",power); if(isTransmitting()) { buffer[1401]=band->OCtx; @@ -461,17 +474,11 @@ else LPF <= 7'b0001000; // < 2.4MHz so use 160m LPF^M //filters|=alex_attenuation; - if(tx) { + //if(isTransmitting() || mode==modeCWU || mode==modeCWL) { + if(isTransmitting()) { filters|=0x08000000; } -/* - buffer[1420]=filters>>24; - buffer[1421]=filters>>16; - buffer[1422]=filters>>8; - buffer[1423]=filters; -*/ - buffer[1432]=filters>>24; buffer[1433]=filters>>16; buffer[1434]=filters>>8; @@ -503,7 +510,7 @@ static void new_protocol_transmit_specific() { buffer[4]=1; // 1 DAC buffer[5]=0; // default no CW - if(cw_keyer_internal) { + if(cw_keyer_internal && (mode==modeCWU || mode==modeCWL)) { buffer[5]|=0x02; } if(cw_keys_reversed) { @@ -549,7 +556,6 @@ static void new_protocol_transmit_specific() { } buffer[51]=0x7F; // Line in gain - if(sendto(data_socket,buffer,sizeof(buffer),0,(struct sockaddr*)&transmitter_addr,transmitter_addr_length)<0) { fprintf(stderr,"sendto socket failed for tx specific\n"); exit(1); @@ -616,7 +622,7 @@ static void new_protocol_start() { } void new_protocol_stop() { - new_protocol_high_priority(0,0,0); + new_protocol_high_priority(0); running=0; sleep(1); } @@ -694,7 +700,7 @@ fprintf(stderr,"outputsamples=%d\n", outputsamples); new_protocol_general(); new_protocol_start(); - new_protocol_high_priority(1,0,drive); + new_protocol_high_priority(1); while(running) { bytesread=recvfrom(data_socket,buffer,sizeof(buffer),0,(struct sockaddr*)&addr,&length); @@ -734,7 +740,7 @@ fprintf(stderr,"outputsamples=%d\n", outputsamples); sem_wait(&send_high_priority_sem); if(send_high_priority==1) { - new_protocol_high_priority(1,isTransmitting(),tune==0?drive:tune_drive); + new_protocol_high_priority(1); send_high_priority=0; } sem_post(&send_high_priority_sem); @@ -764,7 +770,7 @@ static void process_iq_data(unsigned char *buffer) { //fprintf(stderr,"samples per frame %d\n",samplesperframe); - if(!isTransmitting()) { + //if(!isTransmitting()) { b=16; int i; for(i=0;i>3)&0x01; + + adc_overload=buffer[5]&0x01; exciter_power=((buffer[6]&0xFF)<<8)|(buffer[7]&0xFF); alex_forward_power=((buffer[14]&0xFF)<<8)|(buffer[15]&0xFF); @@ -830,8 +838,6 @@ if(dash!=previous_dash) { supply_volts=((buffer[49]&0xFF)<<8)|(buffer[50]&0xFF); if(previous_ptt!=ptt) { - //send_high_priority=1; - previous_ptt=ptt; g_idle_add(ptt_update,(gpointer)ptt); } @@ -905,42 +911,48 @@ static void process_freedv_rx_buffer() { int j; int demod_samples; for(j=0;j>8; - audiobuffer[audioindex++]=leftaudiosample; - audiobuffer[audioindex++]=rightaudiosample>>8; - audiobuffer[audioindex++]=rightaudiosample; - if(audioindex>=sizeof(audiobuffer)) { - // insert the sequence - audiobuffer[0]=audiosequence>>24; - audiobuffer[1]=audiosequence>>16; - audiobuffer[2]=audiosequence>>8; - audiobuffer[3]=audiosequence; - // send the buffer - if(sendto(data_socket,audiobuffer,sizeof(audiobuffer),0,(struct sockaddr*)&audio_addr,audio_addr_length)<0) { - fprintf(stderr,"sendto socket failed for audio\n"); - exit(1); + for(t=0;t<6;t++) { // 8k to 48k + if(local_audio) { + audio_write(leftaudiosample,rightaudiosample); + } + audiobuffer[audioindex++]=leftaudiosample>>8; + audiobuffer[audioindex++]=leftaudiosample; + audiobuffer[audioindex++]=rightaudiosample>>8; + audiobuffer[audioindex++]=rightaudiosample; + if(audioindex>=sizeof(audiobuffer)) { + // insert the sequence + audiobuffer[0]=audiosequence>>24; + audiobuffer[1]=audiosequence>>16; + audiobuffer[2]=audiosequence>>8; + audiobuffer[3]=audiosequence; + // send the buffer + if(sendto(data_socket,audiobuffer,sizeof(audiobuffer),0,(struct sockaddr*)&audio_addr,audio_addr_length)<0) { + fprintf(stderr,"sendto socket failed for audio\n"); + exit(1); + } + audioindex=4; + audiosequence++; } - audioindex=4; - audiosequence++; } } } + freedv_samples++; + if(freedv_samples==freedv_resample) { + freedv_samples=0; + } } } } @@ -994,21 +1006,26 @@ static void full_rx_buffer() { int error; fexchange0(CHANNEL_RX0, iqinputbuffer, audiooutputbuffer, &error); + switch(mode) { #ifdef PSK - if(mode!=modePSK) { + case modePSK: + break; #endif - Spectrum0(1, CHANNEL_RX0, 0, 0, iqinputbuffer); -#ifdef PSK + default: + Spectrum0(1, CHANNEL_RX0, 0, 0, iqinputbuffer); + break; } -#endif + switch(mode) { #ifdef FREEDV - if(mode==modeFREEDV) { - process_freedv_rx_buffer(); - return; - } + case modeFREEDV: + process_freedv_rx_buffer(); + break; #endif - process_rx_buffer(); + default: + process_rx_buffer(); + break; + } } static void full_tx_buffer() { diff --git a/new_protocol.h b/new_protocol.h index 8c11804..a5c5f10 100644 --- a/new_protocol.h +++ b/new_protocol.h @@ -17,6 +17,8 @@ * */ +#ifndef _NEW_PROTOCOL_H +#define _NEW_PROTOCOL_H // port definitions from host #define GENERAL_REGISTERS_FROM_HOST_PORT 1024 @@ -70,3 +72,4 @@ void setTune(int state); int getTune(); int isTransmitting(); +#endif diff --git a/old_discovery.h b/old_discovery.h index 89fddbe..fb3a2f5 100644 --- a/old_discovery.h +++ b/old_discovery.h @@ -17,4 +17,9 @@ * */ +#ifndef _OLD_DISCOVERY_H +#define _OLD_DISCOVERY_H + void old_discovery(void); + +#endif diff --git a/old_protocol.h b/old_protocol.h index a4f3ac6..e77e7d6 100644 --- a/old_protocol.h +++ b/old_protocol.h @@ -17,8 +17,13 @@ * */ +#ifndef _OLD_PROTOCOL_H +#define _OLD_PROTOCOL_H + #define BUFFER_SIZE 1024 void old_protocol_stop(); void old_protocol_init(int rx,int pixels); void old_protocol_new_sample_rate(int rate); void schedule_frequency_changed(); + +#endif diff --git a/panadapter.h b/panadapter.h index 278f504..61717d0 100644 --- a/panadapter.h +++ b/panadapter.h @@ -17,6 +17,12 @@ * */ +#ifndef _PANADAPTER_H +#define _PANADAPTER_H + void panadapter_update(float* data,int tx); GtkWidget* panadapter_init(int width,int height); + + +#endif diff --git a/pihpsdr b/pihpsdr index fa264bb..e248f91 100755 Binary files a/pihpsdr and b/pihpsdr differ diff --git a/property.h b/property.h index 5056c6e..7cccaea 100644 --- a/property.h +++ b/property.h @@ -17,6 +17,9 @@ * */ +#ifndef _PROPERTY_H +#define _PROPERTY_H + typedef struct _PROPERTY PROPERTY; /* --------------------------------------------------------------------------*/ @@ -33,3 +36,4 @@ void loadProperties(char* filename); char* getProperty(char* name); void setProperty(char* name,char* value); +#endif diff --git a/psk.c b/psk.c index 557d268..7d8c326 100644 --- a/psk.c +++ b/psk.c @@ -101,7 +101,9 @@ GtkWidget *init_psk() { gtk_label_set_width_chars (GTK_LABEL(psk_label), 80); gtk_label_set_lines (GTK_LABEL(psk_label), TEXT_LINES); gtk_label_set_line_wrap (GTK_LABEL(psk_label), TRUE); - gtk_misc_set_alignment (GTK_MISC(psk_label), 0, 0); + //gtk_misc_set_alignment (GTK_MISC(psk_label), 0, 0); + gtk_widget_set_halign(psk_label,GTK_ALIGN_START); + gtk_widget_set_valign(psk_label,GTK_ALIGN_START); return psk_label; } diff --git a/psk.h b/psk.h index 8e22e2f..eba9555 100644 --- a/psk.h +++ b/psk.h @@ -1,3 +1,25 @@ +/* Copyright (C) +* 2016 - John Melton, G0ORX/N6LYT +* +* 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. +* +*/ + +#ifndef _PSK_H +#define _PSK_H + #define PSK_BUFFER_SIZE 1024 #define PSK_RX_TEXT_SIZE 2048 @@ -9,3 +31,5 @@ extern void psk_set_frequency(int f); extern int psk_get_frequency(); extern int psk_get_signal_level(); extern int psk_demod(double sample); + +#endif diff --git a/psk_waterfall.h b/psk_waterfall.h index 0209c1a..abdf8ae 100644 --- a/psk_waterfall.h +++ b/psk_waterfall.h @@ -17,6 +17,10 @@ * */ +#ifndef _PSK_WATERFALL_H +#define _PSK_WATERFALL_H void psk_waterfall_update(float *data); GtkWidget* psk_waterfall_init(int width,int height); + +#endif diff --git a/radio.h b/radio.h index 4d30174..bfc7d6a 100644 --- a/radio.h +++ b/radio.h @@ -17,6 +17,10 @@ * */ +#ifndef _RADIO_H +#define _RADIO_H + +#include "discovered.h" #define NEW_MIC_IN 0x00 #define NEW_LINE_IN 0x01 @@ -236,3 +240,5 @@ extern void radioRestoreState(); extern void radioSaveState(); extern void calculate_display_average(); + +#endif diff --git a/release/pihpsdr.tar b/release/pihpsdr.tar index 270d5f9..de7c497 100644 Binary files a/release/pihpsdr.tar and b/release/pihpsdr.tar differ diff --git a/release/pihpsdr/pihpsdr b/release/pihpsdr/pihpsdr index fa264bb..e248f91 100755 Binary files a/release/pihpsdr/pihpsdr and b/release/pihpsdr/pihpsdr differ diff --git a/signal.h b/signal.h index 85f781c..6c76f24 100644 --- a/signal.h +++ b/signal.h @@ -17,5 +17,10 @@ * */ +#ifndef _SIGNAL_H +#define _SIGNAL_H + double sineWave(double* buf, int samples, double sinphase, double freq); double cosineWave(double* buf, int samples, double cosphase, double freq); + +#endif diff --git a/sliders.h b/sliders.h index be25b58..a469077 100644 --- a/sliders.h +++ b/sliders.h @@ -17,6 +17,9 @@ * */ +#ifndef _SLIDERS_H +#define _SLIDERS_H + void set_agc_gain(double value); void set_af_gain(double value); void set_mic_gain(double value); @@ -24,3 +27,5 @@ void set_drive(double drive); void set_tune(double tune); void set_attenuation_value(double attenuation); GtkWidget *sliders_init(int my_width, int my_height, GtkWidget* parent); + +#endif diff --git a/splash.h b/splash.h index b366305..a6be1fc 100644 --- a/splash.h +++ b/splash.h @@ -18,8 +18,13 @@ */ +#ifndef _SPLASH_H +#define _SPLASH_H + extern GtkWidget* splash_window; void splash_close(void); void splash_show(char *image_name,int time,int width,int height); void splash_status(char *text); + +#endif diff --git a/toolbar.c b/toolbar.c index 7bfe95c..af55075 100644 --- a/toolbar.c +++ b/toolbar.c @@ -67,6 +67,17 @@ static GtkWidget *last_filter; static GdkRGBA white; static GdkRGBA gray; +static void set_button_text_color(GtkWidget *widget,char *color) { + GtkStyleContext *style_context; + GtkCssProvider *provider = gtk_css_provider_new (); + gchar tmp[64]; + style_context = gtk_widget_get_style_context(widget); + gtk_style_context_add_provider(style_context, GTK_STYLE_PROVIDER(provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + g_snprintf(tmp, sizeof tmp, "GtkButton, GtkLabel { color: %s; }", color); + gtk_css_provider_load_from_data(GTK_CSS_PROVIDER(provider), tmp, -1, NULL); + g_object_unref (provider); +} + void update_toolbar_labels() { if(toolbar_dialog_buttons) { gtk_button_set_label(GTK_BUTTON(sim_band),"Band"); @@ -115,9 +126,9 @@ static void band_select_cb(GtkWidget *widget, gpointer data) { } else { BAND* band=band_set_current(b); entry=bandstack_entry_get_current(); - gtk_widget_override_background_color(last_band, GTK_STATE_NORMAL, &white); + set_button_text_color(last_band,"black"); last_band=widget; - gtk_widget_override_background_color(last_band, GTK_STATE_NORMAL, &gray); + set_button_text_color(last_band,"orange"); } setMode(entry->mode); FILTER* band_filters=filters[entry->mode]; @@ -162,10 +173,10 @@ void band_cb(GtkWidget *widget, gpointer data) { #endif BAND* band=band_get_band(i); GtkWidget *b=gtk_button_new_with_label(band->title); - gtk_widget_override_background_color(b, GTK_STATE_NORMAL, &white); + set_button_text_color(b,"black"); //gtk_widget_override_font(b, pango_font_description_from_string("Arial 20")); if(i==band_get_current()) { - gtk_widget_override_background_color(b, GTK_STATE_NORMAL, &gray); + set_button_text_color(b,"orange"); last_band=b; } gtk_widget_show(b); @@ -198,9 +209,9 @@ static void bandstack_select_cb(GtkWidget *widget, gpointer data) { bandstack->current_entry=b; - gtk_widget_override_background_color(last_bandstack, GTK_STATE_NORMAL, &white); + set_button_text_color(last_bandstack,"black"); last_bandstack=widget; - gtk_widget_override_background_color(last_bandstack, GTK_STATE_NORMAL, &gray); + set_button_text_color(last_bandstack,"orange"); BANDSTACK_ENTRY *entry; entry=&(bandstack->entry[b]); @@ -247,10 +258,10 @@ void bandstack_cb(GtkWidget *widget, gpointer data) { BANDSTACK_ENTRY *entry=&bandstack->entry[i]; sprintf(label,"%lld %s",entry->frequencyA,mode_string[entry->mode]); GtkWidget *b=gtk_button_new_with_label(label); - gtk_widget_override_background_color(b, GTK_STATE_NORMAL, &white); + set_button_text_color(b,"black"); //gtk_widget_override_font(b, pango_font_description_from_string("Arial 20")); if(i==bandstack->current_entry) { - gtk_widget_override_background_color(b, GTK_STATE_NORMAL, &gray); + set_button_text_color(b,"orange"); last_bandstack=b; } gtk_widget_show(b); @@ -293,9 +304,9 @@ static void mode_select_cb(GtkWidget *widget, gpointer data) { FILTER* band_filters=filters[entry->mode]; FILTER* band_filter=&band_filters[entry->filter]; setFilter(band_filter->low,band_filter->high); - gtk_widget_override_background_color(last_mode, GTK_STATE_NORMAL, &white); + set_button_text_color(last_mode,"black"); last_mode=widget; - gtk_widget_override_background_color(last_mode, GTK_STATE_NORMAL, &gray); + set_button_text_color(last_mode,"orange"); vfo_update(NULL); } @@ -321,10 +332,10 @@ void mode_cb(GtkWidget *widget, gpointer data) { for(i=0;imode) { - gtk_widget_override_background_color(b, GTK_STATE_NORMAL, &gray); + set_button_text_color(b,"orange"); last_mode=b; } else { - gtk_widget_override_background_color(b, GTK_STATE_NORMAL, &white); + set_button_text_color(b,"black"); } //gtk_widget_override_font(b, pango_font_description_from_string("Arial 20")); gtk_widget_show(b); @@ -357,9 +368,9 @@ static void filter_select_cb(GtkWidget *widget, gpointer data) { FILTER* band_filters=filters[entry->mode]; FILTER* band_filter=&band_filters[entry->filter]; setFilter(band_filter->low,band_filter->high); - gtk_widget_override_background_color(last_filter, GTK_STATE_NORMAL, &white); + set_button_text_color(last_filter,"black"); last_filter=widget; - gtk_widget_override_background_color(last_filter, GTK_STATE_NORMAL, &gray); + set_button_text_color(last_filter,"orange"); vfo_update(NULL); } @@ -388,10 +399,10 @@ void filter_cb(GtkWidget *widget, gpointer data) { GtkWidget *b=gtk_button_new_with_label(band_filters[i].title); //gtk_widget_override_font(b, pango_font_description_from_string("Arial 20")); if(i==entry->filter) { - gtk_widget_override_background_color(b, GTK_STATE_NORMAL, &gray); + set_button_text_color(b,"orange"); last_filter=b; } else { - gtk_widget_override_background_color(b, GTK_STATE_NORMAL, &white); + set_button_text_color(b,"black"); } gtk_widget_show(b); gtk_grid_attach(GTK_GRID(grid),b,i%5,i/5,1,1); @@ -997,7 +1008,7 @@ fprintf(stderr,"mox_cb: mox now %d\n",mox); int ptt_update(void *data) { fprintf(stderr,"ptt_update\n"); - if(mode!=modeCWU && mode!=modeCWL) { + if(protocol==NEW_PROTOCOL || (mode!=modeCWU && mode!=modeCWL)) { mox_cb(NULL,NULL); } fprintf(stderr,"ptt_update: mox=%d ptt=%d tune=%d\n",mox,ptt,tune); diff --git a/toolbar.h b/toolbar.h index e717e80..8ade0a4 100644 --- a/toolbar.h +++ b/toolbar.h @@ -17,6 +17,9 @@ * */ +#ifndef _TOOLBAR_H +#define _TOOLBAR_H + extern int function; void update_toolbar_labels(); @@ -34,3 +37,5 @@ void sim_agc_cb(GtkWidget *widget, gpointer data); void sim_function_cb(GtkWidget *widget, gpointer data); GtkWidget *toolbar_init(int my_width, int my_height, GtkWidget* parent); + +#endif diff --git a/version.h b/version.h index 6507867..694d25d 100644 --- a/version.h +++ b/version.h @@ -17,6 +17,10 @@ * */ +#ifndef _VERSION_H +#define _VERSION_H + extern char build_version[]; extern char build_date[]; +#endif diff --git a/vfo.h b/vfo.h index 008e8e0..e967d3b 100644 --- a/vfo.h +++ b/vfo.h @@ -17,8 +17,12 @@ * */ +#ifndef _VFO_H +#define _VFO_H GtkWidget* vfo_init(int width,int height,GtkWidget *parent); void vfo_step(int steps); void vfo_move(int hz); int vfo_update(void*); + +#endif diff --git a/waterfall.h b/waterfall.h index c656298..6278c38 100644 --- a/waterfall.h +++ b/waterfall.h @@ -17,6 +17,10 @@ * */ +#ifndef _WATERFALL_H +#define _WATERFALL_H void waterfall_update(float *data); GtkWidget* waterfall_init(int width,int height); + +#endif diff --git a/wdsp_init.h b/wdsp_init.h index 72e89a9..eb49fd2 100644 --- a/wdsp_init.h +++ b/wdsp_init.h @@ -17,6 +17,9 @@ * */ +#ifndef _WDSP_INIT_H +#define _WDSP_INIT_H + extern void wdsp_set_input_rate(double rate); extern void wdsp_set_offset(long long offset); extern void setMode(int m); @@ -27,3 +30,5 @@ extern int getFilterHigh(); extern void wdsp_init(int rx,int pixels,int protocol); extern void wdsp_new_sample_rate(int rate); extern void wdsp_set_agc(int rx, int agc); + +#endif diff --git a/xvtr.h b/xvtr.h index 4c8f448..697b1c2 100644 --- a/xvtr.h +++ b/xvtr.h @@ -17,6 +17,9 @@ * */ +#ifndef _XVTR_H +#define _XVTR_H + /* --------------------------------------------------------------------------*/ /** * @brief XVTR definition @@ -47,3 +50,4 @@ struct _XVTR_ENTRY { typedef struct _XVTR_ENTRY XVTR_ENTRY; +#endif