diff --git a/radio.c b/radio.c index aaf8bd24..d65f643e 100644 --- a/radio.c +++ b/radio.c @@ -521,15 +521,17 @@ int downconvert(struct channel *chan){ send_radio_status((struct sockaddr *)&chan->status.dest_socket,&Frontend,chan); chan->status.output_timer = chan->status.output_interval; // Reload FREE(chan->status.command); + reset_radio_status(chan); // After both are sent } else if(chan->status.global_timer != 0 && --chan->status.global_timer <= 0){ // Delayed status request, used mainly by all-channel polls to avoid big bursts send_radio_status((struct sockaddr *)&Metadata_socket,&Frontend,chan); // Send status in response chan->status.global_timer = 0; // to make sure - } - if(!chan->output.silent && chan->status.output_interval != 0 && chan->status.output_timer-- <= 0){ + reset_radio_status(chan); // After both are sent + } else if(!chan->output.silent && chan->status.output_interval != 0 && chan->status.output_timer-- <= 0){ // Send status on output channel send_radio_status((struct sockaddr *)&chan->status.dest_socket,&Frontend,chan); chan->status.output_timer = chan->status.output_interval; // Reload + reset_radio_status(chan); // After both are sent } pthread_mutex_unlock(&chan->status.lock); if(restart_needed) diff --git a/radio.h b/radio.h index 1fc49262..8efcdbd2 100644 --- a/radio.h +++ b/radio.h @@ -297,6 +297,7 @@ void *demod_spectrum(void *); int send_output(struct channel * restrict ,const float * restrict,int,bool); int send_radio_status(struct sockaddr const *,struct frontend const *, struct channel *); +int reset_radio_status(struct channel *chan); bool decode_radio_commands(struct channel *chan,uint8_t const *buffer,int length); int decode_radio_status(struct frontend *frontend,struct channel *channel,uint8_t const *buffer,int length); diff --git a/radio_status.c b/radio_status.c index d590fd98..0a776c70 100644 --- a/radio_status.c +++ b/radio_status.c @@ -89,6 +89,7 @@ void *radio_status(void *arg){ } else { decode_radio_commands(chan,buffer+1,length-1); send_radio_status((struct sockaddr *)&Metadata_socket,&Frontend,chan); // Send status in response + reset_radio_status(chan); chan->status.global_timer = 0; // Just sent one start_demod(chan); if(Verbose) @@ -104,15 +105,17 @@ void *radio_status(void *arg){ int send_radio_status(struct sockaddr const *sock,struct frontend const *frontend,struct channel *chan){ uint8_t packet[PKTSIZE]; - chan->status.packets_out++; int const len = encode_radio_status(frontend,chan,packet,sizeof(packet)); + sendto(Output_fd,packet,len,0,sock,sizeof(struct sockaddr)); + return 0; +} +int reset_radio_status(struct channel *chan){ // Reset integrators chan->sig.bb_energy = 0; chan->output.energy = 0; chan->output.sum_gain_sq = 0; chan->status.blocks_since_poll = 0; - sendto(Output_fd,packet,len,0,sock,sizeof(struct sockaddr)); return 0; }