28
rigbase *selrig = rigs[0];
32
bool flrig_abort = false;
36
FREQMODE vfoA = {14070000, 0, 0, UI};
37
FREQMODE vfoB = {7070000, 0, 0, UI};
38
FREQMODE vfo = {0, 0, 0, UI};
39
FREQMODE transceiverA;
40
FREQMODE transceiverB;
41
FREQMODE xmlvfo = vfoA;
43
enum {VOL, MIC, PWR, SQL, IFSH, NOTCH, RFGAIN, NR };
49
SLIDER(int a, float f, int b = 0) {which = a; value = f; button = b;}
52
queue<SLIDER> sliders;
59
bool changed_vfo = false;
62
bool volume_changed = false;
63
bool mic_changed = false;
64
bool power_changed = false;
65
bool squelch_changed = false;
66
bool if_shift_changed = false;
67
bool notch_changed = false;
68
bool rfgain_changed = false;
69
bool noise_reduction_changed = false;
71
const char **old_bws = NULL;
73
// Add alpha-tag to FREQMODE;
74
struct ATAG_FREQMODE {
79
char alpha_tag[ATAGSIZE];
81
ATAG_FREQMODE oplist[LISTSIZE];
84
vector<string> rigmodes_;
85
vector<string> rigbws_;
91
bool using_buttons = false;
93
enum { SWR_IMAGE, ALC_IMAGE };
94
int meter_image = SWR_IMAGE;
96
//=============================================================================
97
// loop for serial i/o thread
98
// runs continuously until program is closed
99
// only accesses the serial port if it has been successfully opened
100
//=============================================================================
102
bool bypass_serial_thread_loop = true;
103
bool run_serial_thread = true;
108
char *print(FREQMODE data)
110
static char str[100];
111
const char **bwt = selrig->bwtable(data.imode);
112
const char **dsplo = selrig->lotable(data.imode);
113
const char **dsphi = selrig->hitable(data.imode);
114
snprintf(str, sizeof(str), "%3s,%10ld, %4s, %x => %5s %5s",
115
data.src == XML ? "xml" : "ui",
117
selrig->modes_ ? selrig->modes_[data.imode] : "modes n/a",
119
(data.iBW > 256 && selrig->has_dsp_controls) ?
120
(dsplo ? dsplo[data.iBW & 0x7F] : "??") : (bwt ? bwt[data.iBW] : "lo n/a"),
121
(data.iBW > 256 && selrig->has_dsp_controls) ?
122
(dsphi ? dsphi[(data.iBW >> 8) & 0x7F] : "??") : "hi n/a"
127
// the following functions are ONLY CALLED by the serial loop
128
// read any data stream sent by transceiver
130
// read current vfo frequency
134
pthread_mutex_lock(&mutex_serial);
136
pthread_mutex_unlock(&mutex_serial);
141
// transceiver changed ?
142
pthread_mutex_lock(&mutex_serial);
144
if (!useB) { // vfo-A
145
freq = selrig->get_vfoA();
146
if (freq != vfoA.freq) {
148
Fl::awake(setFreqDispA, (void *)vfoA.freq);
150
send_xml_freq(vfo.freq);
152
if ( selrig->twovfos() ) {
153
freq = selrig->get_vfoB();
154
if (freq != vfoB.freq) {
156
Fl::awake(setFreqDispB, (void *)vfoB.freq);
160
freq = selrig->get_vfoB();
161
if (freq != vfoB.freq) {
163
Fl::awake(setFreqDispB, (void *)vfoB.freq);
165
send_xml_freq(vfo.freq);
167
if ( selrig->twovfos() ) {
168
freq = selrig->get_vfoA();
169
if (freq != vfoA.freq) {
171
Fl::awake(setFreqDispA, (void *)vfoA.freq);
175
pthread_mutex_unlock(&mutex_serial);
178
void setModeControl(void *)
180
opMODE->index(vfo.imode);
182
// enables/disables the IF shift control, depending on the mode.
183
// the IF Shift function, is ONLY valid in CW modes, with the 870S.
185
if (rig_nbr == TS870S) {
186
if (vfo.imode == RIG_TS870S::tsCW || vfo.imode == RIG_TS870S::tsCWR) {
188
sldrIFSHIFT->activate();
190
btnIFsh->deactivate();
191
sldrIFSHIFT->deactivate();
196
// mode and bandwidth
199
pthread_mutex_lock(&mutex_serial);
203
nu_mode = selrig->get_modeA();
204
if (nu_mode != vfoA.imode) {
205
pthread_mutex_lock(&mutex_xmlrpc);
206
vfoA.imode = vfo.imode = nu_mode;
207
selrig->adjust_bandwidth(vfo.imode);
208
nu_BW = selrig->get_bwA();
209
vfoA.iBW = vfo.iBW = nu_BW;
212
send_new_mode(nu_mode);
214
send_new_bandwidth(vfo.iBW);
216
pthread_mutex_unlock(&mutex_xmlrpc);
217
Fl::awake(setModeControl);
218
set_bandwidth_control();
221
nu_mode = selrig->get_modeB();
222
if (nu_mode != vfoB.imode) {
223
pthread_mutex_lock(&mutex_xmlrpc);
224
vfoB.imode = vfo.imode = nu_mode;
225
selrig->adjust_bandwidth(vfo.imode);
226
nu_BW = selrig->get_bwB();
227
vfoB.iBW = vfo.iBW = nu_BW;
230
send_new_mode(nu_mode);
232
send_new_bandwidth(vfo.iBW);
234
pthread_mutex_unlock(&mutex_xmlrpc);
235
Fl::awake(setModeControl);
236
set_bandwidth_control();
239
pthread_mutex_unlock(&mutex_serial);
242
void setBWControl(void *)
244
if (selrig->has_dsp_controls) {
251
opBW->index(vfo.iBW);
256
opDSP_lo->index(vfo.iBW & 0xFF);
258
opDSP_hi->index((vfo.iBW >> 8) & 0x7F);
260
btnDSP->label(selrig->hi_label);
261
btnDSP->redraw_label();
268
opBW->index(vfo.iBW);
273
void read_bandwidth()
275
pthread_mutex_lock(&mutex_serial);
278
nu_BW = selrig->get_bwA();
279
if (nu_BW != vfoA.iBW) {
280
pthread_mutex_lock(&mutex_xmlrpc);
281
vfoA.iBW = vfo.iBW = nu_BW;
282
Fl::awake(setBWControl);
284
send_new_bandwidth(vfo.iBW);
286
pthread_mutex_unlock(&mutex_xmlrpc);
289
nu_BW = selrig->get_bwB();
290
if (nu_BW != vfoB.iBW) {
291
vfoB.iBW = vfo.iBW = nu_BW;
292
pthread_mutex_lock(&mutex_xmlrpc);
293
Fl::awake(setBWControl);
295
send_new_bandwidth(vfo.iBW);
297
pthread_mutex_unlock(&mutex_xmlrpc);
300
pthread_mutex_unlock(&mutex_serial);
303
// read current signal level
306
if (!selrig->has_smeter) return;
308
pthread_mutex_lock(&mutex_serial);
309
sig = selrig->get_smeter();
310
pthread_mutex_unlock(&mutex_serial);
311
if (sig == -1) return;
312
Fl::awake(updateSmeter, reinterpret_cast<void*>(sig));
316
void read_power_out()
318
if (!selrig->has_power_out) return;
320
pthread_mutex_lock(&mutex_serial);
321
sig = selrig->get_power_out();
322
pthread_mutex_unlock(&mutex_serial);
324
Fl::awake(updateFwdPwr, reinterpret_cast<void*>(sig));
330
if ((meter_image != SWR_IMAGE) ||
331
!selrig->has_swr_control) return;
333
pthread_mutex_lock(&mutex_serial);
334
sig = selrig->get_swr();
335
pthread_mutex_unlock(&mutex_serial);
337
Fl::awake(updateSWR, reinterpret_cast<void*>(sig));
343
if ((meter_image != ALC_IMAGE) ||
344
!selrig->has_alc_control) return;
346
pthread_mutex_lock(&mutex_serial);
347
sig = selrig->get_alc();
348
pthread_mutex_unlock(&mutex_serial);
350
Fl::awake(updateALC, reinterpret_cast<void*>(sig));
354
void update_auto_notch(void *d)
356
btnAutoNotch->value(progStatus.auto_notch);
359
void read_auto_notch()
361
if (!selrig->has_auto_notch || notch_changed) return;
362
pthread_mutex_lock(&mutex_serial);
363
progStatus.auto_notch = selrig->get_auto_notch();
364
pthread_mutex_unlock(&mutex_serial);
365
Fl::awake(update_auto_notch, (void*)0);
369
void update_noise(void *d)
371
btnNOISE->value(progStatus.noise);
376
pthread_mutex_lock(&mutex_serial);
377
progStatus.noise = selrig->get_noise();
378
pthread_mutex_unlock(&mutex_serial);
379
Fl::awake(update_noise, (void*)0);
382
// preamp - attenuator
383
void update_preamp(void *d)
385
btnPreamp->value(progStatus.preamp);
388
void update_attenuator(void *d)
390
btnAttenuator->value(progStatus.attenuator);
393
void read_preamp_att()
395
if (selrig->has_preamp_control) {
396
pthread_mutex_lock(&mutex_serial);
397
progStatus.preamp = selrig->get_preamp();
398
pthread_mutex_unlock(&mutex_serial);
399
Fl::awake(update_preamp, (void*)0);
401
if (selrig->has_attenuator_control) {
402
pthread_mutex_lock(&mutex_serial);
403
progStatus.attenuator = selrig->get_attenuator();
404
pthread_mutex_unlock(&mutex_serial);
405
Fl::awake(update_attenuator, (void*)0);
410
void update_split(void *d)
412
if (rig_nbr == FT450 || rig_nbr == FT950 || rig_nbr == FTdx1200 ||
413
rig_nbr == TS480SAT || rig_nbr == TS480HX ||
414
rig_nbr == TS590S || rig_nbr == TS2000 || rig_nbr == TS990) {
415
switch (progStatus.split) {
416
case 0: btnSplit->value(0);
420
case 1: btnSplit->value(1);
424
case 2: btnSplit->value(1);
428
case 3: btnSplit->value(0);
434
btnSplit->value(progStatus.split);
440
if (selrig->can_split()) {
441
pthread_mutex_lock(&mutex_serial);
442
val = selrig->get_split();
443
pthread_mutex_unlock(&mutex_serial);
444
if (val != progStatus.split) {
445
progStatus.split = val;
446
Fl::awake(update_split, (void*)0);
452
void update_volume(void *d)
454
long *nr = (long *)d;
455
sldrVOLUME->value(progStatus.volume); // Set slider to last known value
456
sldrVOLUME->activate(); // activate it
457
if (*nr) btnVol->value(1); // Button Lit
458
else btnVol->value(0); // Button Dark.
466
if (!selrig->has_volume_control || volume_changed) return;
468
pthread_mutex_lock(&mutex_serial);
469
vol = selrig->get_volume_control();
470
pthread_mutex_unlock(&mutex_serial);
471
if (vol != progStatus.volume) {
472
if (vol <= 1 && !btnVol->value()) return;
473
progStatus.volume = vol;
474
if (vol <= 1 && btnVol->value())
475
Fl::awake(update_volume, (void*)&nlzero);
477
Fl::awake(update_volume, (void*)&nlone);
482
void update_ifshift(void *d)
486
btnIFsh->value(progStatus.shift);
487
// if (progStatus.shift)
488
sldrIFSHIFT->value(progStatus.shift_val);
493
if (!selrig->has_ifshift_control || if_shift_changed) return;
494
pthread_mutex_lock(&mutex_serial);
495
progStatus.shift = selrig->get_if_shift(progStatus.shift_val);
496
pthread_mutex_unlock(&mutex_serial);
497
Fl::awake(update_ifshift, (void*)0);
501
void update_nr(void *d)
503
btnNR->value(progStatus.noise_reduction);
504
sldrNR->value(progStatus.noise_reduction_val);
509
if (!selrig->has_noise_reduction || noise_reduction_changed) return;
510
pthread_mutex_lock(&mutex_serial);
511
progStatus.noise_reduction = selrig->get_noise_reduction();
512
progStatus.noise_reduction_val = selrig->get_noise_reduction_val();
513
pthread_mutex_unlock(&mutex_serial);
514
Fl::awake(update_nr, (void*)0);
520
void update_notch(void *d)
522
btnNotch->value(progStatus.notch = rig_notch);
523
sldrNOTCH->value(progStatus.notch_val = rig_notch_val);
524
send_new_notch(progStatus.notch ? progStatus.notch_val : 0);
529
if (!selrig->has_notch_control || notch_changed) return;
530
pthread_mutex_lock(&mutex_serial);
531
rig_notch = selrig->get_notch(rig_notch_val);
532
pthread_mutex_unlock(&mutex_serial);
533
if (rig_notch != progStatus.notch || rig_notch_val != progStatus.notch_val)
534
Fl::awake(update_notch, (void*)0);
538
void update_power_control(void *d)
540
set_power_controlImage(progStatus.power_level);
541
sldrPOWER->value(progStatus.power_level);
543
double min, max, step;
544
selrig->get_pc_min_max_step(min, max, step);
545
sldrPOWER->minimum(min);
546
sldrPOWER->maximum(max);
547
sldrPOWER->step(step);
552
void read_power_control()
554
if (!selrig->has_power_control || power_changed) return;
555
pthread_mutex_lock(&mutex_serial);
556
progStatus.power_level = selrig->get_power_control();
557
pthread_mutex_unlock(&mutex_serial);
558
Fl::awake(update_power_control, (void*)0);
562
void update_mic_gain(void *d)
564
sldrMICGAIN->value(progStatus.mic_gain);
569
if (!selrig->has_micgain_control || mic_changed) return;
570
pthread_mutex_lock(&mutex_serial);
571
progStatus.mic_gain = selrig->get_mic_gain();
572
pthread_mutex_unlock(&mutex_serial);
573
Fl::awake(update_mic_gain, (void*)0);
577
void update_rfgain(void *d)
579
sldrRFGAIN->value(progStatus.rfgain);
584
if (!selrig->has_rf_control || rfgain_changed) return;
585
pthread_mutex_lock(&mutex_serial);
586
progStatus.rfgain = selrig->get_rf_gain();
587
pthread_mutex_unlock(&mutex_serial);
588
Fl::awake(update_rfgain, (void*)0);
592
void update_squelch(void *d)
594
sldrSQUELCH->value(progStatus.squelch);
599
if (!selrig->has_sql_control || squelch_changed) return;
600
pthread_mutex_lock(&mutex_serial);
601
progStatus.squelch = selrig->get_squelch();
602
pthread_mutex_unlock(&mutex_serial);
603
Fl::awake(update_squelch, (void*)0);
606
static bool resetrcv = true;
607
static bool resetxmt = true;
611
if (!selrig->can_change_alt_vfo && useB) return;
612
if (queA.empty()) return;
614
pthread_mutex_lock(&mutex_serial);
615
pthread_mutex_lock(&mutex_xmlrpc);
616
pthread_mutex_lock(&mutex_queA);
617
while (!queA.empty()) {
621
pthread_mutex_unlock(&mutex_queA);
623
//printf("vfo is %s\n", print(vfo));
624
//printf("A is %s\n", print(vfoA));
627
LOG_INFO("%s", print(vfoA));
629
if (changed_vfo && !useB) {
633
// if TT550 etal and on the B vfo
634
if (selrig->can_change_alt_vfo && useB) {
635
selrig->set_vfoA(vfoA.freq);
639
if (vfoA.freq != vfo.freq || changed_vfo) {
640
selrig->set_vfoA(vfoA.freq);
641
Fl::awake(setFreqDispA, (void *)vfoA.freq);
642
vfo.freq = vfoA.freq;
643
if (vfoA.src == UI) send_xml_freq(vfoA.freq);
645
// adjust for change in bandwidths_
646
if (vfoA.imode != vfo.imode || changed_vfo) {
647
selrig->set_modeA(vfoA.imode);
648
vfo.imode = vfoA.imode;
649
Fl::awake(setModeControl);
650
// if (!((vfoA.src == XML) &&
651
// (rig_nbr == TS2000 || rig_nbr == TS590S || rig_nbr == TS990) ) ) {
653
set_bandwidth_control();
654
Fl::awake(setBWControl);
655
selrig->set_bwA(vfo.iBW);
659
send_new_mode(vfoA.imode);
662
send_new_bandwidth(vfo.iBW);
664
} else if (vfoA.iBW != vfo.iBW) {
665
// if ((vfoA.src == XML) &&
666
// (rig_nbr == TS2000 || rig_nbr == TS590S || rig_nbr == TS990) ) {
667
selrig->set_bwA(vfoA.iBW);
669
Fl::awake(setBWControl);
671
if (vfoA.src == UI) {
673
send_new_bandwidth(vfo.iBW);
681
pthread_mutex_unlock(&mutex_xmlrpc);
682
pthread_mutex_unlock(&mutex_serial);
687
if (!selrig->can_change_alt_vfo && !useB) return;
692
pthread_mutex_lock(&mutex_serial);
693
pthread_mutex_lock(&mutex_xmlrpc);
694
pthread_mutex_lock(&mutex_queB);
695
while (!queB.empty()) {
699
pthread_mutex_unlock(&mutex_queB);
701
//printf("vfo is %s\n", print(vfo));
702
//printf("B is %s\n", print(vfoB));
705
LOG_INFO("%s", print(vfoB));
707
if (changed_vfo && useB) {
711
// if TT550 or K3 and split or on vfoA just update the B vfo
712
if (selrig->can_change_alt_vfo && !useB) {
713
selrig->set_vfoB(vfoB.freq);
717
if (vfoB.freq != vfo.freq || pushedB || changed_vfo) {
718
selrig->set_vfoB(vfoB.freq);
719
vfo.freq = vfoB.freq;
720
Fl::awake(setFreqDispB, (void *)vfoB.freq);
721
if (vfoB.src == UI) send_xml_freq(vfoB.freq);
723
if (vfoB.imode != vfo.imode || pushedB || changed_vfo) {
724
selrig->set_modeB(vfoB.imode);
725
vfo.imode = vfoB.imode;
726
Fl::awake(setModeControl);
727
// if (!((vfoB.src == XML) &&
728
// (rig_nbr == TS2000 || rig_nbr == TS590S || rig_nbr == TS990) ) ) {
730
set_bandwidth_control();
731
Fl::awake(setBWControl);
732
selrig->set_bwB(vfo.iBW);
736
send_new_mode(vfoB.imode);
739
send_new_bandwidth(vfo.iBW);
741
} else if (vfoB.iBW != vfo.iBW || pushedB) {
742
// if (!((vfoB.src == XML) &&
743
// (rig_nbr == TS2000 || rig_nbr == TS590S || rig_nbr == TS990) ) ) {
744
selrig->set_bwB(vfoB.iBW);
746
Fl::awake(setBWControl);
748
if (vfoB.src == UI) {
750
send_new_bandwidth(vfo.iBW);
758
pthread_mutex_unlock(&mutex_xmlrpc);
759
pthread_mutex_unlock(&mutex_serial);
764
pthread_mutex_lock(&mutex_ptt);
765
while (!quePTT.empty()) {
766
PTT = quePTT.front();
769
Fl::awake(update_UI_PTT);
771
pthread_mutex_unlock(&mutex_ptt);
774
void serviceSliders()
777
pthread_mutex_lock(&mutex_serial);
778
while(!sliders.empty()) {
779
working = sliders.front();
781
switch (working.which) {
783
selrig->set_volume_control(working.value);
784
progStatus.volume = working.value;
785
volume_changed = false;
788
progStatus.mic_gain = working.value;
789
selrig->set_mic_gain(working.value);
793
selrig->set_power_control(working.value);
794
power_changed = false;
797
progStatus.squelch = working.value;
798
selrig->set_squelch(working.value);
799
squelch_changed = false;
802
progStatus.shift = working.button;
803
progStatus.shift_val = working.value;
804
selrig->set_if_shift(working.value);
805
if_shift_changed = false;
808
progStatus.notch = working.button;
809
progStatus.notch_val = working.value;
810
selrig->set_notch(working.button, working.value);
812
send_new_notch(working.button ? working.value : 0);
814
notch_changed = false;
817
progStatus.rfgain = working.value;
818
selrig->set_rf_gain(working.value);
819
rfgain_changed = false;
822
if (rig_nbr == TS2000) {
823
if (working.button != -1) { // pia
824
if (selrig->noise_reduction_level() == 0) {
825
selrig->set_noise_reduction(1);
826
selrig->set_noise_reduction_val(selrig->nrval1());
827
progStatus.noise_reduction = 1;
828
progStatus.noise_reduction_val = selrig->nrval1();
829
Fl::awake(update_nr, (void*)0);
830
} else if (selrig->currmode() != RIG_TS2000::FM &&
831
selrig->noise_reduction_level() == 1) {
832
selrig->set_noise_reduction(2);
833
selrig->set_noise_reduction_val(selrig->nrval2());
834
progStatus.noise_reduction = 2;
835
progStatus.noise_reduction_val = selrig->nrval2();
836
Fl::awake(update_nr, (void*)0);
838
selrig->set_noise_reduction(0);
840
progStatus.noise_reduction_val = working.value;
841
selrig->set_noise_reduction_val(working.value);
842
Fl::awake(update_nr, (void*)0);
844
} else { // not TS2000
845
if (working.button != -1) {
846
progStatus.noise_reduction = working.button;
847
selrig->set_noise_reduction(working.button);
849
progStatus.noise_reduction_val = working.value;
850
selrig->set_noise_reduction_val(working.value);
852
noise_reduction_changed = false;
858
pthread_mutex_unlock(&mutex_serial);
861
void * serial_thread_loop(void *d)
863
static int loopcount = progStatus.serloop_timing / 10;
864
static int poll_nbr = 0;
867
if (!run_serial_thread) break;
873
if (bypass_serial_thread_loop) goto serial_bypass_loop;
875
//send any freq/mode/bw changes in the queu
881
if (!quePTT.empty()) continue;
883
if (!quePTT.empty()) continue;
886
Fl::awake(zeroXmtMeters, 0);
888
loopcount = progStatus.serloop_timing / 10;
894
loopcount = progStatus.serloop_timing / 10;
897
if (rig_nbr == K3) read_K3();
898
else if ((rig_nbr == K2) ||
899
(selrig->has_get_info &&
900
(progStatus.poll_frequency || progStatus.poll_mode || progStatus.poll_bandwidth)))
903
if (progStatus.poll_frequency)
904
if (!(poll_nbr % progStatus.poll_frequency)) read_vfo();
906
if (bypass_serial_thread_loop) goto serial_bypass_loop;
907
if (!quePTT.empty()) continue;
909
if (progStatus.poll_mode)
910
if (!(poll_nbr % progStatus.poll_mode)) read_mode();
912
if (bypass_serial_thread_loop) goto serial_bypass_loop;
913
if (!quePTT.empty()) continue;
915
if (progStatus.poll_bandwidth)
916
if (!(poll_nbr % progStatus.poll_bandwidth)) read_bandwidth();
918
if (bypass_serial_thread_loop) goto serial_bypass_loop;
919
if (!quePTT.empty()) continue;
921
if (progStatus.poll_smeter)
922
if (!(poll_nbr % progStatus.poll_smeter)) read_smeter();
924
if (bypass_serial_thread_loop) goto serial_bypass_loop;
925
if (!quePTT.empty()) continue;
927
if (progStatus.poll_volume)
928
if (!(poll_nbr % progStatus.poll_volume)) read_volume();
930
if (bypass_serial_thread_loop) goto serial_bypass_loop;
931
if (!quePTT.empty()) continue;
933
if (progStatus.poll_auto_notch)
934
if (!(poll_nbr % progStatus.poll_auto_notch)) read_auto_notch();
936
if (bypass_serial_thread_loop) goto serial_bypass_loop;
937
if (!quePTT.empty()) continue;
939
if (progStatus.poll_notch)
940
if (!(poll_nbr % progStatus.poll_notch)) read_notch();
942
if (bypass_serial_thread_loop) goto serial_bypass_loop;
943
if (!quePTT.empty()) continue;
945
if (progStatus.poll_ifshift)
946
if (!(poll_nbr % progStatus.poll_ifshift)) read_ifshift();
948
if (bypass_serial_thread_loop) goto serial_bypass_loop;
949
if (!quePTT.empty()) continue;
951
if (progStatus.poll_power_control)
952
if (!(poll_nbr % progStatus.poll_power_control)) read_power_control();
954
if (bypass_serial_thread_loop) goto serial_bypass_loop;
955
if (!quePTT.empty()) continue;
957
if (progStatus.poll_pre_att)
958
if (!(poll_nbr % progStatus.poll_pre_att)) read_preamp_att();
960
if (bypass_serial_thread_loop) goto serial_bypass_loop;
961
if (!quePTT.empty()) continue;
963
if (progStatus.poll_micgain)
964
if (!(poll_nbr % progStatus.poll_micgain)) read_mic_gain();
966
if (bypass_serial_thread_loop) goto serial_bypass_loop;
967
if (!quePTT.empty()) continue;
969
if (progStatus.poll_squelch)
970
if (!(poll_nbr % progStatus.poll_squelch)) read_squelch();
972
if (bypass_serial_thread_loop) goto serial_bypass_loop;
973
if (!quePTT.empty()) continue;
975
if (progStatus.poll_rfgain)
976
if (!(poll_nbr % progStatus.poll_rfgain)) read_rfgain();
978
if (bypass_serial_thread_loop) goto serial_bypass_loop;
979
if (!quePTT.empty()) continue;
981
if (progStatus.poll_split)
982
if (!(poll_nbr % progStatus.poll_split)) read_split();
984
if (bypass_serial_thread_loop) goto serial_bypass_loop;
985
if (!quePTT.empty()) continue;
987
if (progStatus.poll_nr)
988
if (!(poll_nbr % progStatus.poll_nr)) read_nr();
990
if (bypass_serial_thread_loop) goto serial_bypass_loop;
991
if (!quePTT.empty()) continue;
993
if (progStatus.poll_noise)
994
if (!(poll_nbr % progStatus.poll_noise)) read_noise();
996
if (bypass_serial_thread_loop) goto serial_bypass_loop;
1001
Fl::awake(updateSmeter, (void *)(0));
1003
loopcount = progStatus.serloop_timing / 10;
1008
loopcount = progStatus.serloop_timing / 10;
1010
if (progStatus.poll_pout)
1011
if (!(poll_nbr % progStatus.poll_pout)) read_power_out();
1012
if (!quePTT.empty()) continue;
1013
if (progStatus.poll_swr)
1014
if (!(poll_nbr % progStatus.poll_swr)) read_swr();
1015
if (!quePTT.empty()) continue;
1016
if (progStatus.poll_alc)
1017
if (!(poll_nbr % progStatus.poll_alc)) read_alc();
1020
serial_bypass_loop: ;
1025
//=============================================================================
1031
fm.iBW = opBW->index();
1033
pthread_mutex_lock(&mutex_queB);
1034
//printf("pushed to B: %s\n", print(fm));
1036
pthread_mutex_unlock(&mutex_queB);
1038
pthread_mutex_lock(&mutex_queA);
1039
//printf("pushed to A: %s\n", print(fm));
1041
pthread_mutex_unlock(&mutex_queA);
1049
fm.iBW = ((opDSP_hi->index() << 8) | 0x8000) | (opDSP_lo->index() & 0xFF) ;
1051
pthread_mutex_lock(&mutex_queB);
1053
pthread_mutex_unlock(&mutex_queB);
1055
pthread_mutex_lock(&mutex_queA);
1057
pthread_mutex_unlock(&mutex_queA);
1063
if (btnDSP->label()[0] == selrig->lo_label[0]) {
1064
btnDSP->label(selrig->hi_label);
1065
btnDSP->redraw_label();
1069
btnDSP->label(selrig->lo_label);
1070
btnDSP->redraw_label();
1076
// set_bandwidth_control updates iBW and then posts the call for
1077
// the UI thread to updateBandwidthControl
1078
// changes to the UI cannot come from any thread other than the
1079
// main FL thread! Doing otherwise can cause what appears to be
1080
// random program crashes.
1082
void set_bandwidth_control()
1084
if (!selrig->has_bandwidth_control) return;
1086
selrig->adjust_bandwidth(vfo.imode);
1088
if (vfo.iBW < 256) {
1090
while (selrig->bandwidths_[i]) i++;
1092
if (vfo.iBW > i) vfo.iBW = selrig->def_bandwidth(vfo.imode);
1094
useB ? vfoB.iBW = vfo.iBW : vfoA.iBW = vfo.iBW;
1095
Fl::awake(updateBandwidthControl);
1098
void updateBandwidthControl(void *d)
1100
if (selrig->has_bandwidth_control) {
1101
if (selrig->adjust_bandwidth(vfo.imode) != -1) {
1104
for (int i = 0; selrig->bandwidths_[i] != NULL; i++) {
1105
rigbws_.push_back(selrig->bandwidths_[i]);
1106
opBW->add(selrig->bandwidths_[i]);
1109
if (selrig->has_dsp_controls) {
1112
for (int i = 0; selrig->dsp_lo[i] != NULL; i++)
1113
opDSP_lo->add(selrig->dsp_lo[i]);
1114
for (int i = 0; selrig->dsp_hi[i] != NULL; i++)
1115
opDSP_hi->add(selrig->dsp_hi[i]);
1116
if (vfo.iBW > 256) {
1120
opDSP_lo->index(vfo.iBW & 0xFF);
1122
opDSP_hi->index((vfo.iBW >> 8) & 0x7F);
1123
btnDSP->label(selrig->lo_label);
1130
opBW->index(vfo.iBW);
1133
} else { // no DSP control so update BW control, hide DSP
1137
opBW->index(vfo.iBW);
1141
} else { // no BW, no DSP controls
1155
fm.imode = opMODE->index();
1156
fm.iBW = selrig->def_bandwidth(fm.imode);
1160
pthread_mutex_lock(&mutex_queB);
1162
pthread_mutex_unlock(&mutex_queB);
1164
pthread_mutex_lock(&mutex_queA);
1166
pthread_mutex_unlock(&mutex_queA);
1171
if (!numinlist) return;
1173
for (int i = 0; i < numinlist - 1; i++)
1174
for (int j = i + 1; j < numinlist; j++)
1175
if (oplist[i].freq > oplist[j].freq) {
1177
oplist[i] = oplist[j];
1183
if (!numinlist) return;
1184
for (int i = 0; i < LISTSIZE; i++) {
1186
oplist[i].imode = USB;
1188
memset(oplist[i].alpha_tag, 0, ATAGSIZE);
1190
FreqSelect->clear();
1192
inAlphaTag->value("");
1195
void updateSelect() {
1196
char szline[80 + ATAGSIZE];
1197
char szatag[ATAGSIZE];
1199
if (!numinlist) return;
1201
FreqSelect->clear();
1203
int bg1, bg2, bg_clr;
1204
// bg1 = FL_WHITE; bg2 = FL_LIGHT3;
1205
bg1 = FL_WHITE; bg2 = FL_LIGHT2;
1207
for (int n = 0; n < numinlist; n++) {
1208
memset(szline, 0, sizeof(szline));
1209
memset(szatag, 0, sizeof(szatag));
1210
for (i = 0; i < ATAGSIZE - 1; i++) {
1211
szatag[i] = oplist[n].alpha_tag[i];
1212
if (szatag[i] == 0) szatag[i] = ' ';
1214
bg_clr = (n % 2) ? bg1 : bg2;
1215
snprintf(szline, sizeof(szline),
1216
"@B%d@r%.3f\t@B%d@r%s\t@B%d@r%s\t@B%d@r%s", bg_clr,
1217
oplist[n].freq / 1000.0, bg_clr,
1218
selrig->get_bwname_(oplist[n].iBW, oplist[n].imode), bg_clr,
1219
selrig->get_modename_(oplist[n].imode), bg_clr,
1221
FreqSelect->add (szline);
1223
inAlphaTag->value("");
1226
void addtoList(int val, int imode, int iBW) {
1227
if (numinlist < LISTSIZE) {
1228
oplist[numinlist].imode = imode;
1229
oplist[numinlist].freq = val;
1230
oplist[numinlist].iBW = iBW;
1231
memset(oplist[numinlist].alpha_tag, 0, ATAGSIZE);
1237
ifstream iList(defFileName.c_str());
1239
fl_message ("Could not open %s", defFileName.c_str());
1243
int i = 0, mode, bw;
1245
while (!iList.eof()) {
1246
freq = 0L; mode = -1;
1247
iList >> freq >> mode >> bw;
1248
if (freq && (mode > -1)) {
1249
oplist[i].freq = freq;
1250
oplist[i].imode = mode;
1251
oplist[i].iBW = (bw == -1 ? 0 : bw);
1252
memset(oplist[i].alpha_tag, 0, ATAGSIZE);
1261
void readTagFile() {
1262
ifstream iList(defFileName.c_str());
1264
fl_message ("Could not open %s", defFileName.c_str());
1268
int i = 0, mode, bw;
1271
char ca[ATAGSIZE + 60];
1272
while (!iList.eof()) {
1273
freq = 0L; mode = -1;
1275
memset(ca, 0, sizeof(ca));
1276
iList >> freq >> mode >> bw;
1277
iList.getline(ca, sizeof(ca) - 1);
1279
if (freq && (mode > -1)) {
1280
oplist[i].freq = freq;
1281
oplist[i].imode = mode;
1282
oplist[i].iBW = (bw == -1 ? 0 : bw);
1283
// trim leading, trailing spaces and double quotes
1284
atag = lt_trim(atag);
1285
snprintf(oplist[i].alpha_tag, ATAGSIZE, "%s", atag.c_str());
1295
string tmpFN, orgFN;
1296
// check for new Memory-Alpha-Tag file
1297
defFileName = RigHomeDir;
1298
defFileName.append(selrig->name_);
1299
defFileName.append(".mat");
1300
FILE *fh = fopen(defFileName.c_str(), "r");
1306
// else only read original file to make new MAT file
1308
orgFN.append(selrig->name_);
1309
orgFN.append(".arv");
1310
fh = fopen(orgFN.c_str(), "r");
1313
tmpFN = defFileName;
1314
defFileName = orgFN;
1316
defFileName = tmpFN;
1322
// flrig front panel changed
1325
FREQMODE vfo = vfoA;
1326
vfo.freq = FreqDispA->value();
1328
pthread_mutex_lock(&mutex_queA);
1330
pthread_mutex_unlock(&mutex_queA);
1335
if (progStatus.split && (!selrig->twovfos()))
1336
return 0; // disallow for ICOM transceivers
1337
FREQMODE vfo = vfoB;
1338
vfo.freq = FreqDispB->value();
1340
pthread_mutex_lock(&mutex_queB);
1342
pthread_mutex_unlock(&mutex_queB);
1348
if (selrig->canswap()) {
1352
if (Fl::event_button() == FL_RIGHT_MOUSE) {
1355
if (!selrig->twovfos()) {
1356
vfoB.freq = FreqDispB->value();
1357
FREQMODE temp = vfoB;
1360
FreqDispB->value(vfoB.freq);
1361
FreqDispB->redraw();
1363
pthread_mutex_lock(&mutex_queA);
1364
while (!queA.empty()) queA.pop();
1366
pthread_mutex_unlock(&mutex_queA);
1368
pthread_mutex_lock(&mutex_serial);
1369
bypass_serial_thread_loop = true;
1370
pthread_mutex_unlock(&mutex_serial);
1372
vfoB.freq = FreqDispB->value();
1373
FREQMODE temp = vfoB;
1377
pthread_mutex_lock(&mutex_queA);
1378
while (!queA.empty()) queA.pop();
1380
pthread_mutex_unlock(&mutex_queA);
1381
pthread_mutex_lock(&mutex_queB);
1382
while (!queB.empty()) queB.pop();
1384
pthread_mutex_unlock(&mutex_queB);
1385
FreqDispB->value(vfoB.freq);
1386
FreqDispB->redraw();
1389
pthread_mutex_lock(&mutex_serial);
1390
bypass_serial_thread_loop = false;
1391
pthread_mutex_unlock(&mutex_serial);
1397
if (rig_nbr == K3) {
1401
if (rig_nbr == K2) {
1402
pthread_mutex_lock(&mutex_serial);
1404
selrig->set_vfoB(vfoB.freq);
1405
FreqDispB->value(vfoB.freq);
1406
pthread_mutex_unlock(&mutex_serial);
1409
if (selrig->has_a2b) {
1410
pthread_mutex_lock(&mutex_serial);
1412
pthread_mutex_unlock(&mutex_serial);
1415
pthread_mutex_lock(&mutex_queB);
1417
pthread_mutex_unlock(&mutex_queB);
1418
FreqDispB->value(vfoB.freq);
1419
FreqDispB->redraw();
1423
void cb_set_split(int val)
1425
progStatus.split = val;
1427
if (selrig->has_split_AB) {
1428
pthread_mutex_lock(&mutex_serial);
1429
selrig->set_split(val);
1430
pthread_mutex_unlock(&mutex_serial);
1433
if (vfoB.freq != FreqDispB->value()) {
1434
vfoB.freq = FreqDispB->value();
1435
pthread_mutex_lock(&mutex_serial);
1437
selrig->set_vfoB(vfoB.freq);
1439
pthread_mutex_unlock(&mutex_serial);
1450
void highlight_vfo(void *d)
1452
Fl_Color norm_fg = fl_rgb_color(progStatus.fg_red, progStatus.fg_green, progStatus.fg_blue);
1453
Fl_Color norm_bg = fl_rgb_color(progStatus.bg_red, progStatus.bg_green, progStatus.bg_blue);
1454
Fl_Color dim_bg = fl_color_average( norm_bg, FL_BLACK, 0.75);
1456
FreqDispA->SetONOFFCOLOR( norm_fg, dim_bg );
1457
FreqDispB->SetONOFFCOLOR( norm_fg, norm_bg );
1461
FreqDispA->SetONOFFCOLOR( norm_fg, norm_bg );
1462
FreqDispB->SetONOFFCOLOR( norm_fg, dim_bg);
1466
FreqDispA->redraw();
1467
FreqDispB->redraw();
1474
if (progStatus.split) {
1476
if (!selrig->has_split_AB)
1479
pthread_mutex_lock(&mutex_serial);
1482
vfoA.freq = FreqDispA->value();
1483
pthread_mutex_lock(&mutex_queA);
1486
pthread_mutex_unlock(&mutex_queA);
1487
pthread_mutex_unlock(&mutex_serial);
1488
highlight_vfo((void *)0);
1492
if (progStatus.split) {
1494
if (!selrig->has_split_AB)
1497
pthread_mutex_lock(&mutex_serial);
1500
vfoB.freq = FreqDispB->value();
1501
pthread_mutex_lock(&mutex_queB);
1504
pthread_mutex_unlock(&mutex_queB);
1505
pthread_mutex_unlock(&mutex_serial);
1506
highlight_vfo((void *)0);
1518
long n = FreqSelect->value();
1523
fm.freq = oplist[n].freq;
1524
fm.imode = oplist[n].imode;
1525
fm.iBW = oplist[n].iBW;
1528
FreqDispA->value(fm.freq);
1529
pthread_mutex_lock(&mutex_queA);
1531
pthread_mutex_unlock(&mutex_queA);
1533
FreqDispB->value(fm.freq);
1534
pthread_mutex_lock(&mutex_queB);
1536
pthread_mutex_unlock(&mutex_queB);
1540
void select_and_close()
1542
switch (Fl::event_button()) {
1544
if (FreqSelect->value() > 0)
1545
inAlphaTag->value(oplist[FreqSelect->value() - 1].alpha_tag);
1546
if (Fl::event_clicks()) { // double click
1551
case FL_RIGHT_MOUSE:
1552
if (FreqSelect->value() > 0)
1553
inAlphaTag->value(oplist[FreqSelect->value() - 1].alpha_tag);
1560
// update Alpha Tag field when keyboard scrolling
1561
switch (Fl::event_key()) {
1564
if (FreqSelect->value() > 0)
1565
inAlphaTag->value(oplist[FreqSelect->value() - 1].alpha_tag);
1573
if (FreqSelect->value()) {
1574
long n = FreqSelect->value() - 1;
1575
for (int i = n; i < numinlist; i ++)
1576
oplist[i] = oplist[i+1];
1577
oplist[numinlist - 1].imode = USB;
1578
oplist[numinlist - 1].freq = 0;
1579
oplist[numinlist - 1].iBW = 0;
1580
memset(oplist[numinlist - 1].alpha_tag, 0, ATAGSIZE);
1588
long freq = FreqDispB->value();
1590
int mode = opMODE->index();
1592
if (btnDSP->visible())
1593
bw = ((opDSP_hi->index() << 8) | 0x8000) | (opDSP_lo->index() & 0xFF) ;
1596
for (int n = 0; n < numinlist; n++)
1597
if (freq == oplist[n].freq && mode == oplist[n].imode) {
1599
updateSelect(); // update list
1602
addtoList(freq, mode, bw);
1604
FreqDispB->visual_beep();
1606
long freq = FreqDispA->value();
1608
int mode = opMODE->index();
1610
if (btnDSP->visible())
1611
bw = ((opDSP_hi->index() << 8) | 0x8000) | (opDSP_lo->index() & 0xFF) ;
1614
for (int n = 0; n < numinlist; n++)
1615
if (freq == oplist[n].freq && mode == oplist[n].imode) {
1617
updateSelect(); // update list
1620
addtoList(freq, mode, bw);
1622
FreqDispA->visual_beep();
1628
pthread_mutex_lock(&mutex_serial);
1629
if (selrig->has_rit)
1630
selrig->setRit((int)cntRIT->value());
1631
pthread_mutex_unlock(&mutex_serial);
1636
pthread_mutex_lock(&mutex_serial);
1637
selrig->setXit((int)cntXIT->value());
1638
pthread_mutex_unlock(&mutex_serial);
1643
if (selrig->has_bfo)
1644
pthread_mutex_lock(&mutex_serial);
1645
selrig->setBfo((int)cntBFO->value());
1646
pthread_mutex_unlock(&mutex_serial);
1651
pthread_mutex_lock(&mutex_serial);
1652
progStatus.attenuator = btnAttenuator->value();
1653
selrig->set_attenuator(progStatus.attenuator);
1654
pthread_mutex_unlock(&mutex_serial);
1657
void setAttControl(void *d)
1660
btnAttenuator->value(val);
1665
pthread_mutex_lock(&mutex_serial);
1666
progStatus.preamp = btnPreamp->value();
1667
selrig->set_preamp(progStatus.preamp);
1668
pthread_mutex_unlock(&mutex_serial);
1671
void setPreampControl(void *d)
1674
btnPreamp->value(val);
1679
progStatus.noise = btnNOISE->value();
1680
pthread_mutex_lock(&mutex_serial);
1681
selrig->set_noise(progStatus.noise);
1682
pthread_mutex_unlock(&mutex_serial);
1687
if (!selrig->has_noise_reduction_control) return;
1688
noise_reduction_changed = true;
1689
sliders.push(SLIDER(NR, sldrNR->value(), btnNR->value() ) );
1695
if (!selrig->has_noise_reduction_control) return;
1696
noise_reduction_changed = true;
1697
if (rig_nbr == TS2000 || rig_nbr == TS590S || rig_nbr == TS990)
1698
sliders.push(SLIDER(NR, sldrNR->value(), -1 ) );
1700
sliders.push(SLIDER(NR, sldrNR->value(), btnNR->value() ) );
1705
progStatus.auto_notch = btnAutoNotch->value();
1706
pthread_mutex_lock(&mutex_serial);
1707
selrig->set_auto_notch(progStatus.auto_notch);
1708
pthread_mutex_unlock(&mutex_serial);
1713
if (!selrig->has_notch_control) return;
1714
notch_changed = true;
1715
sliders.push(SLIDER(NOTCH, sldrNOTCH->value(), btnNotch->value() ));
1720
if (!selrig->has_notch_control) return;
1721
notch_changed = true;
1722
sliders.push(SLIDER(NOTCH, sldrNOTCH->value(), btnNotch->value() ));
1725
// called from xml_io thread
1726
void setNotchControl(void *d)
1730
progStatus.notch_val = val;
1731
progStatus.notch = true;
1733
progStatus.notch = false;
1735
pthread_mutex_lock(&mutex_serial);
1736
selrig->set_notch(progStatus.notch, progStatus.notch_val);
1737
pthread_mutex_unlock(&mutex_serial);
1739
sldrNOTCH->value(progStatus.notch_val);
1740
btnNotch->value(progStatus.notch);
1743
void adjust_if_shift_control(void *d)
1745
sldrIFSHIFT->minimum(selrig->if_shift_min);
1746
sldrIFSHIFT->maximum(selrig->if_shift_max);
1747
sldrIFSHIFT->step(selrig->if_shift_step);
1748
sldrIFSHIFT->value(selrig->if_shift_mid);
1749
sldrIFSHIFT->redraw();
1754
void setIFshiftButton(void *d)
1757
if (b && !btnIFsh->value()) {
1760
else if (!b && btnIFsh->value()) {
1762
sldrIFSHIFT->value( selrig->if_shift_mid );
1766
void setIFshiftControl(void *d)
1769
if (sldrIFSHIFT->value() != val)
1770
sldrIFSHIFT->value(val);
1771
btnIFsh->value( val != selrig->if_shift_mid );
1776
if_shift_changed = true;
1777
sliders.push(SLIDER(IFSH, sldrIFSHIFT->value(), btnIFsh->value()));
1782
if_shift_changed = true;
1783
sliders.push(SLIDER(IFSH, sldrIFSHIFT->value(), btnIFsh->value()));
1793
volume_changed = true;
1794
sliders.push(SLIDER(VOL, sldrVOLUME->value()));
1799
volume_changed = true;
1800
if (btnVol->value() == 0) {
1801
sldrVOLUME->deactivate();
1802
sliders.push(SLIDER(VOL, 0));
1804
sldrVOLUME->activate();
1805
sliders.push(SLIDER(VOL, sldrVOLUME->value()));
1812
sliders.push(SLIDER(MIC, sldrMICGAIN->value()));
1815
void setMicGainControl(void* d)
1818
sldrMICGAIN->value(val);
1821
static int img = -1;
1823
void set_power_controlImage(double pwr)
1825
if (progStatus.pwr_scale == 0 || (progStatus.pwr_scale == 4 && pwr < 26.0)) {
1828
scalePower->image(image_p25);
1829
sldrFwdPwr->maximum(25.0);
1830
sldrFwdPwr->minimum(0.0);
1831
scalePower->redraw();
1834
else if (progStatus.pwr_scale == 1 || (progStatus.pwr_scale == 4 && pwr < 51.0)) {
1837
scalePower->image(image_p50);
1838
sldrFwdPwr->maximum(50.0);
1839
sldrFwdPwr->minimum(0.0);
1840
scalePower->redraw();
1843
else if (progStatus.pwr_scale == 2 || (progStatus.pwr_scale == 4 && pwr < 101.0)) {
1846
scalePower->image(image_p100);
1847
sldrFwdPwr->maximum(100.0);
1848
sldrFwdPwr->minimum(0.0);
1849
scalePower->redraw();
1852
else if (progStatus.pwr_scale >= 3) {
1855
scalePower->image(image_p200);
1856
sldrFwdPwr->maximum(200.0);
1857
sldrFwdPwr->minimum(0.0);
1858
scalePower->redraw();
1866
float pwr = progStatus.power_level = sldrPOWER->value();
1867
power_changed = true;
1868
sliders.push(SLIDER(PWR, progStatus.power_level));
1870
if (rig_nbr == K2) {
1871
double min, max, step;
1872
selrig->get_pc_min_max_step(min, max, step);
1873
sldrPOWER->minimum(min);
1874
sldrPOWER->maximum(max);
1875
sldrPOWER->step(step);
1876
sldrPOWER->value(progStatus.power_level);
1877
sldrPOWER->redraw();
1879
set_power_controlImage(pwr);
1884
pthread_mutex_lock(&mutex_serial);
1886
pthread_mutex_unlock(&mutex_serial);
1891
if (fldigi_online && progStatus.key_fldigi)
1892
send_ptt_changed(btnPTT->value());
1894
pthread_mutex_lock(&mutex_ptt);
1895
quePTT.push(btnPTT->value());
1896
pthread_mutex_unlock(&mutex_ptt);
1902
squelch_changed = true;
1903
sliders.push(SLIDER(SQL, sldrSQUELCH->value() ));
1908
rfgain_changed = true;
1909
sliders.push(SLIDER(RFGAIN, sldrRFGAIN->value() ));
1913
void updateALC(void * d)
1915
if (meter_image != ALC_IMAGE) return;
1916
double data = (long)d;
1917
sldrRcvSignal->hide();
1919
sldrALC->value(data);
1923
void updateSWR(void * d)
1925
if (meter_image != SWR_IMAGE) return;
1926
double data = (long)d;
1927
if (selrig->has_swr_control) {
1928
sldrRcvSignal->hide();
1932
sldrSWR->value(data);
1936
void updateFwdPwr(void *d)
1938
double power = (long)d;
1939
if (!sldrFwdPwr->visible()) {
1942
sldrFwdPwr->value(power);
1943
sldrFwdPwr->redraw();
1944
if (!selrig->has_power_control)
1945
set_power_controlImage(sldrFwdPwr->peak());
1948
void updateSquelch(void *d)
1950
sldrSQUELCH->value((long)d);
1951
sldrSQUELCH->redraw();
1954
void updateRFgain(void *d)
1956
sldrRFGAIN->value((long)d);
1957
sldrRFGAIN->redraw();
1960
void zeroXmtMeters(void *d)
1962
sldrFwdPwr->clear();
1970
void setFreqDispA(void *d)
1973
FreqDispA->value(f);
1974
FreqDispA->redraw();
1977
void setFreqDispB(void *d)
1980
FreqDispB->value(f);
1981
FreqDispB->redraw();
1984
void updateSmeter(void *d) // 0 to 100;
1986
double smeter = (long)d;
1987
if (!sldrRcvSignal->visible()) {
1988
sldrRcvSignal->show();
1993
sldrRcvSignal->value(smeter);
1994
sldrRcvSignal->redraw();
2001
remove(defFileName.c_str());
2004
ofstream oList(defFileName.c_str());
2006
fl_message ("Could not write to %s", defFileName.c_str());
2009
for (int i = 0; i < numinlist; i++) {
2010
atag = oplist[i].alpha_tag;
2011
oList << oplist[i].freq << " " << oplist[i].imode << " " << oplist[i].iBW << " \"" << atag.c_str() << "\"" << endl;
2017
void setPTT( void *d)
2020
pthread_mutex_lock(&mutex_ptt);
2022
pthread_mutex_unlock(&mutex_ptt);
2028
// restore initial rig settings
2029
pthread_mutex_lock(&mutex_serial);
2030
selrig->set_vfoA(transceiverA.freq);
2031
selrig->set_modeA(transceiverA.imode);
2032
selrig->set_bwA(transceiverA.iBW);
2033
selrig->set_vfoB(transceiverB.freq);
2034
selrig->set_modeB(transceiverB.imode);
2035
selrig->set_bwB(transceiverB.iBW);
2036
pthread_mutex_unlock(&mutex_serial);
2042
// shutdown xmlrpc thread
2045
pthread_mutex_lock(&mutex_xmlrpc);
2046
run_digi_loop = false;
2047
pthread_mutex_unlock(&mutex_xmlrpc);
2048
pthread_join(*digi_thread, NULL);
2050
progStatus.rig_nbr = rig_nbr;
2052
progStatus.freq_A = vfoA.freq;
2053
progStatus.imode_A = vfoA.imode;
2054
progStatus.iBW_A = vfoA.iBW;
2056
progStatus.freq_B = vfoB.freq;
2057
progStatus.imode_B = vfoB.imode;
2058
progStatus.iBW_B = vfoB.iBW;
2060
progStatus.spkr_on = btnVol->value();
2061
progStatus.volume = sldrVOLUME->value();
2062
progStatus.power_level = sldrPOWER->value();
2063
progStatus.rfgain = sldrRFGAIN->value();
2064
progStatus.mic_gain = sldrMICGAIN->value();
2065
progStatus.notch = btnNotch->value();
2066
progStatus.notch_val = sldrNOTCH->value();
2067
progStatus.shift = btnIFsh->value();
2068
progStatus.shift_val = sldrIFSHIFT->value();
2069
progStatus.noise_reduction = btnNR->value();
2070
progStatus.noise_reduction_val = sldrNR->value();
2071
progStatus.noise = btnNOISE->value();
2072
progStatus.attenuator = btnAttenuator->value();
2073
progStatus.preamp = btnPreamp->value();
2074
progStatus.auto_notch = btnAutoNotch->value();
2075
progStatus.saveLastState();
2079
// shutdown serial thread
2081
pthread_mutex_lock(&mutex_serial);
2082
run_serial_thread = false;
2083
pthread_mutex_unlock(&mutex_serial);
2084
pthread_join(*serial_thread, NULL);
2086
if (progStatus.restore_rig_data){
2087
selrig->set_vfoA(transceiverA.freq);
2088
selrig->set_modeA(transceiverA.imode);
2089
selrig->set_bwA(transceiverA.iBW);
2090
selrig->set_vfoB(transceiverB.freq);
2091
selrig->set_modeB(transceiverB.imode);
2092
selrig->set_bwB(transceiverB.iBW);
2098
if (selrig->has_xcvr_auto_on_off)
2099
selrig->set_xcvr_auto_off();
2101
// close down the serial port
2102
RigSerial.ClosePort();
2104
// restore fldigi to its no-rig state
2109
if (dlgDisplayConfig && dlgDisplayConfig->visible())
2110
dlgDisplayConfig->hide();
2111
if (dlgXcvrConfig && dlgXcvrConfig->visible())
2112
dlgXcvrConfig->hide();
2113
if (dlgMemoryDialog && dlgMemoryDialog->visible())
2114
dlgMemoryDialog->hide();
2122
if (!selrig->has_alc_control) return;
2123
if (meter_image == SWR_IMAGE) {
2124
btnALC_SWR->image(image_alc);
2125
meter_image = ALC_IMAGE;
2127
pthread_mutex_lock(&mutex_serial);
2128
selrig->select_alc();
2129
pthread_mutex_unlock(&mutex_serial);
2131
btnALC_SWR->image(image_swr);
2132
meter_image = SWR_IMAGE;
2134
pthread_mutex_lock(&mutex_serial);
2135
selrig->select_swr();
2136
pthread_mutex_unlock(&mutex_serial);
2138
btnALC_SWR->redraw();
2141
void update_UI_PTT(void *d)
2146
scaleSmeter->show();
2147
sldrRcvSignal->clear();
2150
scaleSmeter->hide();
2151
sldrFwdPwr->clear();
2157
void adjust_control_positions()
2159
// small_ui (ORIGINAL) USER INTERFACE
2160
if (progStatus.UIsize == small_ui)
2168
sldrIFSHIFT->hide();
2171
sldrMICGAIN->hide();
2173
sldrSQUELCH->hide();
2177
if (progStatus.schema == 1 && selrig->widgets[0].W != NULL) {
2179
while (selrig->widgets[i].W != NULL) {
2180
selrig->widgets[i].W->resize(
2181
selrig->widgets[i].x, selrig->widgets[i].y,
2182
selrig->widgets[i].w, selrig->widgets[i].W->h() );
2183
selrig->widgets[i].W->show();
2184
selrig->widgets[i].W->redraw();
2185
if (selrig->widgets[i].y > y) y = selrig->widgets[i].y;
2188
if (selrig->has_data_port) {
2189
sldrMICGAIN->label("");
2190
sldrMICGAIN->redraw_label();
2193
y = cntRIT->y() + 2;
2194
if (selrig->has_volume_control) {
2196
btnVol->position( 2, y);
2199
sldrVOLUME->resize( 54, y, 368, 18 );
2201
sldrVOLUME->redraw();
2203
if (selrig->has_rf_control) {
2205
sldrRFGAIN->resize( 54, y, 368, 18 );
2207
sldrRFGAIN->redraw();
2209
if (selrig->has_sql_control) {
2211
sldrSQUELCH->resize( 54, y, 368, 18 );
2212
sldrSQUELCH->show();
2213
sldrSQUELCH->redraw();
2215
if (selrig->has_noise_reduction_control) {
2217
btnNR->position( 2, y);
2220
sldrNR->resize( 54, y, 368, 18 );
2224
if (selrig->has_ifshift_control) {
2226
btnIFsh->position( 2, y);
2229
sldrIFSHIFT->resize( 54, y, 368, 18 );
2230
sldrIFSHIFT->show();
2231
sldrIFSHIFT->redraw();
2233
if (selrig->has_notch_control) {
2235
btnNotch->position( 2, y);
2238
sldrNOTCH->resize( 54, y, 368, 18 );
2240
sldrNOTCH->redraw();
2242
if (selrig->has_micgain_control) {
2244
if (selrig->has_data_port) {
2245
sldrMICGAIN->label("");
2246
sldrMICGAIN->redraw_label();
2247
btnDataPort->position( 2, y);
2248
btnDataPort->show();
2249
btnDataPort->redraw();
2251
sldrMICGAIN->resize( 54, y, 368, 18 );
2252
sldrMICGAIN->show();
2253
sldrMICGAIN->redraw();
2255
if (selrig->has_power_control) {
2257
sldrPOWER->resize( 54, y, 368, 18 );
2259
sldrPOWER->redraw();
2263
btn_show_controls->position( btn_show_controls->x(), y );
2264
btnAttenuator->position( btnAttenuator->x(), y);
2265
btnAttenuator->redraw();
2266
btnPreamp->position( btnPreamp->x(), y);
2267
btnPreamp->redraw();
2268
btnNOISE->position( btnNOISE->x(), y);
2270
btnAutoNotch->position( btnAutoNotch->x(), y);
2271
btnAutoNotch->redraw();
2272
btnTune->position( btnTune->x(), y);
2275
if (rig_nbr == FT1000MP) {
2277
btnTune->position( btnTune->x(), y);
2279
btnAutoNotch->position( btnAutoNotch->x(), y);
2280
btnAutoNotch->redraw();
2281
btnPTT->position( btnPTT->x(), y);
2285
if ( rig_nbr == FT100D ||
2289
rig_nbr == FT857D ||
2291
rig_nbr == FT897D ||
2292
rig_nbr == FT920 ) {
2294
btnPTT->position( btnPTT->x(), y);
2298
int use_AuxPort = (progStatus.aux_serial_port != "NONE");
2300
btnPTT->resize(btnPTT->x(), y, btnPTT->w(), 38);
2303
boxControl->position(boxControl->x(), y);
2304
btnAuxRTS->position(btnAuxRTS->x(), y);
2305
btnAuxDTR->position(btnAuxDTR->x(), y);
2306
btnAuxRTS->value(progStatus.aux_rts);
2307
btnAuxDTR->value(progStatus.aux_dtr);
2315
btnPTT->resize(btnPTT->x(), y, btnPTT->w(), 18);
2319
btnInitializing->hide();
2321
tabs550->resize(tabs550->x(), y + 20, tabs550->w(), tabs550->h());
2324
tabsGeneric->resize(tabsGeneric->x(), y + 20, tabsGeneric->w(), tabsGeneric->h());
2325
tabsGeneric->hide();
2327
btn_show_controls->label("@-22->");
2328
btn_show_controls->redraw_label();
2330
if (selrig->has_extras)
2331
btn_show_controls->show();
2333
btn_show_controls->hide();
2337
mainwindow->size( mainwindow->w(), y);
2338
mainwindow->init_sizes();
2339
mainwindow->redraw();
2341
if (progStatus.tooltips) {
2342
Fl_Tooltip::enable(1);
2345
mnuTooltips->clear();
2346
Fl_Tooltip::enable(0);
2348
if (progStatus.schema)
2354
// wide_ui USER INTERFACE
2355
mainwindow->resize( mainwindow->x(), mainwindow->y(), mainwindow->w(), 218);
2361
sldrIFSHIFT->show();
2364
sldrMICGAIN->show();
2366
sldrSQUELCH->show();
2371
if (rig_nbr == TT550) {
2373
tabsGeneric->hide();
2376
tabsGeneric->remove(genericAux);
2377
if (progStatus.aux_serial_port != "NONE" || selrig->has_data_port) {
2378
if (progStatus.aux_serial_port != "NONE") {
2379
btnAuxRTS->activate();
2380
btnAuxDTR->activate();
2382
btnAuxRTS->deactivate();
2383
btnAuxDTR->deactivate();
2385
if (selrig->has_data_port)
2386
btnDataPort->activate();
2388
btnDataPort->deactivate();
2389
tabsGeneric->add(genericAux);
2391
tabsGeneric->remove(genericRXB);
2392
if (selrig->has_rit || selrig->has_xit || selrig->has_bfo)
2393
tabsGeneric->add(genericRXB);
2394
tabsGeneric->show();
2397
btnInitializing->hide();
2399
mainwindow->init_sizes();
2401
mainwindow->redraw();
2403
if (progStatus.tooltips) {
2404
Fl_Tooltip::enable(1);
2407
mnuTooltips->clear();
2408
Fl_Tooltip::enable(0);
2416
if (rig_nbr == TT550) {
2417
cnt_tt550_line_out->value(progStatus.tt550_line_out);
2418
cbo_tt550_agc_level->index(progStatus.tt550_agc_level);
2419
cnt_tt550_cw_wpm->value(progStatus.tt550_cw_wpm);
2420
cnt_tt550_cw_vol->value(progStatus.tt550_cw_vol);
2421
cnt_tt550_cw_spot->value(progStatus.tt550_cw_spot);
2422
cnt_tt550_cw_weight->value(progStatus.tt550_cw_weight);
2423
cnt_tt550_cw_qsk->value(progStatus.tt550_cw_qsk);
2424
btn_tt550_enable_keyer->value(progStatus.tt550_enable_keyer);
2425
btn_tt550_vox->value(progStatus.tt550_vox_onoff);
2426
cnt_tt550_vox_gain->value(progStatus.tt550_vox_gain);
2427
cnt_tt550_anti_vox->value(progStatus.tt550_vox_anti);
2428
cnt_tt550_vox_hang->value(progStatus.tt550_vox_hang);
2429
btn_tt550_CompON->value(progStatus.tt550_compON);
2430
cnt_tt550_compression->value(progStatus.tt550_compression);
2431
cnt_tt550_mon_vol->value(progStatus.tt550_mon_vol);
2432
btn_tt550_enable_xmtr->value(progStatus.tt550_enable_xmtr);
2433
btn_tt550_enable_tloop->value(progStatus.tt550_enable_tloop);
2434
btn_tt550_tuner_bypass->value(progStatus.tt550_tuner_bypass);
2435
btn_tt550_use_xmt_bw->value(progStatus.tt550_use_xmt_bw);
2436
sel_tt550_encoder_step->value(progStatus.tt550_encoder_step);
2437
cnt_tt550_encoder_sensitivity->value(progStatus.tt550_encoder_sensitivity);
2438
sel_tt550_F1_func->value(progStatus.tt550_F1_func);
2439
sel_tt550_F2_func->value(progStatus.tt550_F2_func);
2440
sel_tt550_F3_func->value(progStatus.tt550_F3_func);
2441
mnuRestoreData->clear();
2442
mnuRestoreData->hide();
2443
mnuKeepData->clear();
2444
mnuKeepData->hide();
2445
progStatus.restore_rig_data = false;
2446
progStatus.use_rig_data = false;
2447
op_tt550_XmtBW->clear();
2448
for (int i = 0; TT550_xmt_widths[i] != NULL; i++) {
2449
op_tt550_XmtBW->add(TT550_xmt_widths[i]);
2451
op_tt550_XmtBW->activate();
2452
op_tt550_XmtBW->index(progStatus.tt550_xmt_bw);
2454
poll_smeter->activate(); poll_smeter->value(progStatus.poll_smeter);
2455
poll_pout->activate(); poll_pout->value(progStatus.poll_pout);
2456
poll_swr->activate(); poll_swr->value(progStatus.poll_swr);
2457
poll_alc->activate(); poll_alc->value(progStatus.poll_alc);
2458
poll_frequency->deactivate(); poll_frequency->value(0);
2459
poll_mode->deactivate(); poll_mode->value(0);
2460
poll_bandwidth->deactivate(); poll_bandwidth->value(0);
2461
poll_volume->deactivate(); poll_volume->value(0);
2462
poll_notch->deactivate(); poll_notch->value(0);
2463
poll_auto_notch->deactivate(); poll_auto_notch->value(0);
2464
poll_ifshift->deactivate(); poll_ifshift->value(0);
2465
poll_power_control->deactivate(); poll_power_control->value(0);
2466
poll_pre_att->deactivate(); poll_pre_att->value(0);
2467
poll_squelch->deactivate(); poll_squelch->value(0);
2468
poll_micgain->deactivate(); poll_micgain->value(0);
2469
poll_rfgain->deactivate(); poll_rfgain->value(0);
2470
poll_split->deactivate(); poll_split->value(0);
2471
poll_nr->deactivate(); poll_nr->value(0);
2472
poll_noise->deactivate(); poll_noise->value(0);
2473
poll_all->deactivate(); poll_all->value(0);
2477
tabsGeneric->remove(*genericBands);
2478
tabsGeneric->remove(*genericCW);
2479
tabsGeneric->remove(*genericVOX);
2480
tabsGeneric->remove(*genericSpeech);
2481
tabsGeneric->remove(*genericRx);
2482
tabsGeneric->remove(*genericMisc);
2484
if (selrig->has_band_selection) {
2485
genericBands->resize(
2486
tabsGeneric->x() + 2,
2487
tabsGeneric->y() + 19,
2488
tabsGeneric->w() - 4,
2489
tabsGeneric->h() - 21);
2490
tabsGeneric->insert(*genericBands, 0);
2493
poll_all->activate();
2494
poll_all->value(progStatus.poll_all);
2496
if (selrig->has_cw_wpm || selrig->has_cw_qsk || selrig->has_cw_weight ||
2497
selrig->has_cw_keyer || selrig->has_cw_spot || selrig->has_cw_spot_tone) {
2499
tabsGeneric->x() + 2,
2500
tabsGeneric->y() + 19,
2501
tabsGeneric->w() - 4,
2502
tabsGeneric->h() - 21);
2503
tabsGeneric->insert(*genericCW, 6);
2504
if (selrig->has_cw_wpm) {
2506
selrig->get_cw_wpm_min_max(min, max);
2507
cnt_cw_wpm->minimum(min);
2508
cnt_cw_wpm->maximum(max);
2509
cnt_cw_wpm->value(progStatus.cw_wpm);
2511
selrig->set_cw_wpm();
2512
} else cnt_cw_wpm->hide();
2513
if (selrig->has_cw_qsk) {
2514
double min, max, step;
2515
selrig->get_cw_qsk_min_max_step(min, max, step);
2516
cnt_cw_qsk->minimum(min);
2517
cnt_cw_qsk->maximum(max);
2518
cnt_cw_qsk->step(step);
2519
cnt_cw_qsk->value(progStatus.cw_qsk);
2521
selrig->set_cw_qsk();
2522
} else cnt_cw_qsk->hide();
2523
if (selrig->has_cw_weight) {
2524
double min, max, step;
2525
selrig->get_cw_weight_min_max_step( min, max, step );
2526
cnt_cw_weight->minimum(min);
2527
cnt_cw_weight->maximum(max);
2528
cnt_cw_weight->step(step);
2529
cnt_cw_weight->value(progStatus.cw_weight);
2530
cnt_cw_weight->show();
2531
selrig->set_cw_weight();
2532
} else cnt_cw_weight->hide();
2533
if (selrig->has_cw_keyer) {
2534
btn_enable_keyer->show();
2535
btn_enable_keyer->value(progStatus.enable_keyer);
2536
selrig->enable_keyer();
2537
} else btn_enable_keyer->hide();
2538
if (selrig->has_cw_spot) {
2539
btnSpot->value(progStatus.cw_spot);
2540
selrig->set_cw_spot();
2542
} else btnSpot->hide();
2543
if (selrig->has_cw_spot_tone) {
2544
cnt_cw_spot_tone->show();
2546
selrig->get_cw_spot_tone_min_max_step(min, max, step);
2547
cnt_cw_spot_tone->minimum(min);
2548
cnt_cw_spot_tone->maximum(max);
2549
cnt_cw_spot_tone->step(step);
2550
cnt_cw_spot_tone->value(progStatus.cw_spot_tone);
2551
selrig->set_cw_spot_tone();
2552
} else cnt_cw_spot_tone->hide();
2555
if (selrig->has_vox_onoff || selrig->has_vox_gain || selrig->has_vox_anti ||
2556
selrig->has_vox_hang || selrig->has_vox_on_dataport || selrig->has_cw_spot_tone) {
2558
tabsGeneric->x() + 2,
2559
tabsGeneric->y() + 19,
2560
tabsGeneric->w() - 4,
2561
tabsGeneric->h() - 21);
2562
tabsGeneric->insert(*genericVOX, 6);
2563
if (selrig->has_vox_onoff) {
2565
btn_vox->value(progStatus.vox_onoff);
2566
selrig->set_vox_onoff();
2567
} else btn_vox->hide();
2568
if (selrig->has_vox_gain) {
2569
cnt_vox_gain->show();
2571
selrig->get_vox_gain_min_max_step(min, max, step);
2572
cnt_vox_gain->minimum(min);
2573
cnt_vox_gain->maximum(max);
2574
cnt_vox_gain->step(step);
2575
cnt_vox_gain->value(progStatus.vox_gain);
2576
selrig->set_vox_gain();
2577
} else cnt_vox_gain->hide();
2578
if (selrig->has_vox_anti) {
2579
cnt_anti_vox->show();
2581
selrig->get_vox_anti_min_max_step(min, max, step);
2582
cnt_anti_vox->minimum(min);
2583
cnt_anti_vox->maximum(max);
2584
cnt_anti_vox->step(step);
2585
cnt_anti_vox->value(progStatus.vox_anti);
2586
selrig->set_vox_anti();
2587
} else cnt_anti_vox->hide();
2588
if (selrig->has_vox_hang) {
2589
cnt_vox_hang->show();
2591
selrig->get_vox_hang_min_max_step(min, max, step);
2592
cnt_vox_hang->minimum(min);
2593
cnt_vox_hang->maximum(max);
2594
cnt_vox_hang->step(step);
2595
cnt_vox_hang->value(progStatus.vox_hang);
2596
selrig->set_vox_hang();
2597
} else cnt_vox_hang->hide();
2598
if (selrig->has_vox_on_dataport) {
2599
btn_vox_on_dataport->show();
2600
btn_vox_on_dataport->value(progStatus.vox_on_dataport);
2601
selrig->set_vox_on_dataport();
2602
} else btn_vox_on_dataport->hide();
2605
if (selrig->has_compON || selrig->has_compression) {
2606
genericSpeech->resize(
2607
tabsGeneric->x() + 2,
2608
tabsGeneric->y() + 19,
2609
tabsGeneric->w() - 4,
2610
tabsGeneric->h() - 21);
2611
tabsGeneric->insert(*genericSpeech, 6);
2612
if (selrig->has_compON) {
2614
btnCompON->value(progStatus.compON);
2617
if (selrig->has_compression) {
2619
selrig->get_comp_min_max_step(min, max, step);
2620
cnt_compression->minimum(min);
2621
cnt_compression->maximum(max);
2622
cnt_compression->step(step);
2623
cnt_compression->show();
2624
cnt_compression->value(progStatus.compression);
2625
selrig->set_compression();
2627
cnt_compression->hide();
2629
if (selrig->has_agc_level || selrig->has_nb_level || selrig->has_bpf_center) {
2631
tabsGeneric->x() + 2,
2632
tabsGeneric->y() + 19,
2633
tabsGeneric->w() - 4,
2634
tabsGeneric->h() - 21);
2635
tabsGeneric->insert(*genericRx, 6);
2636
if (selrig->has_agc_level) cbo_agc_level->activate(); else cbo_agc_level->deactivate();
2637
if (selrig->has_nb_level) cbo_nb_level->activate(); else cbo_nb_level->deactivate();
2638
if (selrig->has_bpf_center) {
2639
cnt_bpf_center->value(progStatus.bpf_center);
2640
cnt_bpf_center->show();
2641
btn_use_bpf_center->show();
2643
cnt_bpf_center->hide();
2644
btn_use_bpf_center->hide();
2648
if (selrig->has_vfo_adj || selrig->has_xcvr_auto_on_off) {
2649
genericMisc->resize(
2650
tabsGeneric->x() + 2,
2651
tabsGeneric->y() + 19,
2652
tabsGeneric->w() - 4,
2653
tabsGeneric->h() - 21);
2654
tabsGeneric->insert(*genericMisc, 6);
2655
if (selrig->has_vfo_adj) {
2657
selrig->get_vfoadj_min_max_step(min, max, step);
2658
cnt_vfo_adj->minimum(min);
2659
cnt_vfo_adj->maximum(max);
2660
cnt_vfo_adj->step(step);
2661
progStatus.vfo_adj = selrig->getVfoAdj();
2662
cnt_vfo_adj->value(progStatus.vfo_adj);
2663
cnt_vfo_adj->show();
2665
cnt_vfo_adj->hide();
2666
cnt_line_out->hide(); // enable if a lineout control is used by any transceiver
2668
if (selrig->has_xcvr_auto_on_off) {
2669
btn_xcvr_auto_on->value(progStatus.xcvr_auto_on);
2670
btn_xcvr_auto_off->value(progStatus.xcvr_auto_off);
2671
btn_xcvr_auto_on->show();
2672
btn_xcvr_auto_off->show();
2674
btn_xcvr_auto_on->hide();
2675
btn_xcvr_auto_off->hide();
2680
tabsGeneric->redraw();
2682
mnuRestoreData->show();
2683
mnuKeepData->show();
2685
poll_frequency->activate(); poll_frequency->value(progStatus.poll_frequency);
2686
poll_mode->activate(); poll_mode->value(progStatus.poll_mode);
2687
poll_bandwidth->activate(); poll_bandwidth->value(progStatus.poll_bandwidth);
2689
poll_smeter->activate(); poll_smeter->value(progStatus.poll_smeter);
2690
poll_pout->activate(); poll_pout->value(progStatus.poll_pout);
2691
poll_swr->activate(); poll_swr->value(progStatus.poll_swr);
2692
poll_alc->activate(); poll_alc->value(progStatus.poll_alc);
2693
poll_volume->activate(); poll_volume->value(progStatus.poll_volume);
2694
poll_notch->activate(); poll_notch->value(progStatus.poll_notch);
2695
poll_auto_notch->activate(); poll_auto_notch->value(progStatus.poll_auto_notch);
2696
poll_ifshift->activate(); poll_ifshift->value(progStatus.poll_ifshift);
2697
poll_power_control->activate(); poll_power_control->value(progStatus.poll_power_control);
2698
poll_pre_att->activate(); poll_pre_att->value(progStatus.poll_pre_att);
2699
poll_squelch->activate(); poll_squelch->value(progStatus.poll_squelch);
2700
poll_micgain->activate(); poll_micgain->value(progStatus.poll_micgain);
2701
poll_rfgain->activate(); poll_rfgain->value(progStatus.poll_rfgain);
2702
poll_split->activate(); poll_split->value(progStatus.poll_split);
2703
poll_noise->activate(); poll_noise->value(progStatus.poll_noise);
2704
poll_nr->activate(); poll_nr->value(progStatus.poll_nr);
2706
if (!selrig->has_bandwidth_control) { poll_bandwidth->deactivate(); poll_bandwidth->value(0); }
2707
if (!selrig->has_smeter) { poll_smeter->deactivate(); poll_smeter->value(0); }
2708
if (!selrig->has_power_out) { poll_pout->deactivate(); poll_pout->value(0); }
2709
if (!selrig->has_swr_control) { poll_swr->deactivate(); poll_swr->value(0); }
2710
if (!selrig->has_alc_control) { poll_alc->deactivate(); poll_alc->value(0); }
2711
if (!selrig->has_volume_control) { poll_volume->deactivate(); poll_volume->value(0); }
2712
if (!selrig->has_notch_control) { poll_notch->deactivate(); poll_notch->value(0); }
2713
if (!selrig->has_auto_notch || rig_nbr == FT1000MP)
2714
{ poll_auto_notch->deactivate(); poll_auto_notch->value(0); }
2715
if (!selrig->has_ifshift_control) { poll_ifshift->deactivate(); poll_ifshift->value(0); }
2716
if (!selrig->has_power_control) { poll_power_control->deactivate(); poll_power_control->value(0); }
2717
if (!selrig->has_preamp_control && !selrig->has_attenuator_control)
2718
{ poll_pre_att->deactivate(); poll_pre_att->value(0); }
2719
if (!selrig->has_sql_control) { poll_squelch->deactivate(); poll_squelch->value(0); }
2720
if (!selrig->has_micgain_control) { poll_micgain->deactivate(); poll_micgain->value(0); }
2721
if (!selrig->has_rf_control) { poll_rfgain->deactivate(); poll_rfgain->value(0); }
2722
if (!selrig->has_split) { poll_split->deactivate(); poll_split->value(0); }
2723
if (!selrig->has_noise_control) {poll_noise->deactivate(); poll_noise->value(0);}
2724
if (!selrig->has_noise_reduction) {poll_nr->deactivate(); poll_nr->value(0);}
2732
flrig_abort = false;
2734
sldrRcvSignal->aging(progStatus.rx_peak);
2735
sldrRcvSignal->avg(progStatus.rx_avg);
2736
sldrFwdPwr->aging(progStatus.pwr_peak);
2737
sldrFwdPwr->avg(progStatus.pwr_avg);
2739
// wait_query = true;
2742
pthread_mutex_lock(&mutex_xmlrpc);
2744
// disable the serial thread
2745
pthread_mutex_lock(&mutex_serial);
2747
// Xcvr Auto Power on as soon as possible
2748
if (selrig->has_xcvr_auto_on_off)
2749
selrig->set_xcvr_auto_on();
2751
selrig->initialize();
2752
if (flrig_abort) goto failed;
2754
FreqDispA->set_precision(selrig->precision);
2755
FreqDispA->set_ndigits(selrig->ndigits);
2756
FreqDispB->set_precision(selrig->precision);
2757
FreqDispB->set_ndigits(selrig->ndigits);
2759
if (rig_nbr == TT550) {
2762
vfoB.freq = progStatus.freq_B;
2763
vfoB.imode = progStatus.imode_B;
2764
vfoB.iBW = progStatus.iBW_B;
2765
FreqDispB->value(vfoB.freq);
2766
selrig->set_vfoB(vfoB.freq);
2767
selrig->set_modeB(vfoB.imode);
2768
selrig->set_bwB(vfoB.iBW);
2770
vfo.freq = vfoA.freq = progStatus.freq_A;
2771
vfo.imode = vfoA.imode = progStatus.imode_A;
2772
vfo.iBW = vfoA.iBW = progStatus.iBW_A;
2773
FreqDispA->value( vfoA.freq );
2774
selrig->set_vfoA(vfoA.freq);
2775
selrig->set_modeA(vfoA.imode);
2777
if (vfoA.iBW == -1) vfoA.iBW = selrig->def_bandwidth(vfoA.imode);
2778
selrig->set_bwA(vfoA.iBW);
2782
for (int i = 0; selrig->modes_[i] != NULL; i++) {
2783
rigmodes_.push_back(selrig->modes_[i]);
2784
opMODE->add(selrig->modes_[i]);
2787
opMODE->index(vfoA.imode);
2792
old_bws = selrig->bandwidths_;
2793
for (int i = 0; selrig->bandwidths_[i] != NULL; i++) {
2794
rigbws_.push_back(selrig->bandwidths_[i]);
2795
opBW->add(selrig->bandwidths_[i]);
2798
opBW->index(vfoA.iBW);
2801
if (progStatus.CIV > 0)
2802
selrig->adjustCIV(progStatus.CIV);
2803
if (progStatus.use_rig_data) {
2805
if (selrig->has_get_info)
2807
transceiverA.freq = selrig->get_vfoA();
2808
transceiverA.imode = selrig->get_modeA();
2809
selrig->adjust_bandwidth(transceiverA.imode);
2810
transceiverA.iBW = selrig->get_bwA();
2812
if (selrig->has_get_info)
2814
transceiverB.freq = selrig->get_vfoB();
2815
transceiverB.imode = selrig->get_modeB();
2816
selrig->adjust_bandwidth(transceiverB.imode);
2817
transceiverB.iBW = selrig->get_bwB();
2818
progStatus.freq_A = transceiverA.freq;
2819
progStatus.imode_A = transceiverA.imode;
2820
progStatus.iBW_A = transceiverA.iBW;
2821
progStatus.freq_B = transceiverB.freq;
2822
progStatus.imode_B = transceiverB.imode;
2823
progStatus.iBW_B = transceiverB.iBW;
2825
if (selrig->restore_mbw) selrig->last_bw = transceiverA.iBW;
2827
mnuKeepData->clear();
2831
if (selrig->has_mode_control) {
2832
for (int i = 0; selrig->modes_[i] != NULL; i++) {
2833
rigmodes_.push_back(selrig->modes_[i]);
2834
opMODE->add(selrig->modes_[i]);
2837
opMODE->index(progStatus.imode_A);
2841
opMODE->deactivate();
2847
if (selrig->has_bandwidth_control) {
2848
old_bws = selrig->bandwidths_;
2849
for (int i = 0; selrig->bandwidths_[i] != NULL; i++) {
2850
rigbws_.push_back(selrig->bandwidths_[i]);
2851
opBW->add(selrig->bandwidths_[i]);
2854
if (progStatus.iBW_A == -1) progStatus.iBW_A = selrig->def_bandwidth(vfoA.imode);
2855
if (progStatus.iBW_B == -1) progStatus.iBW_B = selrig->def_bandwidth(vfoB.imode);
2856
opBW->index(progStatus.iBW_A);
2864
if (selrig->has_special)
2866
// btnSpecial->activate();
2869
// btnSpecial->deactivate();
2871
if (selrig->has_rit) {
2873
selrig->get_RIT_min_max_step(min, max, step);
2874
cntRIT->minimum(min);
2875
cntRIT->maximum(max);
2877
if (progStatus.UIsize == small_ui)
2881
cntRIT->value(progStatus.rit_freq);
2883
if (progStatus.UIsize == small_ui)
2886
cntRIT->deactivate();
2889
if (selrig->has_xit) {
2891
selrig->get_XIT_min_max_step(min, max, step);
2892
cntXIT->minimum(min);
2893
cntXIT->maximum(max);
2895
cntXIT->value(progStatus.xit_freq);
2896
if (progStatus.UIsize == small_ui)
2901
if (progStatus.UIsize == small_ui)
2904
cntXIT->deactivate();
2907
if (selrig->has_bfo) {
2909
selrig->get_BFO_min_max_step(min, max, step);
2910
cntBFO->minimum(min);
2911
cntBFO->maximum(max);
2913
cntBFO->value(progStatus.bfo_freq);
2914
if (progStatus.UIsize == small_ui)
2919
if (progStatus.UIsize == small_ui)
2922
cntBFO->deactivate();
2925
if (selrig->has_dsp_controls) {
2928
btnDSP->label(selrig->lo_label);
2929
btnDSP->redraw_label();
2930
for (int i = 0; selrig->dsp_lo[i] != NULL; i++)
2931
opDSP_lo->add(selrig->dsp_lo[i]);
2932
opDSP_lo->tooltip(selrig->lo_tooltip);
2933
for (int i = 0; selrig->dsp_hi[i] != NULL; i++)
2934
opDSP_hi->add(selrig->dsp_hi[i]);
2935
opDSP_hi->tooltip(selrig->hi_tooltip);
2936
if (vfo.iBW > 256) {
2937
opDSP_lo->index(vfo.iBW & 0xFF);
2938
opDSP_hi->index((vfo.iBW >> 8) & 0x7F);
2959
if (selrig->has_volume_control) {
2961
selrig->get_vol_min_max_step(min, max, step);
2962
sldrVOLUME->minimum(min);
2963
sldrVOLUME->maximum(max);
2964
sldrVOLUME->step(step);
2965
sldrVOLUME->redraw();
2966
if (progStatus.use_rig_data) {
2967
progStatus.volume = selrig->get_volume_control();
2968
sldrVOLUME->value(progStatus.volume);
2970
sldrVOLUME->activate();
2972
sldrVOLUME->value(progStatus.volume);
2973
if (progStatus.spkr_on == 0) {
2975
sldrVOLUME->deactivate();
2976
selrig->set_volume_control(0);
2979
sldrVOLUME->activate();
2980
selrig->set_volume_control(progStatus.volume);
2983
if (progStatus.UIsize == small_ui) {
2988
sldrVOLUME->activate();
2991
if (progStatus.UIsize == small_ui) {
2995
btnVol->deactivate();
2996
sldrVOLUME->deactivate();
3000
if (selrig->has_rf_control) {
3002
selrig->get_rf_min_max_step(min, max, step);
3003
sldrRFGAIN->minimum(min);
3004
sldrRFGAIN->maximum(max);
3005
sldrRFGAIN->step(step);
3006
sldrRFGAIN->redraw();
3007
if (progStatus.use_rig_data) {
3008
progStatus.rfgain = selrig->get_rf_gain();
3009
sldrRFGAIN->value(progStatus.rfgain);
3010
if (progStatus.UIsize == small_ui)
3013
sldrRFGAIN->activate();
3015
sldrRFGAIN->value(progStatus.rfgain);
3016
selrig->set_rf_gain(progStatus.rfgain);
3017
if (progStatus.UIsize == small_ui)
3020
sldrRFGAIN->activate();
3023
if (progStatus.UIsize == small_ui)
3026
sldrRFGAIN->deactivate();
3029
if (selrig->has_sql_control) {
3031
selrig->get_squelch_min_max_step(min, max, step);
3032
sldrSQUELCH->minimum(min);
3033
sldrSQUELCH->maximum(max);
3034
sldrSQUELCH->step(step);
3035
sldrSQUELCH->redraw();
3036
if (progStatus.use_rig_data) {
3037
progStatus.squelch = selrig->get_squelch();
3038
sldrSQUELCH->value(progStatus.squelch);
3039
if (progStatus.UIsize == small_ui)
3040
sldrSQUELCH->show();
3042
sldrSQUELCH->activate();
3044
sldrSQUELCH->value(progStatus.squelch);
3045
selrig->set_squelch(progStatus.squelch);
3046
if (progStatus.UIsize == small_ui)
3047
sldrSQUELCH->show();
3049
sldrSQUELCH->activate();
3052
if (progStatus.UIsize == small_ui)
3053
sldrSQUELCH->hide();
3055
sldrSQUELCH->deactivate();
3058
if (selrig->has_noise_reduction_control) {
3060
selrig->get_nr_min_max_step(min, max, step);
3061
sldrNR->minimum(min);
3062
sldrNR->maximum(max);
3065
if (progStatus.UIsize == small_ui) {
3072
if (progStatus.use_rig_data) {
3073
progStatus.noise_reduction = selrig->get_noise_reduction();
3074
progStatus.noise_reduction_val = selrig->get_noise_reduction_val();
3075
btnNR->value(progStatus.noise_reduction);
3076
sldrNR->value(progStatus.noise_reduction_val);
3078
btnNR->value(progStatus.noise_reduction);
3079
sldrNR->value(progStatus.noise_reduction_val);
3080
selrig->set_noise_reduction(progStatus.noise_reduction);
3081
selrig->set_noise_reduction_val(progStatus.noise_reduction_val);
3084
if (progStatus.UIsize == small_ui) {
3088
btnNR->deactivate();
3089
sldrNR->deactivate();
3093
if (selrig->has_ifshift_control) {
3098
selrig->get_if_min_max_step(min, max, step);
3099
sldrIFSHIFT->minimum(min);
3100
sldrIFSHIFT->maximum(max);
3101
sldrIFSHIFT->step(step);
3102
sldrIFSHIFT->redraw();
3103
if (progStatus.use_rig_data) {
3104
progStatus.shift = selrig->get_if_shift(progStatus.shift_val);
3105
btnIFsh->value(progStatus.shift);
3106
sldrIFSHIFT->value(progStatus.shift_val);
3108
if (progStatus.shift) {
3110
sldrIFSHIFT->value(progStatus.shift_val);
3111
selrig->set_if_shift(progStatus.shift_val);
3114
sldrIFSHIFT->value(selrig->if_shift_mid);
3115
selrig->set_if_shift(selrig->if_shift_mid);
3118
if (progStatus.UIsize == small_ui) {
3120
sldrIFSHIFT->show();
3122
btnIFsh->activate();
3123
sldrIFSHIFT->activate();
3126
if (progStatus.UIsize == small_ui) {
3128
sldrIFSHIFT->hide();
3130
btnIFsh->deactivate();
3131
sldrIFSHIFT->deactivate();
3134
if (rig_nbr == TS870S) {
3135
if (progStatus.imode_A == RIG_TS870S::tsCW ||
3136
progStatus.imode_A == RIG_TS870S::tsCWR) {
3137
btnIFsh->activate();
3138
sldrIFSHIFT->activate();
3140
btnIFsh->deactivate();
3141
sldrIFSHIFT->deactivate();
3147
if (selrig->has_notch_control) {
3149
selrig->get_notch_min_max_step(min, max, step);
3150
sldrNOTCH->minimum(min);
3151
sldrNOTCH->maximum(max);
3152
sldrNOTCH->step(step);
3153
sldrNOTCH->redraw();
3154
if (progStatus.use_rig_data) {
3155
progStatus.notch = selrig->get_notch(progStatus.notch_val);
3156
btnNotch->value(progStatus.notch);
3157
sldrNOTCH->value(progStatus.notch_val);
3159
btnNotch->value(progStatus.notch);
3160
sldrNOTCH->value(progStatus.notch_val);
3161
selrig->set_notch(progStatus.notch, progStatus.notch_val);
3163
if (progStatus.UIsize == small_ui) {
3167
btnNotch->activate();
3168
sldrNOTCH->activate();
3171
if (progStatus.UIsize == small_ui) {
3175
btnNotch->deactivate();
3176
sldrNOTCH->deactivate();
3180
if (selrig->has_micgain_control) {
3181
int min = 0, max = 0, step = 0;
3182
selrig->get_mic_min_max_step(min, max, step);
3183
sldrMICGAIN->minimum(min);
3184
sldrMICGAIN->maximum(max);
3185
sldrMICGAIN->step(step);
3186
if (progStatus.use_rig_data)
3187
progStatus.mic_gain = selrig->get_mic_gain();
3189
selrig->set_mic_gain(progStatus.mic_gain);
3190
sldrMICGAIN->value(progStatus.mic_gain);
3191
if (progStatus.UIsize == small_ui)
3192
sldrMICGAIN->show();
3194
sldrMICGAIN->activate();
3195
if (selrig->has_data_port) {
3196
btnDataPort->show();
3197
btnDataPort->value(progStatus.data_port);
3198
btnDataPort->label(progStatus.data_port ? "Data" : "Mic");
3199
btnDataPort->redraw_label();
3200
} else btnDataPort->hide();
3202
if (progStatus.UIsize == small_ui)
3203
sldrMICGAIN->hide();
3205
sldrMICGAIN->deactivate();
3208
if (selrig->has_power_control) {
3209
double min, max, step;
3210
if (progStatus.use_rig_data)
3211
progStatus.power_level = selrig->get_power_control();
3213
selrig->set_power_control(progStatus.power_level);
3214
selrig->get_pc_min_max_step(min, max, step);
3215
sldrPOWER->minimum(min);
3216
sldrPOWER->maximum(max);
3217
sldrPOWER->step(step);
3218
sldrPOWER->value(progStatus.power_level);
3219
sldrPOWER->redraw();
3220
if (progStatus.UIsize == small_ui)
3223
sldrPOWER->activate();
3225
if (progStatus.UIsize == small_ui)
3228
sldrPOWER->deactivate();
3230
set_power_controlImage(progStatus.power_level);
3232
if (selrig->has_attenuator_control) {
3233
if (progStatus.use_rig_data)
3234
progStatus.attenuator = selrig->get_attenuator();
3236
selrig->set_attenuator(progStatus.attenuator);
3237
if (progStatus.UIsize == small_ui)
3238
btnAttenuator->show();
3240
btnAttenuator->activate();
3242
if (progStatus.UIsize == small_ui)
3243
btnAttenuator->hide();
3245
btnAttenuator->deactivate();
3248
// hijack the preamp control for a SPOT button on the TT550 Pegasus
3249
if (rig_nbr == TT550) {
3250
btnPreamp->label("Spot");
3251
btnPreamp->value(progStatus.tt550_spot_onoff);
3252
if (progStatus.UIsize == small_ui)
3255
btnPreamp->activate();
3257
if (selrig->has_preamp_control) {
3258
if (progStatus.use_rig_data)
3259
progStatus.preamp = selrig->get_preamp();
3261
selrig->set_preamp(progStatus.preamp);
3262
if (progStatus.UIsize == small_ui)
3265
btnPreamp->activate();
3267
if (progStatus.UIsize == small_ui)
3270
btnPreamp->deactivate();
3274
if (selrig->has_noise_control) {
3275
if (rig_nbr == TS990) {
3276
btnNOISE->label("AGC"); //Set TS990 AGC Label
3277
btnNR->label("NR1"); //Set TS990 NR Button
3279
if (progStatus.use_rig_data)
3280
progStatus.noise = selrig->get_noise();
3282
selrig->set_noise(progStatus.noise);
3283
btnNOISE->value(progStatus.noise);
3284
if (progStatus.UIsize == small_ui)
3287
btnNOISE->activate();
3290
if (progStatus.UIsize == small_ui)
3293
btnNOISE->deactivate();
3296
if (selrig->has_tune_control) {
3297
if (progStatus.UIsize == small_ui)
3300
btnTune->activate();
3302
if (progStatus.UIsize == small_ui)
3305
btnTune->deactivate();
3308
if (selrig->has_ptt_control ||
3309
progStatus.comm_dtrptt || progStatus.comm_rtsptt ||
3310
progStatus.sep_dtrptt || progStatus.sep_rtsptt) {
3313
btnPTT->deactivate();
3316
if (selrig->has_auto_notch) {
3318
if (rig_nbr == RAY152) {
3319
btnAutoNotch->label("AGC");
3320
btnAutoNotch->tooltip("AGC on/off");
3321
} else if (rig_nbr == FT1000MP) {
3322
btnAutoNotch->label("Tuner");
3323
btnAutoNotch->tooltip("Tuner on/off");
3325
btnAutoNotch->label("AN");
3326
btnAutoNotch->tooltip("Auto notch on/off");
3328
if (progStatus.use_rig_data)
3329
progStatus.auto_notch = selrig->get_auto_notch();
3331
selrig->set_auto_notch(progStatus.auto_notch);
3332
btnAutoNotch->value(progStatus.auto_notch);
3333
if (progStatus.UIsize == small_ui)
3334
btnAutoNotch->show();
3336
btnAutoNotch->activate();
3338
if (progStatus.UIsize == small_ui)
3339
btnAutoNotch->hide();
3341
btnAutoNotch->deactivate();
3344
if (selrig->has_swr_control)
3345
btnALC_SWR->activate();
3347
btnALC_SWR->deactivate();
3350
if (selrig->has_compON || selrig->has_compression)
3351
selrig->set_compression();
3353
adjust_control_positions();
3360
snprintf(hexstr, sizeof(hexstr), "0x%2X", selrig->CIV);
3361
txtCIV->value(hexstr);
3363
btnCIVdefault->activate();
3364
if (strstr(selrig->name_, "IC-7200") || strstr(selrig->name_, "IC-7600")) {
3365
btnUSBaudio->value(progStatus.USBaudio = true);
3366
btnUSBaudio->activate();
3368
btnUSBaudio->deactivate();
3371
txtCIV->deactivate();
3372
btnCIVdefault->deactivate();
3373
btnUSBaudio->value(false);
3374
btnUSBaudio->deactivate();
3377
if (rig_nbr != TT550) {
3378
vfoA.freq = progStatus.freq_A;
3379
vfoA.imode = progStatus.imode_A;
3380
vfoA.iBW = progStatus.iBW_A;
3382
if (vfoA.iBW == -1) vfoA.iBW = selrig->def_bandwidth(vfoA.imode);
3383
FreqDispA->value( vfoA.freq );
3385
vfoB.freq = progStatus.freq_B;
3386
vfoB.imode = progStatus.imode_B;
3387
vfoB.iBW = progStatus.iBW_B;
3389
if (vfoB.iBW == -1) vfoB.iBW = selrig->def_bandwidth(vfoB.imode);
3390
FreqDispB->value(vfoB.freq);
3393
selrig->set_vfoB(vfoB.freq);
3394
selrig->set_modeB(vfoB.imode);
3395
selrig->set_bwB(vfoB.iBW);
3398
selrig->set_vfoA(vfoA.freq);
3399
selrig->set_modeA(vfoA.imode);
3400
selrig->set_bwA(vfoA.iBW);
3403
updateBandwidthControl();
3406
highlight_vfo((void *)0);
3410
// enable buttons, change labels
3412
if (rig_nbr == TS990) { // Setup TS990 Mon Button
3413
btnIFsh->label("MON");
3415
selrig->post_initialize();
3417
// enable the serial thread
3419
pthread_mutex_unlock(&mutex_serial);
3421
fldigi_online = false;
3424
// initialize fldigi
3428
send_new_freq(vfoA.freq);
3429
send_new_mode(vfoA.imode);
3431
send_new_bandwidth(vfoA.iBW & 0x7F);
3435
pthread_mutex_unlock(&mutex_xmlrpc);
3437
if (rig_nbr == K3) {
3440
btn_K3_swapAB->show();
3442
btn_K3_swapAB->hide();
3449
bypass_serial_thread_loop = false;
3453
bypass_serial_thread_loop = true;
3454
pthread_mutex_unlock(&mutex_serial);
3455
pthread_mutex_unlock(&mutex_xmlrpc);
3456
btnInitializing->hide();
3457
fl_alert2(_("Transceiver not responding"));
3465
title.append(selrig->name_);
3466
mainwindow->label(title.c_str());
3469
void initConfigDialog()
3471
int picked = selectRig->index();
3472
rigbase *srig = rigs[picked];
3473
selectCommPort->index(0);
3475
progStatus.loadXcvrState(selrig->name_);
3477
selectCommPort->value(progStatus.xcvr_serial_port.c_str());
3478
btnOneStopBit->value( progStatus.stopbits == 1 );
3479
btnTwoStopBit->value( progStatus.stopbits == 2 );
3481
mnuBaudrate->index( srig->comm_baudrate );
3482
btnOneStopBit->value( srig->stopbits == 1 );
3483
btnTwoStopBit->value( srig->stopbits == 2 );
3484
cntRigCatRetries->value( srig->comm_retries );
3485
cntRigCatTimeout->value( srig->comm_timeout );
3486
cntRigCatWait->value( srig->comm_wait );
3487
btnRigCatEcho->value( srig->comm_echo );
3488
btncatptt->value( srig->comm_catptt );
3489
btnrtsptt->value( srig->comm_rtsptt );
3490
btndtrptt->value( srig->comm_dtrptt );
3491
chkrtscts->value( srig->comm_rtscts );
3492
btnrtsplus->value( srig->comm_rtsplus );
3493
btndtrplus->value( srig->comm_dtrplus );
3495
if (picked >= IC703 && picked <= IC910H) {
3497
snprintf(hexstr, sizeof(hexstr), "0x%2X", srig->CIV);
3498
txtCIV->value(hexstr);
3500
btnCIVdefault->activate();
3501
if (picked == IC7200 || picked == IC7600) {
3502
btnUSBaudio->value(progStatus.USBaudio = true);
3503
btnUSBaudio->activate();
3505
btnUSBaudio->deactivate();
3508
txtCIV->deactivate();
3509
btnCIVdefault->deactivate();
3510
btnUSBaudio->value(false);
3511
btnUSBaudio->deactivate();
3515
void initStatusConfigDialog()
3517
rig_nbr = progStatus.rig_nbr;
3518
selrig = rigs[rig_nbr];
3520
if (rig_nbr >= IC703 && rig_nbr <= IC910H)
3521
if (progStatus.CIV) selrig->adjustCIV(progStatus.CIV);
3523
selectRig->index(rig_nbr);
3524
mnuBaudrate->index( progStatus.comm_baudrate );
3526
selectCommPort->value( progStatus.xcvr_serial_port.c_str() );
3527
selectAuxPort->value( progStatus.aux_serial_port.c_str() );
3528
selectSepPTTPort->value( progStatus.sep_serial_port.c_str() );
3529
btnOneStopBit->value( progStatus.stopbits == 1 );
3530
btnTwoStopBit->value( progStatus.stopbits == 2 );
3532
cntRigCatRetries->value( progStatus.comm_retries );
3533
cntRigCatTimeout->value( progStatus.comm_timeout );
3534
cntRigCatWait->value( progStatus.comm_wait );
3535
btnRigCatEcho->value( progStatus.comm_echo );
3537
btncatptt->value( progStatus.comm_catptt );
3538
btnrtsptt->value( progStatus.comm_rtsptt );
3539
btndtrptt->value( progStatus.comm_dtrptt );
3540
chkrtscts->value( progStatus.comm_rtscts );
3541
btnrtsplus->value( progStatus.comm_rtsplus );
3542
btndtrplus->value( progStatus.comm_dtrplus );
3544
btnSepDTRplus->value(progStatus.sep_dtrplus);
3545
btnSepDTRptt->value(progStatus.sep_dtrptt);
3546
btnSepRTSplus->value(progStatus.sep_rtsplus);
3547
btnSepRTSptt->value(progStatus.sep_rtsptt);
3551
if (!startXcvrSerial()) {
3552
if (progStatus.xcvr_serial_port.compare("NONE") == 0) {
3553
LOG_WARN("No comm port ... test mode");
3555
LOG_WARN("%s cannot be accessed", progStatus.xcvr_serial_port.c_str());
3556
progStatus.xcvr_serial_port = "NONE";
3557
selectCommPort->value(progStatus.xcvr_serial_port.c_str());
3559
box_xcvr_connect->color(FL_BACKGROUND2_COLOR);
3560
box_xcvr_connect->redraw();
3562
selectCommPort->value(progStatus.xcvr_serial_port.c_str());
3563
box_xcvr_connect->color(FL_GREEN);
3564
box_xcvr_connect->redraw();
3566
if (!startAuxSerial()) {
3567
if (progStatus.aux_serial_port.compare("NONE") != 0) {
3568
LOG_WARN("%s cannot be accessed", progStatus.aux_serial_port.c_str());
3569
progStatus.aux_serial_port = "NONE";
3570
selectAuxPort->value(progStatus.aux_serial_port.c_str());
3573
if (!startSepSerial()) {
3574
if (progStatus.sep_serial_port.compare("NONE") != 0) {
3575
LOG_WARN("%s cannot be accessed", progStatus.sep_serial_port.c_str());
3576
progStatus.sep_serial_port = "NONE";
3577
selectSepPTTPort->value(progStatus.sep_serial_port.c_str());
3589
while (rigs[i] != NULL)
3590
selectRig->add(rigs[i++]->name_);
3592
selectRig->index(rig_nbr = 0);
3595
void nr_label(const char *l, bool on = false)
3597
btnNR->value(on ? 1 : 0);
3599
btnNR->redraw_label();
3602
void nb_label(const char * l, bool on = false)
3604
btnNOISE->value(on ? 1 : 0);
3606
btnNOISE->redraw_label();
3609
void preamp_label(const char * l, bool on = false)
3611
btnPreamp->value(on ? 1 : 0);
3612
btnPreamp->label(l);
3613
btnPreamp->redraw_label();
3616
void atten_label(const char * l, bool on = false)
3618
btnAttenuator->value(on ? 1 : 0);
3619
btnAttenuator->label(l);
3620
btnAttenuator->redraw_label();
3623
void auto_notch_label(const char * l, bool on = false)
3625
btnAutoNotch->value(on ? 1 : 0);
3626
btnAutoNotch->label(l);
3627
btnAutoNotch->redraw_label();
3632
AuxSerial.setRTS(progStatus.aux_rts);
3633
AuxSerial.setDTR(progStatus.aux_dtr);
3638
pthread_mutex_lock(&mutex_serial);
3639
selrig->set_agc_level();
3640
pthread_mutex_unlock(&mutex_serial);
3645
pthread_mutex_lock(&mutex_serial);
3646
selrig->set_cw_wpm();
3647
pthread_mutex_unlock(&mutex_serial);
3652
// pthread_mutex_lock(&mutex_serial);
3653
// selrig->set_cw_vol();
3654
// pthread_mutex_unlock(&mutex_serial);
3660
pthread_mutex_lock(&mutex_serial);
3661
ret = selrig->set_cw_spot();
3662
pthread_mutex_unlock(&mutex_serial);
3663
if (!ret) btnSpot->value(0);
3666
void cb_cw_spot_tone()
3668
pthread_mutex_lock(&mutex_serial);
3669
selrig->set_cw_spot_tone();
3670
pthread_mutex_unlock(&mutex_serial);
3676
pthread_mutex_lock(&mutex_serial);
3677
selrig->set_vox_gain();
3678
pthread_mutex_unlock(&mutex_serial);
3683
pthread_mutex_lock(&mutex_serial);
3684
selrig->set_vox_anti();
3685
pthread_mutex_unlock(&mutex_serial);
3690
pthread_mutex_lock(&mutex_serial);
3691
selrig->set_vox_hang();
3692
pthread_mutex_unlock(&mutex_serial);
3697
pthread_mutex_lock(&mutex_serial);
3698
selrig->set_vox_onoff();
3699
pthread_mutex_unlock(&mutex_serial);
3702
void cb_vox_on_dataport()
3704
pthread_mutex_lock(&mutex_serial);
3705
selrig->set_vox_on_dataport();
3706
pthread_mutex_unlock(&mutex_serial);
3709
void cb_compression()
3711
pthread_mutex_lock(&mutex_serial);
3712
selrig->set_compression();
3713
pthread_mutex_unlock(&mutex_serial);
3716
void cb_auto_notch()
3718
progStatus.auto_notch = btnAutoNotch->value();
3719
pthread_mutex_lock(&mutex_serial);
3720
selrig->set_auto_notch(progStatus.auto_notch);
3721
pthread_mutex_unlock(&mutex_serial);
3726
pthread_mutex_lock(&mutex_serial);
3727
selrig->setVfoAdj(progStatus.vfo_adj);
3728
pthread_mutex_unlock(&mutex_serial);
3735
void cb_bpf_center()
3737
pthread_mutex_lock(&mutex_serial);
3738
selrig->set_if_shift(selrig->pbt);
3739
pthread_mutex_unlock(&mutex_serial);
3744
pthread_mutex_lock(&mutex_serial);
3745
selrig->set_special(btnSpecial->value());
3746
pthread_mutex_unlock(&mutex_serial);
3751
pthread_mutex_lock(&mutex_serial);
3752
progStatus.nb_level = cbo_nb_level->index();
3753
selrig->set_nb_level();
3754
pthread_mutex_unlock(&mutex_serial);
3759
pthread_mutex_lock(&mutex_serial);
3760
selrig->set_cw_spot();
3761
pthread_mutex_unlock(&mutex_serial);
3764
void cb_enable_keyer()
3766
pthread_mutex_lock(&mutex_serial);
3767
selrig->enable_keyer();
3768
pthread_mutex_unlock(&mutex_serial);
3773
pthread_mutex_lock(&mutex_serial);
3774
selrig->set_cw_weight();
3775
pthread_mutex_unlock(&mutex_serial);
3780
pthread_mutex_lock(&mutex_serial);
3781
selrig->set_cw_qsk();
3782
pthread_mutex_unlock(&mutex_serial);
3785
void cbBandSelect(int band)
3788
pthread_mutex_lock(&mutex_serial);
3789
bypass_serial_thread_loop = true;
3790
pthread_mutex_unlock(&mutex_serial);
3792
pthread_mutex_lock(&mutex_serial);
3793
pthread_mutex_lock(&mutex_xmlrpc);
3794
selrig->set_band_selection(band);
3795
MilliSleep(100); // rig sync-up
3798
vfoA.freq = selrig->get_vfoA();
3799
if (selrig->has_mode_control)
3800
vfoA.imode = selrig->get_modeA();
3801
if (selrig->has_bandwidth_control) {
3802
selrig->adjust_bandwidth(vfoA.imode);
3803
vfoA.iBW = selrig->get_bwA();
3807
vfoB.freq = selrig->get_vfoB();
3808
if (selrig->has_mode_control)
3809
vfoB.imode = selrig->get_modeB();
3810
if (selrig->has_bandwidth_control) {
3811
selrig->adjust_bandwidth(vfoB.imode);
3812
vfoB.iBW = selrig->get_bwB();
3816
// local display freqmdbw
3817
if (selrig->has_mode_control)
3818
Fl::awake(setModeControl);
3819
if (selrig->has_bandwidth_control) {
3820
set_bandwidth_control();
3821
Fl::awake(setBWControl);
3823
if (!useB) Fl::awake(setFreqDispA, (void *)vfo.freq);
3824
else Fl::awake(setFreqDispB, (void *)vfo.freq);
3826
MilliSleep(100); // local sync-up
3827
// remote send freqmdbw
3828
if (fldigi_online) {
3829
send_xml_freq(vfo.freq);
3830
if (selrig->has_mode_control) {
3832
send_new_mode(vfo.imode);
3836
if (selrig->has_bandwidth_control) {
3839
send_new_bandwidth(vfo.iBW & 0x7F);
3842
MilliSleep(100); // remote sync-up
3845
pthread_mutex_unlock(&mutex_xmlrpc);
3846
pthread_mutex_unlock(&mutex_serial);
3849
pthread_mutex_lock(&mutex_serial);
3850
bypass_serial_thread_loop = false;
3851
pthread_mutex_unlock(&mutex_serial);
3854
void enable_bandselect_btn(int btn_num, bool enable)
3861
if (enable) btnBandSelect_10->show();
3862
else btnBandSelect_10->hide();
3865
if (enable) btnBandSelect_11->show();
3866
else btnBandSelect_11->hide();
3869
if (enable) opSelect60->show();
3870
else opSelect60->hide();
3877
// trim leading and trailing whitspace and double quote
3878
const string lt_trim(const string& pString, const string& pWhitespace)
3880
size_t beginStr, endStr, range;
3881
beginStr = pString.find_first_not_of(pWhitespace);
3882
if (beginStr == string::npos) return ""; // no content
3883
endStr = pString.find_last_not_of(pWhitespace);
3884
range = endStr - beginStr + 1;
3886
return pString.substr(beginStr, range);
3893
if (FreqSelect->value() < 1) {
3894
inAlphaTag->value("");
3895
return; // no memory selected
3897
indx = FreqSelect->value() - 1;
3898
atag = inAlphaTag->value();
3899
// delete leading, trailing spaces
3900
atag = lt_trim(atag);
3901
memset(oplist[indx].alpha_tag, 0, ATAGSIZE);
3902
snprintf(oplist[indx].alpha_tag, ATAGSIZE, "%s", atag.c_str());
3903
// update browser list
3905
FreqSelect->value(indx + 1);
3906
inAlphaTag->value(oplist[indx].alpha_tag);