From: John Melton - G0ORX/N6LYT <john.d.melton@googlemail.com>
Date: Thu, 10 Nov 2016 22:00:03 +0000 (+0000)
Subject: fixed gpio mic gain. used mic gain to adjust mic input when FreeDV. changed font... 
X-Git-Url: https://git.rkrishnan.org/pf/components//%22file:/%22?a=commitdiff_plain;h=3ecaadca369d3c3e84c49fd498d6504ad277e546;p=pihpsdr.git

fixed gpio mic gain. used mic gain to adjust mic input when FreeDV. changed font size in meter.
---

diff --git a/gpio.c b/gpio.c
index af4859d..c542f75 100644
--- a/gpio.c
+++ b/gpio.c
@@ -749,7 +749,8 @@ static int af_encoder_changed(void *data) {
     if(function || isTransmitting()) {
       // mic gain
       double gain=mic_gain;
-      gain+=(double)pos/100.0;
+      //gain+=(double)pos/100.0;
+      gain+=(double)pos;
       if(gain<-10.0) {
         gain=-10.0;
       } else if(gain>50.0) {
diff --git a/meter.c b/meter.c
index 3f7fb7e..0b36cee 100644
--- a/meter.c
+++ b/meter.c
@@ -302,7 +302,7 @@ void meter_update(int meter_type,double value,double reverse,double exciter,doub
         text_location=offset+(db*114)+5;
       }
 
-      cairo_set_font_size(cr, 16);
+      cairo_set_font_size(cr, 12);
       sprintf(sf,"%d dBm",(int)level);
       cairo_move_to(cr, text_location, 45);
       cairo_show_text(cr, sf);
@@ -314,7 +314,7 @@ void meter_update(int meter_type,double value,double reverse,double exciter,doub
         } else {
           cairo_set_source_rgb(cr, 1, 0, 0);
         }
-        cairo_set_font_size(cr, 16);
+        cairo_set_font_size(cr, 12);
         sprintf(sf,"SNR: %3.2f",freedv_snr);
         cairo_move_to(cr, text_location, 30);
         cairo_show_text(cr, sf);
@@ -346,7 +346,7 @@ void meter_update(int meter_type,double value,double reverse,double exciter,doub
       cairo_fill(cr);
 
       cairo_set_source_rgb(cr, 0, 1, 0);
-      cairo_set_font_size(cr, 16);
+      cairo_set_font_size(cr, 12);
       sprintf(sf,"Level: %d",(int)value);
       cairo_move_to(cr, 210, 45);
       cairo_show_text(cr, sf);
@@ -358,7 +358,7 @@ void meter_update(int meter_type,double value,double reverse,double exciter,doub
       cairo_select_font_face(cr, "FreeMono",
             CAIRO_FONT_SLANT_NORMAL,
             CAIRO_FONT_WEIGHT_BOLD);
-      cairo_set_font_size(cr, 18);
+      cairo_set_font_size(cr, 12);
 
       if((int)value>max_level || max_count==10) {
           max_level=(int)value;
@@ -374,7 +374,7 @@ void meter_update(int meter_type,double value,double reverse,double exciter,doub
       cairo_select_font_face(cr, "FreeMono",
             CAIRO_FONT_SLANT_NORMAL,
             CAIRO_FONT_WEIGHT_BOLD);
-      cairo_set_font_size(cr, 18);
+      cairo_set_font_size(cr, 12);
       sprintf(sf,"SWR: %1.1f:1",swr);
       cairo_move_to(cr, 10, 55);
       cairo_show_text(cr, sf);
diff --git a/new_protocol.c b/new_protocol.c
index 4935301..36bfab0 100644
--- a/new_protocol.c
+++ b/new_protocol.c
@@ -883,7 +883,8 @@ static void process_mic_data(unsigned char *buffer) {
                 micsample  = (int)((signed char) buffer[b++]) << 8;
                 micsample  |= (int)((unsigned char)buffer[b++] & 0xFF);
                 if(freedv_samples==0) { // 48K to 8K
-                    int modem_samples=mod_sample_freedv(micsample);
+                    int sample=(int)((double)micsample*pow(10.0, mic_gain / 20.0));
+                    int modem_samples=mod_sample_freedv(sample);
                     if(modem_samples!=0) {
                       for(s=0;s<modem_samples;s++) {
                         for(j=0;j<freedv_resample;j++) {  // 8K to 48K
diff --git a/old_protocol.c b/old_protocol.c
index aeb1536..6304d6b 100644
--- a/old_protocol.c
+++ b/old_protocol.c
@@ -453,7 +453,8 @@ static void process_ozy_input_buffer(char  *buffer) {
 #ifdef FREEDV
         if(mode==modeFREEDV && !tune) {
           if(freedv_samples==0) {
-            int modem_samples=mod_sample_freedv(mic_sample);
+            int sample=(int)((double)mic_sample*pow(10.0, mic_gain / 20.0));
+            int modem_samples=mod_sample_freedv(sample);
             if(modem_samples!=0) {
               int s;
               for(s=0;s<modem_samples;s++) {
diff --git a/pihpsdr b/pihpsdr
index a945910..d69c3c4 100755
Binary files a/pihpsdr and b/pihpsdr differ
diff --git a/release/pihpsdr.tar b/release/pihpsdr.tar
index ae8906f..3a15206 100644
Binary files a/release/pihpsdr.tar and b/release/pihpsdr.tar differ
diff --git a/release/pihpsdr/libwdsp.so b/release/pihpsdr/libwdsp.so
index 82abe26..0ff7a89 100755
Binary files a/release/pihpsdr/libwdsp.so and b/release/pihpsdr/libwdsp.so differ
diff --git a/release/pihpsdr/pihpsdr b/release/pihpsdr/pihpsdr
index 1fc1b64..d69c3c4 100755
Binary files a/release/pihpsdr/pihpsdr and b/release/pihpsdr/pihpsdr differ
diff --git a/release/pihpsdr/pihpsdr.desktop b/release/pihpsdr/pihpsdr.desktop
index 62f6418..aafd4d0 100755
--- a/release/pihpsdr/pihpsdr.desktop
+++ b/release/pihpsdr/pihpsdr.desktop
@@ -8,3 +8,4 @@ Name[en_GB]=pihpsdr
 Exec=/home/pi/pihpsdr/start_pihpsdr.sh
 Name=pihpsdr
 Icon=/home/pi/pihpsdr/hpsdr_icon.png
+Categories=RadioMenuCategory