From 45a0ddac2aaf3c66b0fc4593f0c91d2b71390eb4 Mon Sep 17 00:00:00 2001 From: c vw Date: Mon, 4 Nov 2019 16:34:44 +0100 Subject: [PATCH] Label RX1 correctly when in diversity mode --- rx_panadapter.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/rx_panadapter.c b/rx_panadapter.c index 7ba22ac..adf34b3 100644 --- a/rx_panadapter.c +++ b/rx_panadapter.c @@ -146,8 +146,18 @@ void rx_panadapter_update(RECEIVER *rx) { int mode=vfo[rx->id].mode; long long frequency=vfo[rx->id].frequency; + int vfoband=vfo[rx->id].band; + long long offset = vfo[rx->id].ctun ? vfo[rx->id].offset : 0; + + // In diversity mode, the RX1 frequency tracks the RX0 frequency + if (diversity_enabled && rx->id == 1) { + frequency=vfo[0].frequency; + vfoband=vfo[0].band; + mode=vfo[0].mode; + } + + BAND *band=band_get_band(vfoband); long half=(long)rx->sample_rate/2L; - BAND *band=band_get_band(vfo[rx->id].band); double vfofreq=(double) display_width * 0.5; // @@ -175,7 +185,7 @@ void rx_panadapter_update(RECEIVER *rx) { long long min_display=frequency-half; long long max_display=frequency+half; - if(vfo[rx->id].band==band60) { + if(vfoband==band60) { for(i=0;ifilter_low+vfo[rx->id].offset)/HzPerPixel); - filter_right=(double)display_width*0.5 +(((double)rx->filter_high+vfo[rx->id].offset)/HzPerPixel); + filter_left =(double)display_width*0.5 +(((double)rx->filter_low+offset)/HzPerPixel); + filter_right=(double)display_width*0.5 +(((double)rx->filter_high+offset)/HzPerPixel); cairo_rectangle(cr, filter_left, 0.0, filter_right-filter_left, (double)display_height); cairo_fill(cr); @@ -207,7 +217,7 @@ void rx_panadapter_update(RECEIVER *rx) { // Draw the "yellow line" indicating the CW frequency when // it is not the VFO freq // - if (!cw_is_on_vfo_freq && (vfo[rx->id].mode==modeCWU || vfo[rx->id].mode==modeCWL)) { + if (!cw_is_on_vfo_freq && (mode==modeCWU || mode==modeCWL)) { if(active) { cairo_set_source_rgb (cr, 1.0, 1.0, 0.0); } else { @@ -296,7 +306,7 @@ void rx_panadapter_update(RECEIVER *rx) { } cairo_stroke(cr); - if(vfo[rx->id].band!=band60) { + if(vfoband!=band60) { // band edges if(band->frequencyMin!=0LL) { cairo_set_source_rgb (cr, 1.0, 0.0, 0.0); @@ -376,8 +386,8 @@ void rx_panadapter_update(RECEIVER *rx) { cairo_set_source_rgb (cr, 0.5, 0.0, 0.0); } cairo_set_line_width(cr, 1.0); - cairo_move_to(cr,vfofreq+(vfo[rx->id].offset/HzPerPixel),0.0); - cairo_line_to(cr,vfofreq+(vfo[rx->id].offset/HzPerPixel),(double)display_height); + cairo_move_to(cr,vfofreq+(offset/HzPerPixel),0.0); + cairo_line_to(cr,vfofreq+(offset/HzPerPixel),(double)display_height); cairo_stroke(cr); // signal -- 2.45.2