]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
Small changes to prepeare the "big merge"
authorc vw <dl1ycf@darc.de>
Wed, 19 May 2021 13:46:27 +0000 (15:46 +0200)
committerc vw <dl1ycf@darc.de>
Wed, 19 May 2021 13:46:27 +0000 (15:46 +0200)
agc_menu.c
band_menu.c
bandstack_menu.c
display_menu.c
filter_menu.c
hpsdrsim.c
iambic.c
mode_menu.c
newhpsdrsim.c
vfo.h

index 56702189b2298c1e9a53b7ec22c3e5ab8e249a88..36e2caaf096430885e2b0427161712a09e20d90f 100644 (file)
@@ -43,6 +43,7 @@ static void cleanup() {
     gtk_widget_destroy(dialog);
     dialog=NULL;
     sub_menu=NULL;
+    active_menu=NO_MENU;
   }
 }
 
index 908dafc8faa6eb6da392cb421b2179c1e9a97858..7bbb4720715fe2eeb53580466ce4b8c1da857a2d 100644 (file)
@@ -32,7 +32,9 @@
 #include "receiver.h"
 #include "vfo.h"
 #include "button_text.h"
+#ifdef CLIENT_SERVER
 #include "client_server.h"
+#endif
 
 static GtkWidget *parent_window=NULL;
 
@@ -45,6 +47,7 @@ static void cleanup() {
     gtk_widget_destroy(dialog);
     dialog=NULL;
     sub_menu=NULL;
+    active_menu=NO_MENU;
   }
 }
 
@@ -112,7 +115,7 @@ void band_menu(GtkWidget *parent) {
   long long frequency_min=radio->frequency_min;
   long long frequency_max=radio->frequency_max;
 
-//g_print("band_menu: min=%lld max=%lld\n",frequency_min,frequency_max);
+  //g_print("band_menu: min=%lld max=%lld\n",frequency_min,frequency_max);
   j=0;
   for(i=0;i<BANDS+XVTRS;i++) {
     band=(BAND*)band_get_band(i);
index 579360bff927c524bba9ca938a3f98868f0c78a7..19152df9e6cc0e54182aa7b45beabd30abc081ec 100644 (file)
@@ -44,6 +44,7 @@ static void cleanup() {
     gtk_widget_destroy(dialog);
     dialog=NULL;
     sub_menu=NULL;
+    active_menu=NO_MENU;
   }
 }
 
index 7dbf1e3b5d0b681fa4c5315e1f52b74b067cdc04..38aab90700d5869a83955a011e362d92770739ab 100644 (file)
@@ -24,6 +24,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "main.h"
 #include "new_menu.h"
 #include "display_menu.h"
 #include "channel.h"
index 600b924a7e078df731738b3d7ee61f92ebb9c236..4654b03465fd9c477285015d6aef170baf726703 100644 (file)
@@ -44,6 +44,7 @@ static void cleanup() {
     gtk_widget_destroy(dialog);
     dialog=NULL;
     sub_menu=NULL;
+    active_menu=NO_MENU;
   }
 }
 
index 58f1ea632327c3c658a724f72c224df003e2003e..083bc22b4f89f66f98b73172a8d5027dc35a3cb0 100644 (file)
@@ -532,7 +532,7 @@ int main(int argc, char *argv[])
                                   bp=buffer+16;  // skip 8 header and 8 SYNC/C&C bytes
                                  sum=0.0;
                                   for (j=0; j<126; j++) {
-                                       bp +=4;  / skip audio samples
+                                       bp +=4;  // skip audio samples
                                        sample  = (int)((signed char) *bp++)<<8;
                                        sample |= (int) ((signed char) *bp++ & 0xFF);
                                        disample=(double) sample * 0.000030517578125;  // division by 32768
index dadc20adc07661dd6205558dc37aba751a965615..5f43c3c232510be61cc07545c623cc035ccc745e 100644 (file)
--- a/iambic.c
+++ b/iambic.c
  **************************************************************************************************************
  */
 
+#include <gtk/gtk.h>
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -240,30 +242,6 @@ extern int clock_nanosleep(clockid_t __clock_id, int __flags,
       struct timespec *__rem);
 #endif
 
-#ifndef GPIO
-//
-// Dummy functions if compiled without GPIO
-//
-int gpio_cw_sidetone_enabled() { return 0; }
-void gpio_cw_sidetone_set(int level) {}
-#endif
-
-static void keyer_straight_key(int state) {
-  //
-  // Interface for simple key-down action e.g. from a MIDI message
-  //
-  if (state != 0) {
-    cw_key_down=960000;  // max. 20 sec to protect hardware
-    cw_key_up=0;
-    cw_key_hit=1;
-    gpio_cw_sidetone_set(1);
-  } else {
-    cw_key_down=0;
-    cw_key_up=0;
-    gpio_cw_sidetone_set(0);
-  }
-}
-
 void keyer_update() {
     //
     // This function will take notice of changes in the following variables
@@ -368,10 +346,12 @@ static void* keyer_thread(void *arg) {
        // If using GPIO side tone information, mute CW side tone
        // as long as the keyer thread is active
        //
+#ifdef GPIO
        if (gpio_cw_sidetone_enabled()) {
          old_volume=cw_keyer_sidetone_volume;
          cw_keyer_sidetone_volume=0;
        }
+#endif
 
        //
        // Normally the keyer will be used in "break-in" mode, that is, we switch to TX
@@ -457,7 +437,12 @@ static void* keyer_thread(void *arg) {
                     // If both paddles are pressed (should not happen), then
                     // the dash paddle wins.
                     if (*kdash) {                  // send manual dashes
-                      keyer_straight_key(1);       // do key down
+                      cw_key_down=960000;  // max. 20 sec to protect hardware
+                      cw_key_up=0;
+                      cw_key_hit=1;
+#ifdef GPIO
+                      gpio_cw_sidetone_set(1);
+#endif
                       key_state=STRAIGHT;
                     }
                 } else {
@@ -475,7 +460,11 @@ static void* keyer_thread(void *arg) {
                // Wait for dash paddle being released in "straight key" mode.
                 //
                 if (! *kdash) {
-                  keyer_straight_key(0);   // key-up
+                  cw_key_down=0;
+                  cw_key_up=0;
+#ifdef GPIO
+                  gpio_cw_sidetone_set(0);
+#endif
                   key_state=CHECK;
                 }
                 break;
@@ -488,7 +477,9 @@ static void* keyer_thread(void *arg) {
                 dash_held = *kdash;
                 cw_key_down=dot_samples;
                 cw_key_up=dot_samples;
+#ifdef GPIO
                 gpio_cw_sidetone_set(1);
+#endif
                 key_state=SENDDOT;
                 break;
 
@@ -497,7 +488,9 @@ static void* keyer_thread(void *arg) {
                 // wait for dot being complete
                 //
                 if (cw_key_down == 0) {
+#ifdef GPIO
                   gpio_cw_sidetone_set(0);
+#endif
                   key_state=DOTDELAY;
                 }
                 break;
@@ -543,7 +536,9 @@ static void* keyer_thread(void *arg) {
                dot_held = *kdot;  // remember if dot is still held at beginning of the dash
                 cw_key_down=dash_samples;
                 cw_key_up=dot_samples;
+#ifdef GPIO
                 gpio_cw_sidetone_set(1);
+#endif
                 key_state=SENDDASH;
                 break;
 
@@ -552,7 +547,9 @@ static void* keyer_thread(void *arg) {
                 // wait for dot being complete
                 //
                 if (cw_key_down == 0) {
+#ifdef GPIO
                   gpio_cw_sidetone_set(0);
+#endif
                   key_state=DASHDELAY;
                 }
                 break;
@@ -612,9 +609,11 @@ static void* keyer_thread(void *arg) {
        //
        // If we have reduced the side tone volume, restore it!
        //
+#ifdef GPIO
        if (gpio_cw_sidetone_enabled()) {
          cw_keyer_sidetone_volume = old_volume;
        }
+#endif
 
     }
     fprintf(stderr,"keyer_thread: EXIT\n");
index 7f5e910f76cbd068745a4372d13ea6b21ebc7ec8..b992d82ef65ef7f53159a13314f06e53c7e6f82f 100644 (file)
@@ -45,6 +45,7 @@ static void cleanup() {
     gtk_widget_destroy(dialog);
     dialog=NULL;
     sub_menu=NULL;
+    active_menu=NO_MENU;
   }
 }
 
index ed6244c1359c740282ef3e8f378183ff78bff304..f20823abe71ed8f1fe85951b7b46b94bb1f53822 100644 (file)
@@ -1177,14 +1177,7 @@ void *audio_thread(void *data) {
      if (seqnum != 0 &&seqnum != seqold+1 ) {
        fprintf(stderr,"Audio thread: SEQ ERROR, old=%lu new=%lu\n", seqold, seqnum);
      }
-     p=buffer+4;
-     for (i=0; i<64; i++) {
-       lsample  = ((signed char) *p++) << 8;   
-       lsample |= (*p++ & 0xff); 
-       rsample  = ((signed char) *p++) << 8;   
-       rsample |= (*p++ & 0xff); 
-       audio_write(lsample,rsample);
-    }
+     // just skip the audio samples
   }
   close (sock);
   return NULL;
diff --git a/vfo.h b/vfo.h
index a479d1739b4081e29e18019f4f58087a53cc8c92..f380cce4089159fe42eba97915a8234a746a89dc 100644 (file)
--- a/vfo.h
+++ b/vfo.h
@@ -45,7 +45,8 @@ struct _vfo {
   long long offset;
 
   gboolean entering_frequency;
-  long long entered_frequency;
+  gint64 entered_frequency;
+
 };
 
 extern struct _vfo vfo[MAX_VFOS];