From: John Melton - G0ORX/N6LYT Date: Tue, 14 Feb 2017 15:26:02 +0000 (+0000) Subject: fixes touch screen frequency change bug when CTUN active. X-Git-Url: https://git.rkrishnan.org/pf/$top_link?a=commitdiff_plain;h=95cc70288fe2d291720889b3e175be26785f93f0;p=pihpsdr.git fixes touch screen frequency change bug when CTUN active. --- diff --git a/receiver.c b/receiver.c index cbec540..221572c 100644 --- a/receiver.c +++ b/receiver.c @@ -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 5bc7397..512c308 100644 --- 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; }