]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
fixes touch screen frequency change bug when CTUN active.
authorJohn Melton - G0ORX/N6LYT <john.d.melton@googlemail.com>
Tue, 14 Feb 2017 15:26:02 +0000 (15:26 +0000)
committerJohn Melton - G0ORX/N6LYT <john.d.melton@googlemail.com>
Tue, 14 Feb 2017 15:26:02 +0000 (15:26 +0000)
receiver.c
vfo.c

index cbec540e463aa3d1f6701969225782f4d28ce76a..221572c77080e9da7ce597aa5822068b29c0a408 100644 (file)
@@ -557,8 +557,8 @@ void set_agc(RECEIVER *rx, int agc) {
 }
 
 void set_offset(RECEIVER *rx,long long offset) {
-fprintf(stderr,"set_offset: id=%d ofset=%lld\n",rx->id,offset);
-fprintf(stderr,"set_offset: frequency=%lld ctun_freqeuncy=%lld offset=%lld\n",vfo[rx->id].frequency,vfo[rx->id].ctun_frequency,vfo[rx->id].offset);
+//fprintf(stderr,"set_offset: id=%d ofset=%lld\n",rx->id,offset);
+//fprintf(stderr,"set_offset: frequency=%lld ctun_freqeuncy=%lld offset=%lld\n",vfo[rx->id].frequency,vfo[rx->id].ctun_frequency,vfo[rx->id].offset);
   if(offset==0) {
     SetRXAShiftFreq(rx->id, (double)offset);
     RXANBPSetShiftFrequency(rx->id, (double)offset);
diff --git a/vfo.c b/vfo.c
index 5bc739744ff0a6045eb3b8a61f713be41734714f..512c30807afc1a99fcd498da83714cb97b1d3bba 100644 (file)
--- a/vfo.c
+++ b/vfo.c
@@ -408,13 +408,18 @@ void vfo_move(long long hz) {
         break;
 #endif
       default:
-        vfo[id].frequency=((vfo[id].frequency+hz)/step)*step;
+        if(vfo[id].ctun) {
+          vfo[id].ctun_frequency=((vfo[id].ctun_frequency-hz)/step)*step;
+        } else {
+          vfo[id].frequency=((vfo[id].frequency+hz)/step)*step;
+        }
         break;
     }
     receiver_frequency_changed(active_receiver);
     vfo_update(NULL);
   }
 }
+
 void vfo_move_to(long long hz) {
   int id=active_receiver->id;
   if(!locked) {
@@ -424,11 +429,20 @@ void vfo_move_to(long long hz) {
         break;
 #endif
       default:
-        vfo[id].frequency=(vfo[id].frequency+hz)/step*step;
-        if(vfo[id].mode==modeCWL) {
-          vfo[id].frequency+=cw_keyer_sidetone_frequency;
-        } else if(vfo[id].mode==modeCWU) {
-          vfo[id].frequency-=cw_keyer_sidetone_frequency;
+        if(vfo[id].ctun) {
+          vfo[id].ctun_frequency=(vfo[id].frequency+hz)/step*step;
+          if(vfo[id].mode==modeCWL) {
+            vfo[id].ctun_frequency+=cw_keyer_sidetone_frequency;
+          } else if(vfo[id].mode==modeCWU) {
+            vfo[id].ctun_frequency-=cw_keyer_sidetone_frequency;
+          }
+        } else {
+          vfo[id].frequency=(vfo[id].frequency+hz)/step*step;
+          if(vfo[id].mode==modeCWL) {
+            vfo[id].frequency+=cw_keyer_sidetone_frequency;
+          } else if(vfo[id].mode==modeCWU) {
+            vfo[id].frequency-=cw_keyer_sidetone_frequency;
+          }
         }
         break;
     }