From 926ba7808dc239161963d912e5fbc982f53e1041 Mon Sep 17 00:00:00 2001
From: c vw <dl1ycf@darc.de>
Date: Mon, 13 Jan 2020 19:20:33 +0100
Subject: [PATCH] respect CHARLY25 preamps in RX panadapter

---
 rx_panadapter.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/rx_panadapter.c b/rx_panadapter.c
index ea68b99..14eb2b5 100644
--- a/rx_panadapter.c
+++ b/rx_panadapter.c
@@ -394,6 +394,10 @@ void rx_panadapter_update(RECEIVER *rx) {
   samples[display_width-1]=-200.0;
   s1=(double)samples[0]+(double)adc_attenuation[rx->adc];
   if (filter_board == ALEX && rx->adc == 0) s1 += (double)(10*rx->alex_attenuation);
+  if (filter_board == CHARLY25) {
+    if (rx->preamp) s1 -= 18.0;
+    if (rx->dither) s1 -= 18.0;
+  }
 #ifdef SOAPYSDR
   if(protocol==SOAPYSDR_PROTOCOL) {
     s1-=rx->rf_gain;
@@ -407,6 +411,10 @@ void rx_panadapter_update(RECEIVER *rx) {
   for(i=1;i<display_width;i++) {
     s2=(double)samples[i]+(double)adc_attenuation[rx->adc];
     if (filter_board == ALEX && rx->adc == 0) s2 += (double)(10*rx->alex_attenuation);
+    if (filter_board == CHARLY25) {
+      if (rx->preamp) s2 -= 18.0;
+      if (rx->dither) s2 -= 18.0;
+    }
 #ifdef SOAPYSDR
     if(protocol==SOAPYSDR_PROTOCOL) {
       s2-=rx->rf_gain;
-- 
2.45.2