From: John Melton - G0ORX/N6LYT <john.d.melton@googlemail.com>
Date: Tue, 19 Jul 2016 09:45:45 +0000 (+0000)
Subject: Updated new_protocol for cw changes. Updated vfo to align clicked frequency when... 
X-Git-Url: https://git.rkrishnan.org/pf/components/flags/frontends/%22file://%22%22?a=commitdiff_plain;h=b7dd0f8b008d8779ae748af779f87d111a861ae0;p=pihpsdr.git

Updated new_protocol for cw changes. Updated vfo to align clicked frequency when in CW mode on the sidetone frequency.
---

diff --git a/new_protocol.c b/new_protocol.c
index 3e4a07a..b2c5c96 100644
--- a/new_protocol.c
+++ b/new_protocol.c
@@ -259,6 +259,14 @@ fprintf(stderr,"new_protocol_high_priority: run=%d tx=%d drive=%d\n", run, tx, d
     buffer[12]=phase;
 
 // tx (no split yet)
+    long txFrequency=ddsFrequency;
+    if(mode==modeCWU) {
+      txFrequency+=cw_keyer_sidetone_frequency;
+    } else if(mode==modeCWL) {
+      txFrequency-=cw_keyer_sidetone_frequency;
+    }
+    phase=(long)((4294967296.0*(double)txFrequency)/122880000.0);
+
     buffer[329]=phase>>24;
     buffer[330]=phase>>16;
     buffer[331]=phase>>8;
diff --git a/pihpsdr b/pihpsdr
index 93f94d9..0570629 100755
Binary files a/pihpsdr and b/pihpsdr differ
diff --git a/release/pihpsdr.tar b/release/pihpsdr.tar
index 531ad56..97fb3ce 100644
Binary files a/release/pihpsdr.tar and b/release/pihpsdr.tar differ
diff --git a/release/pihpsdr/pihpsdr b/release/pihpsdr/pihpsdr
index c2a18eb..00dab37 100755
Binary files a/release/pihpsdr/pihpsdr and b/release/pihpsdr/pihpsdr differ
diff --git a/vfo.c b/vfo.c
index f328c93..eb987d0 100644
--- a/vfo.c
+++ b/vfo.c
@@ -87,12 +87,22 @@ void vfo_move_to(int hz) {
     BANDSTACK_ENTRY* entry=bandstack_entry_get_current();
     //entry->frequencyA=(entry->frequencyA+hz)/step*step;
     //setFrequency(entry->frequencyA);
+
 #ifdef LIMESDR
-    if(protocol==LIMESDR_PROTOCOL)
+    if(protocol==LIMESDR_PROTOCOL) {
       setFrequency((entry->frequencyA+ddsOffset-hz)/step*step);
-    else
+    } else {
+#endif
+      long f=(entry->frequencyA+ddsOffset+hz)/step*step;
+      if(mode==modeCWL) {
+        f+=cw_keyer_sidetone_frequency;
+      } else if(mode==modeCWU) {
+        f-=cw_keyer_sidetone_frequency;
+      }
+      setFrequency(f);
+#ifdef LIMESDR
+    }
 #endif
-      setFrequency((entry->frequencyA+ddsOffset+hz)/step*step);
     vfo_update(NULL);
   }
 }