]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
Changed S9 Meter reading to -93dBm for frequencies above 30MHz
authorJohn Melton G0ORX <john.d.melton@googlemail.com>
Sun, 1 Mar 2020 16:48:28 +0000 (16:48 +0000)
committerJohn Melton G0ORX <john.d.melton@googlemail.com>
Sun, 1 Mar 2020 16:48:28 +0000 (16:48 +0000)
meter.c

diff --git a/meter.c b/meter.c
index f77b9f5d8ed35a877b685903fa7d4b59d8630636..1a691d51cad21ef5f4696e10dcdba8665df10a29 100644 (file)
--- a/meter.c
+++ b/meter.c
@@ -33,6 +33,7 @@
 #include "mode.h"
 #include "vox.h"
 #include "new_menu.h"
+#include "vfo.h"
 
 static GtkWidget *parent_window;
 
@@ -298,6 +299,13 @@ if(analog_meter) {
       cairo_set_source_rgb(cr, 1.0, 1.0, 1.0);
 
       angle=fmax(-127.0,level)+127.0+offset;
+
+      // if frequency > 30MHz then -93 is S9
+      if(vfo[active_receiver->id].frequency>30000000LL) {
+        angle=angle+20;
+      }
+     
+      
       radians=angle*M_PI/180.0;
       cairo_arc(cr, cx, cy, radius+8, radians, radians);
       cairo_line_to(cr, cx, cy);
@@ -593,8 +601,6 @@ if(analog_meter) {
       }
 
       if(meter_width>=114) {
-        //int db=meter_width/114; // S9+60 (9*6)+60
-        //if(db>2) db=2;
         int db=1;
         int i;
         cairo_set_line_width(cr, 1.0);
@@ -636,15 +642,21 @@ if(analog_meter) {
         cairo_show_text(cr, "+60");
 
         cairo_set_source_rgb(cr, 0.0, 1.0, 0.0);
-        cairo_rectangle(cr, offset+0.0, (double)(meter_height-40), (double)((fmax(-127.0,level)+127.0)*db), 20.0);
+        // if frequency > 30MHz then -93 is S9
+        double l=fmax(-127.0,level);
+        if(vfo[active_receiver->id].frequency>30000000LL) {
+          l=level+20.0;
+        }
+        
+        cairo_rectangle(cr, offset+0.0, (double)(meter_height-40), (double)((l+127.0)*db), 20.0);
         cairo_fill(cr);
 
-        if(level>max_level || max_count==10) {
-          max_level=level;
+        if(l>max_level || max_count==10) {
+          max_level=l;
           max_count=0;
         }
 
-        if(max_level!=0) {
+        if(l!=0) {
           cairo_set_source_rgb(cr, 1.0, 1.0, 0.0);
           cairo_move_to(cr,offset+(double)((max_level+127.0)*db),(double)meter_height-20);
           cairo_line_to(cr,offset+(double)((max_level+127.0)*db),(double)(meter_height-40));