From 5ff57934b4ef44d40fedb1d191913100a88fcc59 Mon Sep 17 00:00:00 2001 From: m5evt <> Date: Tue, 19 Oct 2021 12:25:41 +0100 Subject: [PATCH 01/11] Fix noise blanker Noise blanker was not updated when selected. New coefficients taken from dl1ycf experiments with pihpsdr. --- receiver.c | 5 +++-- vfo.c | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/receiver.c b/receiver.c index c26b112..86611be 100644 --- a/receiver.c +++ b/receiver.c @@ -1824,8 +1824,9 @@ g_print("create_receiver: OpenChannel: channel=%d buffer_size=%d sample_rate=%d 1, // run 0.010, 0.025, 0.0, 0.010, 0); - create_anbEXT(rx->channel,1,rx->buffer_size,rx->sample_rate,0.0001,0.0001,0.0001,0.05,20); - create_nobEXT(rx->channel,1,0,rx->buffer_size,rx->sample_rate,0.0001,0.0001,0.0001,0.05,20); + // Modified per pihpsdr commit d9af51206087959083feddcb325443d9368dad8c + create_anbEXT(rx->channel, 1, rx->buffer_size, rx->sample_rate, 0.00001, 0.00001, 0.00001, 0.05, 4.95); + create_nobEXT(rx->channel,1, 0, rx->buffer_size, rx->sample_rate, 0.00001, 0.00001, 0.00001, 0.05, 4.95); RXASetNC(rx->channel, rx->fft_size); RXASetMP(rx->channel, rx->low_latency); #ifdef SOAPYSDR diff --git a/vfo.c b/vfo.c index 4c7eb98..16a199e 100644 --- a/vfo.c +++ b/vfo.c @@ -677,11 +677,13 @@ static gboolean nr_b_pressed_cb(GtkWidget *widget,GdkEventButton *event,gpointer static void snb_b_cb(GtkToggleButton *widget,gpointer user_data) { RECEIVER *rx=(RECEIVER *)user_data; rx->snb=gtk_toggle_button_get_active(widget); + update_noise(rx); } static void anf_b_cb(GtkToggleButton *widget,gpointer user_data) { RECEIVER *rx=(RECEIVER *)user_data; rx->anf=gtk_toggle_button_get_active(widget); + update_noise(rx); } static void bpsk_b_cb(GtkToggleButton *widget,gpointer user_data) { From a170c96abd9004e9b4e0f51b12591919f0b7c8c6 Mon Sep 17 00:00:00 2001 From: m5evt <> Date: Tue, 19 Oct 2021 12:46:34 +0100 Subject: [PATCH 02/11] Default comment out CWdaemon in Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e8c9c89..e686134 100644 --- a/Makefile +++ b/Makefile @@ -59,7 +59,7 @@ ifeq ($(UNAME_S), Linux) # needs : # https://github.com/m5evt/unixcw-3.5.1.git -CWDAEMON_INCLUDE=CWDAEMON +#CWDAEMON_INCLUDE=CWDAEMON ifeq ($(CWDAEMON_INCLUDE),CWDAEMON) CWDAEMON_OPTIONS=-D CWDAEMON From 8e7fd131ded67f0dfe4a4b24baaaecf64c6c1d95 Mon Sep 17 00:00:00 2001 From: m5evt <> Date: Tue, 19 Oct 2021 14:37:08 +0100 Subject: [PATCH 03/11] Stop scrolling to a negative frequency in vfo --- receiver.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/receiver.c b/receiver.c index 86611be..90cd5a8 100644 --- a/receiver.c +++ b/receiver.c @@ -770,6 +770,8 @@ void update_frequency(RECEIVER *rx) { long long receiver_move_a(RECEIVER *rx,long long hz,gboolean round) { long long delta=0LL; if(!rx->locked) { + // Stop scroll to negative number + if (rx->frequency_a - hz < 0) return 0; if(rx->ctun) { delta=rx->ctun_frequency; rx->ctun_frequency=rx->ctun_frequency+hz; @@ -791,6 +793,8 @@ long long receiver_move_a(RECEIVER *rx,long long hz,gboolean round) { void receiver_move_b(RECEIVER *rx,long long hz,gboolean b_only,gboolean round) { if(!rx->locked) { + // Stop scroll to negative number + if ((rx->frequency_b + hz) <= 0) return; long long f=rx->frequency_b; switch(rx->split) { case SPLIT_OFF: From b0657d4027519201f376d767fe098788a06e6c64 Mon Sep 17 00:00:00 2001 From: m5evt <> Date: Tue, 19 Oct 2021 15:00:36 +0100 Subject: [PATCH 04/11] ATLAS fix SM4VEY reported this fix for Atlas. --- protocol1.c | 11 ++++++++--- radio_dialog.c | 9 +++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/protocol1.c b/protocol1.c index 4918111..4fb3927 100644 --- a/protocol1.c +++ b/protocol1.c @@ -1084,10 +1084,12 @@ void ozy_send_buffer() { output_buffer[C2]|=radio->oc_tune<<1; } } else { - output_buffer[C2]|=radio->oc_tune<<1; + // SM4VEY + // output_buffer[C2]|=radio->oc_tune<<1; } } } else { + //Rx output_buffer[C2]|=band->OCrx<<1; } } @@ -1157,7 +1159,9 @@ void ozy_send_buffer() { default: break; } - } else { + //} else { + // SM4VEY Atlas Alex fix + } switch(radio->adc[0].antenna) { case 0: // ANT 1 output_buffer[C4]|=0x00; @@ -1184,7 +1188,8 @@ void ozy_send_buffer() { } break; } - } + //} +//SM4VEY Atlas fix } else { switch(command) { case 1: // tx frequency diff --git a/radio_dialog.c b/radio_dialog.c index 07f3117..e638327 100644 --- a/radio_dialog.c +++ b/radio_dialog.c @@ -122,6 +122,8 @@ static void radio_dialog_update_controls() { radio->filter_board=N2ADR; break; case ATLAS: + radio->filter_board=ALEX; + break; case HERMES: case HERMES_2: case ANGELIA: @@ -178,6 +180,13 @@ static void radio_dialog_update_controls() { case SOAPY_DEVICE: break; #endif + case ATLAS: + gtk_widget_set_sensitive(adc0_antenna_combo_box, TRUE); + gtk_widget_set_sensitive(adc0_filters_combo_box, TRUE); + gtk_widget_set_sensitive(adc0_lpf_combo_box, TRUE); + gtk_widget_set_sensitive(adc0_hpf_combo_box, TRUE); + break; + default: g_print("%s: defualt set_sensitive\n",__FUNCTION__); gtk_widget_set_sensitive(adc0_antenna_combo_box, FALSE); From 6194116a51d0c664d92bb0961434c6a6fd9bb12a Mon Sep 17 00:00:00 2001 From: m5evt <> Date: Tue, 19 Oct 2021 15:02:21 +0100 Subject: [PATCH 05/11] Fix occasional ethernet packet delays During extensive monitoring of HL2 packets to/from linHPSDR, it was noted that sometimes there were delays in packets being processed by linHPSDR. This gives high priority to the socket --- protocol1.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/protocol1.c b/protocol1.c index 4fb3927..2a07ee9 100644 --- a/protocol1.c +++ b/protocol1.c @@ -333,6 +333,10 @@ static void start_protocol1_thread() { if(setsockopt(data_socket, SOL_SOCKET, SO_REUSEPORT, &optval, sizeof(optval))<0) { perror("data_socket: SO_REUSEPORT"); } + optval = 6; + if(setsockopt(data_socket, SOL_SOCKET, SO_PRIORITY, &optval, sizeof(optval))<0) { + perror("data_socket: SO_PRIORITY"); + } // bind to the interface if(bind(data_socket,(struct sockaddr*)&radio->discovered->info.network.interface_address,radio->discovered->info.network.interface_length)<0) { From ea9519a3287b2feb88ded3411af00b28f6fb3579 Mon Sep 17 00:00:00 2001 From: m5evt <> Date: Tue, 19 Oct 2021 15:17:25 +0100 Subject: [PATCH 06/11] Refactor mode query protocol1 Not a bug fix. Move repeated mode calls into a query function in transmitter.c --- protocol1.c | 88 +++++++-------------------------------------------- transmitter.c | 48 +++++++++++----------------- transmitter.h | 2 +- 3 files changed, 31 insertions(+), 107 deletions(-) diff --git a/protocol1.c b/protocol1.c index 2a07ee9..890414d 100644 --- a/protocol1.c +++ b/protocol1.c @@ -452,21 +452,8 @@ static void process_control_bytes() { //gboolean previous_dot; //gboolean previous_dash; - gint tx_mode=USB; - - RECEIVER *tx_receiver=radio->transmitter->rx; - if(tx_receiver!=NULL) { -#ifdef USE_VFO_B_MODE_AND_FILTER - if(radio->transmitter->rx->split) { - tx_mode=tx_receiver->mode_b; - } else { -#endif - tx_mode=tx_receiver->mode_a; -#ifdef USE_VFO_B_MODE_AND_FILTER - } -#endif - } - + gint tx_mode = transmitter_get_mode(radio->transmitter); + previous_ptt=radio->local_ptt; //previous_dot=radio->dot; //previous_dash=radio->dash; @@ -700,20 +687,7 @@ static void process_ozy_input_buffer(char *buffer) { double right_sample_double_tx; int nreceivers; - gint tx_mode=USB; - - RECEIVER *tx_receiver=radio->transmitter->rx; - if(tx_receiver!=NULL) { -#ifdef USE_VFO_B_MODE_AND_FILTER - if(radio->transmitter->rx->split) { - tx_mode=tx_receiver->mode_b; - } else { -#endif - tx_mode=tx_receiver->mode_a; -#ifdef USE_VFO_B_MODE_AND_FILTER - } -#endif - } + gint tx_mode = transmitter_get_mode(radio->transmitter); if(buffer[b++]==SYNC && buffer[b++]==SYNC && buffer[b++]==SYNC) { // extract control bytes @@ -1058,11 +1032,9 @@ void ozy_send_buffer() { if (radio->discovered->device == DEVICE_METIS) #endif { - if (radio->atlas_mic_source) - output_buffer[C1] |= PENELOPE_MIC; + if (radio->atlas_mic_source) output_buffer[C1] |= PENELOPE_MIC; output_buffer[C1] |= CONFIG_BOTH; - if (radio->atlas_clock_source_128mhz) - output_buffer[C1] |= MERCURY_122_88MHZ_SOURCE; + if (radio->atlas_clock_source_128mhz) output_buffer[C1] |= MERCURY_122_88MHZ_SOURCE; output_buffer[C1] |= ((radio->atlas_clock_source_10mhz & 3) << 2); } @@ -1291,21 +1263,7 @@ void ozy_send_buffer() { break; case 3: { - - gint tx_mode=USB; - tx_receiver=radio->transmitter->rx; - if(tx_receiver!=NULL) { -#ifdef USE_VFO_B_MODE_AND_FILTER - if(radio->transmitter->rx->split) { - tx_mode=tx_receiver->mode_b; - } else { -#endif - tx_mode=tx_receiver->mode_a; -#ifdef USE_VFO_B_MODE_AND_FILTER - } -#endif - } - + gint tx_mode = transmitter_get_mode(radio->transmitter); int level=0; // Always send TX drive level for CW mode @@ -1469,6 +1427,7 @@ void ozy_send_buffer() { output_buffer[C4]=0x00; if(radio->discovered->device==DEVICE_HERMES_LITE2) { + // HL2 full AD9866 gain range -12 dB (0) to 48 dB (60) output_buffer[C4]=0x40; // HL2 extends into [5:0] of this buffer output_buffer[C4]|=(((int)radio->adc[0].attenuation + 12)&0x3F); @@ -1539,27 +1498,15 @@ void ozy_send_buffer() { #endif output_buffer[C3]=0x00; output_buffer[C3]|=radio->transmitter->attenuation; + // Enabled HL2 hardware managed LNA gain during TX if(radio->discovered->device==DEVICE_HERMES_LITE2) output_buffer[C3]|=0x80; output_buffer[C4]=0x00; break; case 7: output_buffer[C0]=0x1E; - - gint tx_mode=USB; - tx_receiver=radio->transmitter->rx; - if(tx_receiver!=NULL) { -#ifdef USE_VFO_B_MODE_AND_FILTER - if(radio->transmitter->rx->split) { - tx_mode=tx_receiver->mode_b; - } else { -#endif - tx_mode=tx_receiver->mode_a; -#ifdef USE_VFO_B_MODE_AND_FILTER - } -#endif - } - output_buffer[C1]=0x00; + + gint tx_mode = transmitter_get_mode(radio->transmitter); if(tx_mode!=CWU && tx_mode!=CWL) { // output_buffer[C1]|=0x00; } else { @@ -1631,20 +1578,7 @@ void ozy_send_buffer() { } // set mox - gint tx_mode=USB; - tx_receiver=radio->transmitter->rx; - if(tx_receiver!=NULL) { -#ifdef USE_VFO_B_MODE_AND_FILTER - if(radio->transmitter->rx->split) { - tx_mode=tx_receiver->mode_b; - } else { -#endif - tx_mode=tx_receiver->mode_a; -#ifdef USE_VFO_B_MODE_AND_FILTER - } -#endif - } - + gint tx_mode = transmitter_get_mode(radio->transmitter); if(tx_mode==CWU || tx_mode==CWL) { if(radio->tune) { output_buffer[C0]|=0x01; diff --git a/transmitter.c b/transmitter.c index c68494e..6707a89 100644 --- a/transmitter.c +++ b/transmitter.c @@ -630,6 +630,22 @@ int SendTXpacketQuery(TRANSMITTER *tx) { return 0; } +int transmitter_get_mode(TRANSMITTER *tx) { + gint tx_mode = USB; + RECEIVER *tx_receiver = tx->rx; + if(tx_receiver!=NULL) { +#ifdef USE_VFO_B_MODE_AND_FILTER + if(tx_receiver->split) { + tx_mode = tx_receiver->mode_b; + } else { +#endif + tx_mode = tx_receiver->mode_a; +#ifdef USE_VFO_B_MODE_AND_FILTER + } +#endif + } + return tx_mode; +} // Protocol 1 receive thread calls this, to send 126 iq samples in a // tx packet @@ -714,9 +730,6 @@ void full_tx_buffer_process(TRANSMITTER *tx) { return; } - - - if(isTransmitting(radio)) { if(radio->classE) { for(j=0;joutput_samples;j++) { @@ -765,13 +778,6 @@ void full_tx_buffer_process(TRANSMITTER *tx) { soapy_protocol_iq_samples((float)isample,(float)qsample); break; #endif -/* -#ifdef RADIOBERRY - case RADIOBERRY_PROTOCOL: - radioberry_protocol_iq_samples(isample,qsample); - break; -#endif -*/ } } } @@ -783,7 +789,7 @@ void add_mic_sample(TRANSMITTER *tx,float mic_sample) { double mic_sample_double; if(tx->rx!=NULL) { - mode=tx->rx->mode_a; + mode= transmitter_get_mode(tx); if(mode==CWL || mode==CWU || radio->tune) { mic_sample_double=0.0; @@ -803,14 +809,8 @@ void add_mic_sample(TRANSMITTER *tx,float mic_sample) { void transmitter_set_filter(TRANSMITTER *tx,int low,int high) { - gint mode=USB; - if(tx->rx!=NULL) { - if(tx->rx->split) { - mode=tx->rx->mode_b; - } else { - mode=tx->rx->mode_a; - } - } + gint mode = transmitter_get_mode(tx); + if(tx->use_rx_filter) { RECEIVER *rx=tx->rx; FILTER *mode_filters=filters[mode]; @@ -903,16 +903,6 @@ void transmitter_set_pre_emphasize(TRANSMITTER *tx,int state) { SetTXAFMEmphPosition(tx->channel,state); } -/* TO REMOVE -static gboolean transmitter_configure_event_cb(GtkWidget *widget,GdkEventConfigure *event,gpointer data) { - TRANSMITTER *tx=(TRANSMITTER *)data; - tx->window_width=gtk_widget_get_allocated_width(widget); - tx->window_height=gtk_widget_get_allocated_height(widget); - g_print("transmitter_configure_event_cb: wid=%d height=%d\n",tx->window_width,tx->window_height); - return TRUE; -} -*/ - static void create_visual(TRANSMITTER *tx) { tx->panadapter=create_tx_panadapter(tx); } diff --git a/transmitter.h b/transmitter.h index 2ff7b49..a6770a5 100644 --- a/transmitter.h +++ b/transmitter.h @@ -168,7 +168,7 @@ extern void transmitter_set_ps(TRANSMITTER *tx,gboolean state); extern void transmitter_set_twotone(TRANSMITTER *tx,gboolean state); extern void transmitter_set_ps_sample_rate(TRANSMITTER *tx,int rate); -extern void QueueInit(void); +extern int transmitter_get_mode(TRANSMITTER *tx); extern void full_tx_buffer(TRANSMITTER *tx); extern void transmitter_enable_eer(TRANSMITTER *tx,gboolean state); From 3536f4dacf757a5e31b8906c87a0f5971636c678 Mon Sep 17 00:00:00 2001 From: m5evt <> Date: Tue, 19 Oct 2021 15:21:05 +0100 Subject: [PATCH 07/11] Fix Airband frequency range --- band.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/band.c b/band.c index d0453e3..4afb793 100644 --- a/band.c +++ b/band.c @@ -292,7 +292,7 @@ BAND bands[BANDS+XVTRS] = {"1240",&bandstack1240,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,1240000000LL,1300000000LL,0LL,0LL,0,-140,-60,20,-145,-65,1}, {"2300",&bandstack2300,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,2300000000LL,2450000000LL,0LL,0LL,0,-140,-60,20,-145,-65,1}, {"3400",&bandstack3400,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,3400000000LL,3410000000LL,0LL,0LL,0,-140,-60,20,-145,-65,1}, - {"AIR",&bandstackAIR,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,10800000LL,137000000LL,0LL,0LL,0,-140,-60,20,-145,-65,1}, + {"AIR",&bandstackAIR,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,108000000LL,137000000LL,0LL,0LL,0,-140,-60,20,-145,-65,1}, #endif {"GEN",&bandstackGEN,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,0LL,0LL,0LL,0LL,0,-140,-60,20,-145,-65,1}, {"WWV",&bandstackWWV,0,0,0,0,0,ALEX_ATTENUATION_0dB,53.0,0LL,0LL,0LL,0LL,0,-140,-60,20,-145,-65,1}, From 11143419e7c706f2e0b228cf4f03a8b206203ce8 Mon Sep 17 00:00:00 2001 From: m5evt <> Date: Tue, 19 Oct 2021 15:27:08 +0100 Subject: [PATCH 08/11] Remove some compiler warnings --- audio.c | 50 ++++++++++---------------------------------------- 1 file changed, 10 insertions(+), 40 deletions(-) diff --git a/audio.c b/audio.c index 42dbeff..15ac094 100644 --- a/audio.c +++ b/audio.c @@ -764,37 +764,6 @@ g_print("audio_close_input: free mic buffer\n"); } } -/* Unused function -int audio_write_buffer(RECEIVER *rx) { - int rc; - int err; - switch(radio->which_audio) { - case USE_SOUNDIO: - g_mutex_lock(&rx->local_audio_mutex); - char *buf = soundio_ring_buffer_write_ptr(rx->ring_buffer); - int fill_count = rx->output_samples*sizeof(float)*2; - memcpy(buf, rx->local_audio_buffer, fill_count); - soundio_ring_buffer_advance_write_ptr(rx->ring_buffer, fill_count); - g_mutex_unlock(&rx->local_audio_mutex); - break; -#ifndef __APPLE__ - case USE_PULSEAUDIO: - g_mutex_lock(&rx->local_audio_mutex); - rc=pa_simple_write(rx->playstream, - rx->local_audio_buffer, - rx->output_samples*sizeof(float)*2, - &err); - if(rc!=0) { - fprintf(stderr,"audio_write buffer=%p length=%d returned %d err=%d\n",rx->local_audio_buffer,rx->output_samples,rc,err); - } - g_mutex_unlock(&rx->local_audio_mutex); - break; -#endif - } - return rc; -} -*/ - void audio_start_output(RECEIVER *rx) { int err; switch(radio->which_audio) { @@ -1035,7 +1004,7 @@ fprintf(stderr,"mic_read_thread: ALSA: mic_buffer_size=%d\n",radio->local_microp //g_print("mic_read_thread: -EPIPE: snd_pcm_prepare\n"); if ((rc = snd_pcm_prepare (r->record_handle)) < 0) { g_print("mic_read_thread: ALSA: cannot prepare audio interface for use %d (%s)\n", rc, snd_strerror (rc)); - return rc; + //return rc; } } else { fprintf (stderr, "mic_read_thread: ALSA: read from audio interface failed (%s)\n", @@ -1084,10 +1053,11 @@ static void source_list_cb(pa_context *context,const pa_source_info *s,int eol,v } } else if(n_input_devicesname)+1); - strncpy(input_devices[n_input_devices].name,s->name,strlen(s->name)); + memcpy(input_devices[n_input_devices].name, s->name, strlen(s->name)); input_devices[n_input_devices].description=g_new0(char,strlen(s->description)+1); - strncpy(input_devices[n_input_devices].description,s->description,strlen(s->description)); + memcpy(input_devices[n_input_devices].description,s->description, strlen(s->description)); input_devices[n_input_devices].index=s->index; + n_input_devices++; } } @@ -1101,9 +1071,9 @@ static void sink_list_cb(pa_context *context,const pa_sink_info *s,int eol,void op=pa_context_get_source_info_list(pa_ctx,source_list_cb,NULL); } else if(n_output_devicesname)+1); - strncpy(output_devices[n_output_devices].name,s->name,strlen(s->name)); + memcpy(output_devices[n_output_devices].name,s->name,strlen(s->name)); output_devices[n_output_devices].description=g_new0(char,strlen(s->description)+1); - strncpy(output_devices[n_output_devices].description,s->description,strlen(s->description)); + memcpy(output_devices[n_output_devices].description,s->description,strlen(s->description)); output_devices[n_output_devices].index=s->index; n_output_devices++; } @@ -1189,9 +1159,9 @@ g_print("audio: create_audio: USE_SOUNDIO: %d %s\n",soundio_get_backend(soundio, } output_devices[n_output_devices].name=g_new0(char,strlen(device->name)+1); - strncpy(output_devices[n_output_devices].name,device->name,strlen(device->name)); + memcpy(output_devices[n_output_devices].name,device->name,strlen(device->name)); output_devices[n_output_devices].description=g_new0(char,strlen(device->name)+1); - strncpy(output_devices[n_output_devices].description,device->name,strlen(device->name)); + memcpy(output_devices[n_output_devices].description,device->name,strlen(device->name)); output_devices[n_output_devices].index=i; soundio_device_unref(device); n_output_devices++; @@ -1202,9 +1172,9 @@ g_print("audio: create_audio: USE_SOUNDIO: %d %s\n",soundio_get_backend(soundio, if(n_input_devicesname)+1); - strncpy(input_devices[n_input_devices].name,device->name,strlen(device->name)); + memcpy(input_devices[n_input_devices].name,device->name,strlen(device->name)); input_devices[n_input_devices].description=g_new0(char,strlen(device->name)+1); - strncpy(input_devices[n_input_devices].description,device->name,strlen(device->name)); + memcpy(input_devices[n_input_devices].description,device->name,strlen(device->name)); input_devices[n_input_devices].index=i; soundio_device_unref(device); n_input_devices++; From 9c265d473d818ff870f863cfe63e51331b338f92 Mon Sep 17 00:00:00 2001 From: m5evt <> Date: Tue, 19 Oct 2021 15:38:24 +0100 Subject: [PATCH 09/11] Display CAT in radio_info when client connects Perhaps this is by design? However, currently, the radio_info button for CAT displays active when CAT daemon is enabled. This only sets active when a client has connected to that RX cat daemon. --- radio_info.c | 2 ++ receiver.c | 1 + receiver.h | 1 + rigctl.c | 3 +++ 4 files changed, 7 insertions(+) diff --git a/radio_info.c b/radio_info.c index 3bd5b21..9dec12b 100644 --- a/radio_info.c +++ b/radio_info.c @@ -136,6 +136,8 @@ void update_radio_info(RECEIVER *rx) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(info->swr_b),radio->transmitter->swr>radio->swr_alarm_value); } + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(info->cat_b), rx->cat_client_connected); + #ifdef MIDI gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(info->midi_b),radio->midi_enabled && (radio->receiver[midi_rx]->channel==rx->channel)); #endif diff --git a/receiver.c b/receiver.c index 90cd5a8..7caea00 100644 --- a/receiver.c +++ b/receiver.c @@ -1786,6 +1786,7 @@ fprintf(stderr,"create_receiver: fft_size=%d\n",rx->fft_size); rx->rigctl_port=19090+rx->channel; rx->rigctl_enable=FALSE; + rx->cat_client_connected = FALSE; strcpy(rx->rigctl_serial_port,"/dev/ttyACM0"); rx->rigctl_serial_baudrate=B9600; diff --git a/receiver.h b/receiver.h index 15ca9b3..7861e30 100644 --- a/receiver.h +++ b/receiver.h @@ -265,6 +265,7 @@ typedef struct _receiver { gint rigctl_port; gboolean rigctl_enable; + gboolean cat_client_connected; GtkWidget *serial_port_entry; char rigctl_serial_port[80]; diff --git a/rigctl.c b/rigctl.c index b22f52e..961fc8d 100644 --- a/rigctl.c +++ b/rigctl.c @@ -703,6 +703,7 @@ static void rigctl_client(RECEIVER *rx) { g_print("%s: starting rigctl_client: socket=%d\n",__FUNCTION__,rigctl->socket_fd); + rx->cat_client_connected = TRUE; rigctl->socket_running=TRUE; while(rigctl->socket_running && (numbytes=recv(rigctl->socket_fd , cmd_input , MAXDATASIZE-2 , 0)) > 0 ) { for(i=0;icat_client_connected = FALSE; + perror("recv"); g_print("%s: running=%d numbytes=%d\n",__FUNCTION__,rigctl->socket_running,numbytes); } From f9f442b1eed8a2910ff7222acf7dd01ac6d3ad3e Mon Sep 17 00:00:00 2001 From: m5evt <> Date: Thu, 28 Apr 2022 10:50:48 +0100 Subject: [PATCH 10/11] Resolve conflicts --- Makefile | 302 ++----------------------------------------------- Makefile.linux | 281 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 292 insertions(+), 291 deletions(-) create mode 100644 Makefile.linux diff --git a/Makefile b/Makefile index e686134..83b8f29 100644 --- a/Makefile +++ b/Makefile @@ -1,306 +1,26 @@ -# find what system we are running on UNAME_S := $(shell uname -s) -# Get git commit version and date -#GIT_VERSION := $(shell git --no-pager describe --tags --always --dirty) -GIT_DATE := $(firstword $(shell git --no-pager show --date=short --format="%ai" --name-only)) -GIT_VERSION := $(shell git describe --abbrev=0 --tags) - -CC=gcc -LINK=gcc - -GTKINCLUDES=`pkg-config --cflags gtk+-3.0` -GTKLIBS=`pkg-config --libs gtk+-3.0` - -#OPENGL_OPTIONS=-D OPENGL -#OPENGL_INCLUDES=`pkg-config --cflags epoxy` -#OPENGL_LIBS=`pkg-config --libs epoxy` - -ifeq ($(UNAME_S), Linux) -AUDIO_LIBS=-lasound -lpulse-simple -lpulse -lpulse-mainloop-glib -lsoundio -AUDIO_SOURCES=audio.c -AUDIO_HEADRERS=audio.h -endif +all: ifeq ($(UNAME_S), Darwin) -AUDIO_LIBS=-lsoundio -AUDIO_SOURCES=portaudio.c -AUDIO_HEADRERS=portaudio.h + $(MAKE) -f Makefile.mac endif - -# uncomment the line below to include SoapySDR support -# -# Note: SoapySDR support has only been tested with the RTL-SDR and LimeSDR -# No TX support yet. -# -# If you want to build with SoapySDR support you will need to install: -# -# sudo apt-get install libsoapysdr-dev -# sudo apt-get install soapysdr-module-rtlsdr -# sudo apt-get install soapysdr-module-lms7 -# -#SOAPYSDR_INCLUDE=SOAPYSDR - -ifeq ($(SOAPYSDR_INCLUDE),SOAPYSDR) -SOAPYSDR_OPTIONS=-D SOAPYSDR -SOAPYSDR_LIBS=-lSoapySDR -SOAPYSDR_SOURCES= \ -soapy_discovery.c \ -soapy_protocol.c -SOAPYSDR_HEADERS= \ -soapy_discovery.h \ -soapy_protocol.h -SOAPYSDR_OBJS= \ -soapy_discovery.o \ -soapy_protocol.o -endif - ifeq ($(UNAME_S), Linux) -# cwdaemon support. Allows linux based logging software to key an Hermes/HermesLite2 -# needs : -# https://github.com/m5evt/unixcw-3.5.1.git - -#CWDAEMON_INCLUDE=CWDAEMON - -ifeq ($(CWDAEMON_INCLUDE),CWDAEMON) -CWDAEMON_OPTIONS=-D CWDAEMON -CWDAEMON_LIBS=-lcw -CWDAEMON_SOURCES= \ -cwdaemon.c -CWDAEMON_HEADERS= \ -cwdaemon.h -CWDAEMON_OBJS= \ -cwdaemon.o -endif + $(MAKE) -f Makefile.linux endif -# MIDI code from piHPSDR written by Christoph van Wullen, DL1YCF. -MIDI_INCLUDE=MIDI - -ifeq ($(MIDI_INCLUDE),MIDI) -MIDI_OPTIONS=-D MIDI -MIDI_HEADERS= midi.h midi_dialog.h +clean: ifeq ($(UNAME_S), Darwin) -MIDI_SOURCES= mac_midi.c midi2.c midi3.c midi_dialog.c -MIDI_OBJS= mac_midi.o midi2.o midi3.o midi_dialog.o -MIDI_LIBS= -framework CoreMIDI -framework Foundation + $(MAKE) -f Makefile.mac clean endif ifeq ($(UNAME_S), Linux) -MIDI_SOURCES= alsa_midi.c midi2.c midi3.c midi_dialog.c -MIDI_OBJS= alsa_midi.o midi2.o midi3.o midi_dialog.o -MIDI_LIBS= -lasound + $(MAKE) -f Makefile.linux clean endif -endif - -CFLAGS= -g -Wno-deprecated-declarations -O3 -OPTIONS= $(MIDI_OPTIONS) $(AUDIO_OPTIONS) $(SOAPYSDR_OPTIONS) \ - $(CWDAEMON_OPTIONS) $(OPENGL_OPTIONS) \ - -D GIT_DATE='"$(GIT_DATE)"' -D GIT_VERSION='"$(GIT_VERSION)"' -#OPTIONS=-g -Wno-deprecated-declarations $(AUDIO_OPTIONS) -D GIT_DATE='"$(GIT_DATE)"' -D GIT_VERSION='"$(GIT_VERSION)"' -O3 -D FT8_MARKER - -ifeq ($(UNAME_S), Linux) -LIBS=-lrt -lm -lpthread -lwdsp $(GTKLIBS) $(AUDIO_LIBS) $(SOAPYSDR_LIBS) $(CWDAEMON_LIBS) $(OPENGL_LIBS) $(MIDI_LIBS) -endif +install: ifeq ($(UNAME_S), Darwin) -LIBS=-lm -lpthread -lwdsp $(GTKLIBS) $(AUDIO_LIBS) $(SOAPYSDR_LIBS) $(MIDI_LIBS) + $(MAKE) -f Makefile.mac install +endif +ifeq ($(UNAME_S), Linux) + $(MAKE) -f Makefile.linux install endif - -INCLUDES=$(GTKINCLUDES) $(PULSEINCLUDES) $(OPGL_INCLUDES) - -COMPILE=$(CC) $(CFLAGS) $(OPTIONS) $(INCLUDES) - -.c.o: - $(COMPILE) -c -o $@ $< - -PROGRAM=linhpsdr - -SOURCES=\ -main.c\ -css.c\ -audio.c\ -version.c\ -discovered.c\ -discovery.c\ -protocol1_discovery.c\ -protocol2_discovery.c\ -property.c\ -mode.c\ -filter.c\ -band.c\ -radio.c\ -receiver.c\ -transmitter.c\ -vfo.c\ -meter.c\ -rx_panadapter.c\ -tx_panadapter.c\ -mic_level.c\ -mic_gain.c\ -drive_level.c\ -waterfall.c\ -wideband_panadapter.c\ -wideband_waterfall.c\ -protocol1.c\ -protocol2.c\ -radio_dialog.c\ -receiver_dialog.c\ -transmitter_dialog.c\ -pa_dialog.c\ -eer_dialog.c\ -wideband_dialog.c\ -about_dialog.c\ -button_text.c\ -wideband.c\ -vox.c\ -ext.c\ -configure_dialog.c\ -bookmark_dialog.c\ -puresignal_dialog.c\ -oc_dialog.c\ -xvtr_dialog.c\ -frequency.c\ -error_handler.c\ -radio_info.c\ -rigctl.c \ -bpsk.c \ -subrx.c \ -actions.c - -HEADERS=\ -main.h\ -css.h\ -audio.h\ -version.h\ -discovered.h\ -discovery.h\ -protocol1_discovery.h\ -protocol2_discovery.h\ -property.h\ -agc.h\ -mode.h\ -filter.h\ -band.h\ -radio.h\ -receiver.h\ -transmitter.h\ -vfo.h\ -meter.h\ -rx_panadapter.h\ -tx_panadapter.h\ -mic_level.h\ -mic_gain.h\ -drive_level.h\ -wideband_panadapter.h\ -wideband_waterfall.h\ -waterfall.h\ -protocol1.h\ -protocol2.h\ -radio_dialog.h\ -receiver_dialog.h\ -transmitter_dialog.h\ -pa_dialog.h\ -eer_dialog.h\ -wideband_dialog.h\ -about_dialog.h\ -button_text.h\ -wideband.h\ -vox.h\ -ext.h\ -configure_dialog.h\ -bookmark_dialog.h\ -puresignal_dialog.h\ -oc_dialog.h\ -xvtr_dialog.h\ -frequency.h\ -error_handler.h\ -radio_info.h\ -rigctl.h \ -bpsk.h \ -subrx.h \ -actions.h - -OBJS=\ -main.o\ -css.o\ -audio.o\ -version.o\ -discovered.o\ -discovery.o\ -protocol1_discovery.o\ -protocol2_discovery.o\ -property.o\ -mode.o\ -filter.o\ -band.o\ -radio.o\ -receiver.o\ -transmitter.o\ -vfo.o\ -meter.o\ -rx_panadapter.o\ -tx_panadapter.o\ -mic_level.o\ -mic_gain.o\ -drive_level.o\ -wideband_panadapter.o\ -wideband_waterfall.o\ -waterfall.o\ -protocol1.o\ -protocol2.o\ -radio_dialog.o\ -receiver_dialog.o\ -transmitter_dialog.o\ -pa_dialog.o\ -eer_dialog.o\ -wideband_dialog.o\ -about_dialog.o\ -button_text.o\ -wideband.o\ -vox.o\ -ext.o\ -configure_dialog.o\ -bookmark_dialog.o\ -puresignal_dialog.o\ -oc_dialog.o\ -xvtr_dialog.o\ -frequency.o\ -error_handler.o\ -radio_info.o\ -rigctl.o \ -bpsk.o \ -subrx.o \ -actions.o - - -$(PROGRAM): $(OBJS) $(SOAPYSDR_OBJS) $(CWDAEMON_OBJS) $(MIDI_OBJS) - $(LINK) -o $(PROGRAM) $(OBJS) $(SOAPYSDR_OBJS) $(CWDAEMON_OBJS) $(MIDI_OBJS) $(LIBS) - - -all: prebuild $(PROGRAM) $(HEADERS) $(MIDI_HEADERS) $(SOURCES) $(SOAPYSDR_SOURCES) \ - $(CWDAEMON_SOURCES) $(MIDI_SOURCES) - -prebuild: - rm -f version.o - - -clean: - -rm -f *.o - -rm -f $(PROGRAM) - -install: $(PROGRAM) - cp $(PROGRAM) /usr/local/bin - if [ ! -d /usr/share/linhpsdr ]; then mkdir /usr/share/linhpsdr; fi - cp hpsdr.png /usr/share/linhpsdr - cp hpsdr_icon.png /usr/share/linhpsdr - cp hpsdr_small.png /usr/share/linhpsdr - cp linhpsdr.desktop /usr/share/applications - -debian: - cp $(PROGRAM) pkg/linhpsdr/usr/local/bin - cp /usr/local/lib/libwdsp.so pkg/linhpsdr/usr/local/lib - cp hpsdr.png pkg/linhpsdr/usr/share/linhpsdr - cp hpsdr_icon.png pkg/linhpsdr/usr/share/linhpsdr - cp hpsdr_small.png pkg/linhpsdr/usr/share/linhpsdr - cp linhpsdr.desktop pkg/linhpsdr/usr/share/applications - cd pkg; dpkg-deb --build linhpsdr diff --git a/Makefile.linux b/Makefile.linux new file mode 100644 index 0000000..2b92690 --- /dev/null +++ b/Makefile.linux @@ -0,0 +1,281 @@ +# Get git commit version and date +#GIT_VERSION := $(shell git --no-pager describe --tags --always --dirty) +GIT_DATE := $(firstword $(shell git --no-pager show --date=short --format="%ai" --name-only)) +GIT_VERSION := $(shell git describe --abbrev=0 --tags) + +CC=gcc +LINK=gcc + +GTKINCLUDES=`pkg-config --cflags gtk+-3.0` +GTKLIBS=`pkg-config --libs gtk+-3.0` + +#OPENGL_OPTIONS=-D OPENGL +#OPENGL_INCLUDES=`pkg-config --cflags epoxy` +#OPENGL_LIBS=`pkg-config --libs epoxy` + +AUDIO_LIBS=-lasound -lpulse-simple -lpulse -lpulse-mainloop-glib -lsoundio + +# uncomment the line below to include SoapySDR support +# +# Note: SoapySDR support has only been tested with the RTL-SDR and LimeSDR +# No TX support yet. +# +# If you want to build with SoapySDR support you will need to install: +# +# sudo apt-get install libsoapysdr-dev +# sudo apt-get install soapysdr-module-rtlsdr +# sudo apt-get install soapysdr-module-lms7 +# +SOAPYSDR_INCLUDE=SOAPYSDR + +ifeq ($(SOAPYSDR_INCLUDE),SOAPYSDR) +SOAPYSDR_OPTIONS=-D SOAPYSDR +SOAPYSDR_LIBS=-lSoapySDR +SOAPYSDR_SOURCES= \ +soapy_discovery.c \ +soapy_protocol.c +SOAPYSDR_HEADERS= \ +soapy_discovery.h \ +soapy_protocol.h +SOAPYSDR_OBJS= \ +soapy_discovery.o \ +soapy_protocol.o +endif + +# cwdaemon support. Allows linux based logging software to key an Hermes/HermesLite2 +# needs : +# https://github.com/m5evt/unixcw-3.5.1.git + +#CWDAEMON_INCLUDE=CWDAEMON + +ifeq ($(CWDAEMON_INCLUDE),CWDAEMON) +CWDAEMON_OPTIONS=-D CWDAEMON +CWDAEMON_LIBS=-lcw +CWDAEMON_SOURCES= \ +cwdaemon.c +CWDAEMON_HEADERS= \ +cwdaemon.h +CWDAEMON_OBJS= \ +cwdaemon.o +endif +endif + +# MIDI code from piHPSDR written by Christoph van Wullen, DL1YCF. +MIDI_INCLUDE=MIDI + +ifeq ($(MIDI_INCLUDE),MIDI) +MIDI_OPTIONS=-D MIDI +MIDI_SOURCES= alsa_midi.c midi2.c midi3.c midi_dialog.c +MIDI_HEADERS= midi.h midi_dialog.h +MIDI_OBJS= alsa_midi.o midi2.o midi3.o midi_dialog.o +MIDI_LIBS= -lasound +endif +endif + +CFLAGS= -g -Wno-deprecated-declarations -O3 +OPTIONS= $(MIDI_OPTIONS) $(AUDIO_OPTIONS) $(SOAPYSDR_OPTIONS) \ + $(CWDAEMON_OPTIONS) $(OPENGL_OPTIONS) \ + -D GIT_DATE='"$(GIT_DATE)"' -D GIT_VERSION='"$(GIT_VERSION)"' +#OPTIONS=-g -Wno-deprecated-declarations $(AUDIO_OPTIONS) -D GIT_DATE='"$(GIT_DATE)"' -D GIT_VERSION='"$(GIT_VERSION)"' -O3 -D FT8_MARKER + +LIBS=-lrt -lm -lpthread -lwdsp $(GTKLIBS) $(AUDIO_LIBS) $(SOAPYSDR_LIBS) $(CWDAEMON_LIBS) $(OPENGL_LIBS) $(MIDI_LIBS) + +INCLUDES=$(GTKINCLUDES) $(OPGL_INCLUDES) + +COMPILE=$(CC) $(CFLAGS) $(OPTIONS) $(INCLUDES) + +.c.o: + $(COMPILE) -c -o $@ $< + +PROGRAM=linhpsdr + +SOURCES=\ +main.c\ +css.c\ +audio.c\ +version.c\ +discovered.c\ +discovery.c\ +protocol1_discovery.c\ +protocol2_discovery.c\ +property.c\ +mode.c\ +filter.c\ +band.c\ +radio.c\ +receiver.c\ +transmitter.c\ +vfo.c\ +meter.c\ +rx_panadapter.c\ +tx_panadapter.c\ +mic_level.c\ +mic_gain.c\ +drive_level.c\ +waterfall.c\ +wideband_panadapter.c\ +wideband_waterfall.c\ +protocol1.c\ +protocol2.c\ +radio_dialog.c\ +receiver_dialog.c\ +transmitter_dialog.c\ +pa_dialog.c\ +eer_dialog.c\ +wideband_dialog.c\ +about_dialog.c\ +button_text.c\ +wideband.c\ +vox.c\ +ext.c\ +configure_dialog.c\ +bookmark_dialog.c\ +puresignal_dialog.c\ +oc_dialog.c\ +xvtr_dialog.c\ +frequency.c\ +error_handler.c\ +radio_info.c\ +rigctl.c \ +bpsk.c \ +subrx.c \ +actions.c + +HEADERS=\ +main.h\ +css.h\ +audio.h\ +version.h\ +discovered.h\ +discovery.h\ +protocol1_discovery.h\ +protocol2_discovery.h\ +property.h\ +agc.h\ +mode.h\ +filter.h\ +band.h\ +radio.h\ +receiver.h\ +transmitter.h\ +vfo.h\ +meter.h\ +rx_panadapter.h\ +tx_panadapter.h\ +mic_level.h\ +mic_gain.h\ +drive_level.h\ +wideband_panadapter.h\ +wideband_waterfall.h\ +waterfall.h\ +protocol1.h\ +protocol2.h\ +radio_dialog.h\ +receiver_dialog.h\ +transmitter_dialog.h\ +pa_dialog.h\ +eer_dialog.h\ +wideband_dialog.h\ +about_dialog.h\ +button_text.h\ +wideband.h\ +vox.h\ +ext.h\ +configure_dialog.h\ +bookmark_dialog.h\ +puresignal_dialog.h\ +oc_dialog.h\ +xvtr_dialog.h\ +frequency.h\ +error_handler.h\ +radio_info.h\ +rigctl.h \ +bpsk.h \ +subrx.h \ +actions.h + +OBJS=\ +main.o\ +css.o\ +audio.o\ +version.o\ +discovered.o\ +discovery.o\ +protocol1_discovery.o\ +protocol2_discovery.o\ +property.o\ +mode.o\ +filter.o\ +band.o\ +radio.o\ +receiver.o\ +transmitter.o\ +vfo.o\ +meter.o\ +rx_panadapter.o\ +tx_panadapter.o\ +mic_level.o\ +mic_gain.o\ +drive_level.o\ +wideband_panadapter.o\ +wideband_waterfall.o\ +waterfall.o\ +protocol1.o\ +protocol2.o\ +radio_dialog.o\ +receiver_dialog.o\ +transmitter_dialog.o\ +pa_dialog.o\ +eer_dialog.o\ +wideband_dialog.o\ +about_dialog.o\ +button_text.o\ +wideband.o\ +vox.o\ +ext.o\ +configure_dialog.o\ +bookmark_dialog.o\ +puresignal_dialog.o\ +oc_dialog.o\ +xvtr_dialog.o\ +frequency.o\ +error_handler.o\ +radio_info.o\ +rigctl.o \ +bpsk.o \ +subrx.o \ +actions.o + + +$(PROGRAM): $(OBJS) $(SOAPYSDR_OBJS) $(CWDAEMON_OBJS) $(MIDI_OBJS) + $(LINK) -o $(PROGRAM) $(OBJS) $(SOAPYSDR_OBJS) $(CWDAEMON_OBJS) $(MIDI_OBJS) $(LIBS) + + +all: prebuild $(PROGRAM) $(HEADERS) $(MIDI_HEADERS) $(SOURCES) $(SOAPYSDR_SOURCES) \ + $(CWDAEMON_SOURCES) $(MIDI_SOURCES) + +prebuild: + rm -f version.o + + +clean: + -rm -f *.o + -rm -f $(PROGRAM) + +install: $(PROGRAM) + cp $(PROGRAM) /usr/local/bin + if [ ! -d /usr/share/linhpsdr ]; then mkdir /usr/share/linhpsdr; fi + cp hpsdr.png /usr/share/linhpsdr + cp hpsdr_icon.png /usr/share/linhpsdr + cp hpsdr_small.png /usr/share/linhpsdr + cp linhpsdr.desktop /usr/share/applications + +debian: + cp $(PROGRAM) pkg/linhpsdr/usr/local/bin + cp /usr/local/lib/libwdsp.so pkg/linhpsdr/usr/local/lib + cp hpsdr.png pkg/linhpsdr/usr/share/linhpsdr + cp hpsdr_icon.png pkg/linhpsdr/usr/share/linhpsdr + cp hpsdr_small.png pkg/linhpsdr/usr/share/linhpsdr + cp linhpsdr.desktop pkg/linhpsdr/usr/share/applications + cd pkg; dpkg-deb --build linhpsdr + From 08ab2bef3373d6d438a902f8e369f5f14ef249bb Mon Sep 17 00:00:00 2001 From: m5evt <> Date: Thu, 28 Apr 2022 10:56:52 +0100 Subject: [PATCH 11/11] Fix linux makefile --- Makefile.linux | 2 -- audio.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Makefile.linux b/Makefile.linux index 2b92690..d7b30df 100644 --- a/Makefile.linux +++ b/Makefile.linux @@ -58,7 +58,6 @@ cwdaemon.h CWDAEMON_OBJS= \ cwdaemon.o endif -endif # MIDI code from piHPSDR written by Christoph van Wullen, DL1YCF. MIDI_INCLUDE=MIDI @@ -70,7 +69,6 @@ MIDI_HEADERS= midi.h midi_dialog.h MIDI_OBJS= alsa_midi.o midi2.o midi3.o midi_dialog.o MIDI_LIBS= -lasound endif -endif CFLAGS= -g -Wno-deprecated-declarations -O3 OPTIONS= $(MIDI_OPTIONS) $(AUDIO_OPTIONS) $(SOAPYSDR_OPTIONS) \ diff --git a/audio.c b/audio.c index 15ac094..d9b9f1d 100644 --- a/audio.c +++ b/audio.c @@ -1004,7 +1004,7 @@ fprintf(stderr,"mic_read_thread: ALSA: mic_buffer_size=%d\n",radio->local_microp //g_print("mic_read_thread: -EPIPE: snd_pcm_prepare\n"); if ((rc = snd_pcm_prepare (r->record_handle)) < 0) { g_print("mic_read_thread: ALSA: cannot prepare audio interface for use %d (%s)\n", rc, snd_strerror (rc)); - //return rc; + return; } } else { fprintf (stderr, "mic_read_thread: ALSA: read from audio interface failed (%s)\n",