-
Notifications
You must be signed in to change notification settings - Fork 45
/
radio_dialog.c
1294 lines (1113 loc) · 52.1 KB
/
radio_dialog.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* Copyright (C)
* 2018 - John Melton, G0ORX/N6LYT
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#include <gtk/gtk.h>
#include <string.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "bpsk.h"
#include "receiver.h"
#include "transmitter.h"
#include "wideband.h"
#include "discovered.h"
#include "adc.h"
#include "dac.h"
#include "radio.h"
#include "main.h"
#include "protocol1.h"
#include "protocol2.h"
#ifdef SOAPYSDR
#include "soapy_protocol.h"
#endif
#include "audio.h"
#include "receiver_dialog.h"
//#include "rigctl.h"
#ifdef CWDAEMON
#include "cwdaemon.h"
#endif
static GtkWidget *filter_board_combo_box;
static GtkWidget *adc0_frame;
static GtkWidget *adc0_antenna_combo_box;
static GtkWidget *adc0_filters_combo_box;
static GtkWidget *adc0_hpf_combo_box;
static GtkWidget *adc0_lpf_combo_box;
static GtkWidget *duplex_b;
static GtkWidget *sat_combo;
static GtkWidget *mute_rx_b;
static GtkWidget *dither_b;
static GtkWidget *random_b;
static GtkWidget *preamp_b;
static GtkWidget *attenuation_label;
static GtkWidget *attenuation_b;
static GtkWidget *enable_attenuation_b;
static GtkWidget *disable_fpgaclk_b;
static GtkWidget *swr_alarm_b;
static GtkWidget *temperature_alarm_b;
static GtkWidget *adc1_frame;
static GtkWidget *adc1_antenna_combo_box;
static GtkWidget *adc1_filters_combo_box;
static GtkWidget *adc1_hpf_combo_box;
static GtkWidget *cw_keyer_sidetone_frequency_b;
static GtkWidget *cw_keyer_speed_b;
static GtkWidget *cw_keyer_weight_b;
static GtkWidget *cw_keyer_sidetone_level_b;
//static GtkWidget *rigctl_base;
#ifdef SOAPYSDR
static GtkWidget *dac0_frame;
static GtkWidget *dac0_antenna_combo_box;
#endif
#ifdef CWDAEMON
static GtkWidget *cwport;
#endif
static GtkWidget *audio_backend_combo_box;
/* TO REMOVE
static gboolean close_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
RADIO *radio=(RADIO *)data;
radio->dialog=NULL;
return TRUE;
}
static gboolean delete_event(GtkWidget *widget, GdkEvent *event, gpointer data) {
RADIO *radio=(RADIO *)data;
radio->dialog=NULL;
return FALSE;
}
*/
static void radio_dialog_update_controls() {
g_print("%s: model=%d\n",__FUNCTION__,radio->model);
switch(radio->model) {
case ANAN_10:
case ANAN_10E:
case ANAN_100:
case ANAN_100D:
case ANAN_200D:
radio->filter_board=ALEX;
break;
case ANAN_7000DLE:
case ANAN_8000DLE:
radio->filter_board=ALEX;
break;
case HERMES_LITE_2:
radio->filter_board=N2ADR;
break;
case ATLAS:
case HERMES:
case HERMES_2:
case ANGELIA:
case ORION_1:
case ORION_2:
#ifdef SOAPYSDR
case SOAPY_DEVICE:
#endif
radio->filter_board=NONE;
break;
}
switch(radio->model) {
case ANAN_7000DLE:
case ANAN_8000DLE:
gtk_widget_set_sensitive(adc0_antenna_combo_box, TRUE);
gtk_widget_set_sensitive(adc0_filters_combo_box, TRUE);
if(radio->adc[0].filters==AUTOMATIC) {
gtk_widget_set_sensitive(adc0_lpf_combo_box, FALSE);
gtk_widget_set_sensitive(adc0_hpf_combo_box, FALSE);
} else {
gtk_widget_set_sensitive(adc0_hpf_combo_box, TRUE);
gtk_widget_set_sensitive(adc0_lpf_combo_box, TRUE);
}
gtk_widget_set_sensitive(adc1_antenna_combo_box, TRUE);
gtk_widget_set_sensitive(adc1_filters_combo_box, TRUE);
if(radio->adc[1].filters==AUTOMATIC) {
gtk_widget_set_sensitive(adc1_hpf_combo_box, FALSE);
} else {
gtk_widget_set_sensitive(adc1_hpf_combo_box, TRUE);
}
break;
case ANAN_100:
case ANAN_100D:
case ANAN_200D:
gtk_widget_set_sensitive(adc0_antenna_combo_box, TRUE);
gtk_widget_set_sensitive(adc0_filters_combo_box, TRUE);
if(radio->adc[0].filters==AUTOMATIC) {
gtk_widget_set_sensitive(adc0_lpf_combo_box, FALSE);
gtk_widget_set_sensitive(adc0_hpf_combo_box, FALSE);
} else {
gtk_widget_set_sensitive(adc0_hpf_combo_box, TRUE);
gtk_widget_set_sensitive(adc0_lpf_combo_box, TRUE);
}
gtk_widget_set_sensitive(adc1_antenna_combo_box, FALSE);
gtk_widget_set_sensitive(adc1_filters_combo_box, FALSE);
gtk_widget_set_sensitive(adc0_lpf_combo_box, FALSE);
gtk_widget_set_sensitive(adc0_hpf_combo_box, FALSE);
break;
case HERMES_LITE:
case HERMES_LITE_2:
break;
#ifdef SOAPYSDR
case SOAPY_DEVICE:
break;
#endif
default:
g_print("%s: defualt set_sensitive\n",__FUNCTION__);
gtk_widget_set_sensitive(adc0_antenna_combo_box, FALSE);
gtk_widget_set_sensitive(adc0_filters_combo_box, FALSE);
gtk_widget_set_sensitive(adc0_hpf_combo_box, FALSE);
gtk_widget_set_sensitive(adc0_lpf_combo_box, FALSE);
gtk_widget_set_sensitive(adc1_antenna_combo_box, FALSE);
gtk_widget_set_sensitive(adc1_filters_combo_box, FALSE);
gtk_widget_set_sensitive(adc1_hpf_combo_box, FALSE);
break;
}
#ifdef SOAPYSDR
if(radio->discovered->device!=DEVICE_SOAPYSDR) {
#endif
gtk_combo_box_set_active(GTK_COMBO_BOX(filter_board_combo_box),radio->filter_board);
#ifdef SOAPYSDR
}
#endif
}
static void model_cb(GtkComboBox *widget,gpointer data) {
RADIO *radio=(RADIO *)data;
radio->model=gtk_combo_box_get_active(widget);
radio_dialog_update_controls();
}
static void sample_rate_cb(GtkComboBoxText *widget,gpointer data) {
RADIO *radio=(RADIO *)data;
int rate;
int i;
rate=atoi(gtk_combo_box_text_get_active_text(widget));
switch(radio->discovered->protocol) {
case PROTOCOL_1:
protocol1_stop();
break;
case PROTOCOL_2:
break;
#ifdef SOAPYSDR
case PROTOCOL_SOAPYSDR:
//soapy_protocol_stop();
break;
#endif
}
radio->sample_rate=rate;
for(i=0;i<radio->discovered->supported_receivers;i++) {
if(radio->receiver[i]!=NULL) {
receiver_change_sample_rate(radio->receiver[i],rate);
}
}
switch(radio->discovered->protocol) {
case PROTOCOL_1:
protocol1_set_mic_sample_rate(rate);
break;
case PROTOCOL_2:
break;
#ifdef SOAPYSDR
case PROTOCOL_SOAPYSDR:
break;
#endif
}
g_idle_add(radio_restart,(void *)radio);
}
static void filter_board_cb(GtkComboBox *widget,gpointer data) {
RADIO *radio=(RADIO *)data;
radio->filter_board=gtk_combo_box_get_active(widget);
if(radio->discovered->protocol==PROTOCOL_2) {
protocol2_high_priority();
}
}
static void adc0_antenna_cb(GtkComboBox *widget,gpointer data) {
RADIO *radio=(RADIO *)data;
radio->adc[0].antenna=gtk_combo_box_get_active(widget);
if(radio->discovered->protocol==PROTOCOL_2) {
protocol2_high_priority();
#ifdef SOAPYSDR
} else if(radio->discovered->protocol==PROTOCOL_SOAPYSDR) {
soapy_protocol_set_rx_antenna(radio->receiver[0],radio->adc[0].antenna);
#endif
}
}
static void adc1_antenna_cb(GtkComboBox *widget,gpointer data) {
RADIO *radio=(RADIO *)data;
radio->adc[1].antenna=gtk_combo_box_get_active(widget);
if(radio->discovered->protocol==PROTOCOL_2) {
protocol2_high_priority();
}
}
#ifdef SOAPYSDR
static void dac0_antenna_cb(GtkComboBox *widget,gpointer data) {
RADIO *radio=(RADIO *)data;
radio->dac[0].antenna=gtk_combo_box_get_active(widget);
if(radio->discovered->protocol==PROTOCOL_2) {
protocol2_high_priority();
} else if(radio->discovered->protocol==PROTOCOL_SOAPYSDR) {
soapy_protocol_set_tx_antenna(radio->transmitter,radio->dac[0].antenna);
}
}
#endif
static void adc0_filters_cb(GtkComboBox *widget,gpointer data) {
RADIO *radio=(RADIO *)data;
radio->adc[0].filters=gtk_combo_box_get_active(widget);
if(radio->adc[0].filters==MANUAL) {
gtk_widget_set_sensitive(adc0_hpf_combo_box, TRUE);
gtk_widget_set_sensitive(adc0_lpf_combo_box, TRUE);
} else {
gtk_widget_set_sensitive(adc0_hpf_combo_box, FALSE);
gtk_widget_set_sensitive(adc0_lpf_combo_box, FALSE);
}
if(radio->discovered->protocol==PROTOCOL_2) {
protocol2_high_priority();
}
}
static void adc0_hpf_cb(GtkComboBox *widget,gpointer data) {
RADIO *radio=(RADIO *)data;
radio->adc[0].hpf=gtk_combo_box_get_active(widget);
if(radio->discovered->protocol==PROTOCOL_2) {
protocol2_high_priority();
}
}
static void adc0_lpf_cb(GtkComboBox *widget,gpointer data) {
RADIO *radio=(RADIO *)data;
radio->adc[0].lpf=gtk_combo_box_get_active(widget);
if(radio->discovered->protocol==PROTOCOL_2) {
protocol2_high_priority();
}
}
static void adc1_filters_cb(GtkComboBox *widget,gpointer data) {
RADIO *radio=(RADIO *)data;
radio->adc[1].filters=gtk_combo_box_get_active(widget);
if(radio->adc[1].filters==MANUAL) {
gtk_widget_set_sensitive(adc1_hpf_combo_box, TRUE);
} else {
gtk_widget_set_sensitive(adc1_hpf_combo_box, FALSE);
}
if(radio->discovered->protocol==PROTOCOL_2) {
protocol2_high_priority();
}
}
static void adc1_hpf_cb(GtkComboBox *widget,gpointer data) {
RADIO *radio=(RADIO *)data;
radio->adc[1].hpf=gtk_combo_box_get_active(widget);
if(radio->discovered->protocol==PROTOCOL_2) {
protocol2_high_priority();
}
}
static void ptt_cb(GtkWidget *widget, gpointer data) {
RADIO *radio=(RADIO *)data;
radio->mic_ptt_enabled=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
}
static void ptt_ring_cb(GtkWidget *widget, gpointer data) {
RADIO *radio=(RADIO *)data;
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
radio->mic_ptt_tip_bias_ring=0;
}
}
static void ptt_tip_cb(GtkWidget *widget, gpointer data) {
RADIO *radio=(RADIO *)data;
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
radio->mic_ptt_tip_bias_ring=1;
}
}
static void bias_cb(GtkWidget *widget, gpointer data) {
RADIO *radio=(RADIO *)data;
radio->mic_bias_enabled=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
}
static void boost_cb(GtkWidget *widget, gpointer data) {
RADIO *radio=(RADIO *)data;
radio->mic_boost=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
}
static void update_audio_backends(RADIO *radio) {
int i;
gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(audio_backend_combo_box));
if(radio->which_audio==USE_SOUNDIO) {
for(i=0;i<audio_get_backends(radio);i++) {
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(audio_backend_combo_box),NULL,audio_get_backend_name(i));
}
}
if(radio->which_audio_backend>=0) {
radio_change_audio_backend(radio,radio->which_audio_backend);
}
}
static void audio_cb(GtkWidget *widget, gpointer data) {
RADIO *radio=(RADIO *)data;
int selected=gtk_combo_box_get_active (GTK_COMBO_BOX(widget));
g_print("radio_dialog: audio_cb: selected=%d\n",selected);
radio_change_audio(radio,selected);
update_audio_backends(radio);
}
static void audio_backend_cb(GtkWidget *widget, gpointer data) {
RADIO *radio=(RADIO *)data;
int selected=gtk_combo_box_get_active (GTK_COMBO_BOX(widget));
g_print("radio_dialog: audio_backend_cb: selected=%d\n",selected);
radio_change_audio_backend(radio,selected);
}
static void smeter_calibrate_changed_cb(GtkWidget *widget, gpointer data) {
RADIO *radio=(RADIO *)data;
radio->meter_calibration=gtk_range_get_value(GTK_RANGE(widget));
}
static void panadapter_calibrate_changed_cb(GtkWidget *widget, gpointer data) {
RADIO *radio=(RADIO *)data;
radio->panadapter_calibration=gtk_range_get_value(GTK_RANGE(widget));
}
static void swr_alarm_changed_cb(GtkWidget *widget, gpointer data) {
RADIO *radio=(RADIO *)data;
radio->swr_alarm_value=gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget));
}
static void temperature_alarm_changed_cb(GtkWidget *widget, gpointer data) {
RADIO *radio=(RADIO *)data;
radio->temperature_alarm_value=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
}
static void cw_keyer_speed_value_changed_cb(GtkWidget *widget, gpointer data) {
RADIO *radio=(RADIO *)data;
radio->cw_keyer_speed=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
}
static void cw_breakin_cb(GtkWidget *widget, gpointer data) {
RADIO *radio=(RADIO *)data;
radio->cw_breakin=radio->cw_breakin==1?0:1;
}
static void cw_keyer_hang_time_value_changed_cb(GtkWidget *widget, gpointer data) {
RADIO *radio=(RADIO *)data;
radio->cw_keyer_hang_time=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
}
static void cw_keyer_weight_value_changed_cb(GtkWidget *widget, gpointer data) {
RADIO *radio=(RADIO *)data;
radio->cw_keyer_weight=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
}
static void cw_keys_reversed_cb(GtkWidget *widget, gpointer data) {
RADIO *radio=(RADIO *)data;
radio->cw_keys_reversed=radio->cw_keys_reversed==1?0:1;
}
static void cw_keyer_cb(GtkComboBox *widget,gpointer data) {
RADIO *radio=(RADIO *)data;
radio->cw_keyer_mode=gtk_combo_box_get_active(widget);
}
static void cw_keyer_sidetone_level_value_changed_cb(GtkWidget *widget, gpointer data) {
RADIO *radio=(RADIO *)data;
radio->cw_keyer_sidetone_volume=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
}
static void cw_keyer_sidetone_frequency_value_changed_cb(GtkWidget *widget, gpointer data) {
RADIO *radio=(RADIO *)data;
int i;
radio->cw_keyer_sidetone_frequency=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
for(i=0;i<radio->discovered->supported_receivers;i++) {
if(radio->receiver[i]!=NULL) {
receiver_filter_changed(radio->receiver[i],radio->receiver[i]->filter_a);
}
}
}
static void psu_clk_cb(GtkWidget *widget, gpointer data) {
RADIO *radio=(RADIO *)data;
radio->psu_clk=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
}
static void region_cb(GtkWidget *widget, gpointer data) {
radio->region=gtk_combo_box_get_active (GTK_COMBO_BOX(widget));
radio_change_region(radio);
}
static void dither_cb(GtkWidget *widget, gpointer data) {
ADC *adc=(ADC *)data;
adc->dither=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
}
static void random_cb(GtkWidget *widget, gpointer data) {
ADC *adc=(ADC *)data;
adc->random=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
}
static void preamp_cb(GtkWidget *widget, gpointer data) {
ADC *adc=(ADC *)data;
adc->preamp=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
}
#ifdef SOAPYSDR
static void adc_gain_value_changed_cb(GtkWidget *widget, gpointer data) {
ADC *adc=(ADC *)data;
adc->gain=gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget));
if(radio->discovered->device==DEVICE_SOAPYSDR) {
soapy_protocol_set_gain(adc);
}
}
static void agc_changed_cb(GtkWidget *widget, gpointer data) {
ADC *adc=(ADC *)data;
gboolean agc=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
soapy_protocol_set_automatic_gain(radio->receiver[0],agc);
}
static void dac0_gain_value_changed_cb(GtkWidget *widget, gpointer data) {
DAC *dac=(DAC *)data;
if(radio->discovered->protocol==PROTOCOL_SOAPYSDR) {
dac->gain=gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget));
soapy_protocol_set_tx_gain(dac);
}
}
#endif
static void iqswap_changed_cb(GtkWidget *widget, gpointer data) {
RADIO *r=(RADIO *)data;
r->iqswap=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
}
static void enablepa_changed_cb(GtkWidget *widget, gpointer data) {
RADIO *r=(RADIO *)data;
r->enable_pa=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
}
static void attenuation_value_changed_cb(GtkWidget *widget, gpointer data) {
ADC *adc=(ADC *)data;
adc->attenuation=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
if(radio->discovered->protocol==PROTOCOL_2) {
protocol2_high_priority();
}
}
static void enable_step_attenuation_cb(GtkWidget *widget,gpointer data) {
ADC *adc=(ADC *)data;
adc->enable_step_attenuation=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
if(radio->discovered->protocol==PROTOCOL_2) {
protocol2_high_priority();
}
}
static void penelope_changed_cb(GtkWidget *widget, gpointer data) {
RADIO *r=(RADIO *)data;
r->penelope=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
}
/*
static void rigctl_cb(GtkWidget *widget, gpointer data) {
int i;
rigctl_enable=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
if(rigctl_enable) {
for(i=0;i<radio->discovered->supported_receivers;i++) {
if(radio->receiver[i]!=NULL) {
launch_rigctl(radio->receiver[i]);
}
}
gtk_widget_set_sensitive(rigctl_base, FALSE);
} else {
for(i=0;i<radio->discovered->supported_receivers;i++) {
if(radio->receiver[i]!=NULL) {
close_rigctl_ports(radio->receiver[i]);
}
}
gtk_widget_set_sensitive(rigctl_base, TRUE);
}
}
static void rigctl_debug_cb(GtkWidget *widget, gpointer data) {
rigctl_debug=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
}
static void rigctl_value_changed_cb(GtkWidget *widget, gpointer data) {
rigctl_port_base=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
}
*/
#ifdef CWDAEMON
static GThread *cwdaemon_thread_id;
static void cwdaemon_cb(GtkWidget *widget, gpointer data) {
RADIO *radio=(RADIO *)data;
radio->cwdaemon=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
printf("CWdaemon %d\n", radio->cwdaemon);
if(radio->cwdaemon) {
printf("Starting CWdaemon\n");
cwdaemon_thread_id = g_thread_new("cwdaemon thread...", cwdaemon_thread, (gpointer)radio);
if(!cwdaemon_thread_id)
{
fprintf(stderr,"g_thread_new failed on cwdaemon_thread\n");
exit(-1);
}
fprintf(stderr, "cwdaemon_thread: id=%p\n",cwdaemon_thread_id);
// CWdaemon now has control over keyer settings, user can't modify
gtk_widget_set_sensitive(cw_keyer_speed_b, FALSE);
gtk_widget_set_sensitive(cw_keyer_sidetone_frequency_b, FALSE);
gtk_widget_set_sensitive(cw_keyer_weight_b, FALSE);
gtk_widget_set_sensitive(cw_keyer_sidetone_level_b, FALSE);
gtk_widget_set_sensitive(cwport, FALSE);
}
else {
//printf("Stopping CWdaemon\n");
cwdaemon_stop();
gtk_widget_set_sensitive(cw_keyer_speed_b, TRUE);
gtk_widget_set_sensitive(cw_keyer_sidetone_frequency_b, TRUE);
gtk_widget_set_sensitive(cw_keyer_weight_b, TRUE);
gtk_widget_set_sensitive(cw_keyer_sidetone_level_b, TRUE);
gtk_widget_set_sensitive(cwport, TRUE);
//g_thread_exit(cwdaemon_thread_id);
}
}
static void cwport_value_changed_cb(GtkWidget *widget, gpointer data) {
RADIO *radio=(RADIO *)data;
radio->cwd_port = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
}
#endif
GtkWidget *create_radio_dialog(RADIO *radio) {
g_print("%s\n",__FUNCTION__);
GtkWidget *grid=gtk_grid_new();
gtk_grid_set_row_homogeneous(GTK_GRID(grid),FALSE);
gtk_grid_set_column_homogeneous(GTK_GRID(grid),FALSE);
gtk_grid_set_column_spacing(GTK_GRID(grid),5);
int row=0;
int col=0;
GtkWidget *model_frame=gtk_frame_new("Radio Model");
GtkWidget *model_grid=gtk_grid_new();
gtk_grid_set_row_homogeneous(GTK_GRID(model_grid),TRUE);
gtk_grid_set_column_homogeneous(GTK_GRID(model_grid),TRUE);
gtk_container_add(GTK_CONTAINER(model_frame),model_grid);
gtk_grid_attach(GTK_GRID(grid),model_frame,col,row++,1,1);
int x=0;
int y=0;
GtkWidget *model_combo_box=gtk_combo_box_text_new();
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(model_combo_box),NULL,"ANAN_10");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(model_combo_box),NULL,"ANAN_10E");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(model_combo_box),NULL,"ANAN_100");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(model_combo_box),NULL,"ANAN_100D");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(model_combo_box),NULL,"ANAN_200D");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(model_combo_box),NULL,"ANAN_7000DLE");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(model_combo_box),NULL,"ANAN_8000DLE");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(model_combo_box),NULL,"ATLAS");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(model_combo_box),NULL,"HERMES");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(model_combo_box),NULL,"HERMES 2");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(model_combo_box),NULL,"ANGELIA");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(model_combo_box),NULL,"ORION");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(model_combo_box),NULL,"ORION 2");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(model_combo_box),NULL,"HERMES LITE");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(model_combo_box),NULL,"HERMES LITE 2");
#ifdef SOAPYSDR
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(model_combo_box),NULL,"SoapySDR");
#endif
gtk_combo_box_set_active(GTK_COMBO_BOX(model_combo_box),radio->model);
g_signal_connect(model_combo_box,"changed",G_CALLBACK(model_cb),radio);
gtk_grid_attach(GTK_GRID(model_grid),model_combo_box,x,0,1,1);
x++;
if ((radio->discovered->device == DEVICE_HERMES_LITE2) || (radio->discovered->device == DEVICE_HERMES_LITE)) {
GtkWidget *paswap=gtk_check_button_new_with_label("Enable PA");
gtk_grid_attach(GTK_GRID(model_grid),paswap,x,0,1,1);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(paswap),radio->enable_pa);
g_signal_connect(paswap,"toggled",G_CALLBACK(enablepa_changed_cb),radio);
}
#ifdef SOAPYSDR
else if(radio->discovered->device!=DEVICE_SOAPYSDR) {
GtkWidget *iqswap=gtk_check_button_new_with_label("Swap I & Q");
gtk_grid_attach(GTK_GRID(model_grid),iqswap,x,0,1,1);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(iqswap),radio->iqswap);
g_signal_connect(iqswap,"toggled",G_CALLBACK(iqswap_changed_cb),radio);
}
#endif
else if(radio->discovered->device==DEVICE_METIS) {
GtkWidget *penelope=gtk_check_button_new_with_label("Penelope");
gtk_grid_attach(GTK_GRID(model_grid),penelope,x,0,1,1);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(penelope),radio->penelope);
g_signal_connect(penelope,"toggled",G_CALLBACK(penelope_changed_cb),radio);
}
x++;
#ifdef SOAPYSDR
if(radio->discovered->device!=DEVICE_SOAPYSDR) {
#endif
filter_board_combo_box=gtk_combo_box_text_new();
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(filter_board_combo_box),NULL,"NONE");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(filter_board_combo_box),NULL,"ALEX FILTERS");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(filter_board_combo_box),NULL,"APOLLO FILTERS");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(filter_board_combo_box),NULL,"N2ADR FILTERS");
gtk_combo_box_set_active(GTK_COMBO_BOX(filter_board_combo_box),radio->filter_board);
g_signal_connect(filter_board_combo_box,"changed",G_CALLBACK(filter_board_cb),radio);
gtk_grid_attach(GTK_GRID(model_grid),filter_board_combo_box,x,0,1,1);
x++;
#ifdef SOAPYSDR
}
#endif
if(radio->discovered->protocol==PROTOCOL_1) {
GtkWidget *sample_rate_combo_box=gtk_combo_box_text_new();
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(sample_rate_combo_box),NULL,"48000");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(sample_rate_combo_box),NULL,"96000");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(sample_rate_combo_box),NULL,"192000");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(sample_rate_combo_box),NULL,"384000");
switch(radio->sample_rate) {
case 48000:
gtk_combo_box_set_active(GTK_COMBO_BOX(sample_rate_combo_box),0);
break;
case 96000:
gtk_combo_box_set_active(GTK_COMBO_BOX(sample_rate_combo_box),1);
break;
case 192000:
gtk_combo_box_set_active(GTK_COMBO_BOX(sample_rate_combo_box),2);
break;
case 384000:
gtk_combo_box_set_active(GTK_COMBO_BOX(sample_rate_combo_box),3);
break;
}
g_signal_connect(sample_rate_combo_box,"changed",G_CALLBACK(sample_rate_cb),radio);
gtk_grid_attach(GTK_GRID(model_grid),sample_rate_combo_box,x,0,1,1);
}
#ifdef SOAPYSDR
if(radio->discovered->device==DEVICE_SOAPYSDR &&
strcmp(radio->discovered->name,"sdrplay")==0) {
GtkWidget *sample_rate_combo_box=gtk_combo_box_text_new();
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(sample_rate_combo_box),NULL,"96000");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(sample_rate_combo_box),NULL,"192000");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(sample_rate_combo_box),NULL,"384000");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(sample_rate_combo_box),NULL,"768000");
switch(radio->sample_rate) {
case 96000:
gtk_combo_box_set_active(GTK_COMBO_BOX(sample_rate_combo_box),0);
break;
case 192000:
gtk_combo_box_set_active(GTK_COMBO_BOX(sample_rate_combo_box),1);
break;
case 384000:
gtk_combo_box_set_active(GTK_COMBO_BOX(sample_rate_combo_box),2);
break;
case 768000:
gtk_combo_box_set_active(GTK_COMBO_BOX(sample_rate_combo_box),3);
break;
}
g_signal_connect(sample_rate_combo_box,"changed",G_CALLBACK(sample_rate_cb),radio);
gtk_grid_attach(GTK_GRID(model_grid),sample_rate_combo_box,x,0,1,1);
}
#endif
adc0_frame=gtk_frame_new("ADC-0");
GtkWidget *adc0_grid=gtk_grid_new();
gtk_grid_set_row_homogeneous(GTK_GRID(adc0_grid),TRUE);
gtk_grid_set_column_homogeneous(GTK_GRID(adc0_grid),TRUE);
gtk_container_add(GTK_CONTAINER(adc0_frame),adc0_grid);
gtk_grid_attach(GTK_GRID(grid),adc0_frame,col,row++,1,1);
switch(radio->discovered->device) {
#ifdef SOAPYSDR
case DEVICE_SOAPYSDR:
{
GtkWidget *antenna_label=gtk_label_new("Antenna:");
gtk_grid_attach(GTK_GRID(adc0_grid),antenna_label,0,0,1,1);
adc0_antenna_combo_box=gtk_combo_box_text_new();
for(int i=0;i<radio->discovered->info.soapy.rx_antennas;i++) {
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(adc0_antenna_combo_box),NULL,radio->discovered->info.soapy.rx_antenna[i]);
}
gtk_combo_box_set_active(GTK_COMBO_BOX(adc0_antenna_combo_box),radio->adc[0].antenna);
g_signal_connect(adc0_antenna_combo_box,"changed",G_CALLBACK(adc0_antenna_cb),radio);
gtk_grid_attach(GTK_GRID(adc0_grid),adc0_antenna_combo_box,1,0,1,1);
GtkWidget *adc_gain_label=gtk_label_new(NULL);
gtk_label_set_markup(GTK_LABEL(adc_gain_label), "<b>Gain</b>");
gtk_grid_attach(GTK_GRID(adc0_grid),adc_gain_label,0,1,1,1);
double max=100;
if(strcmp(radio->discovered->name,"lime")==0) {
max=60.0;
} else if(strcmp(radio->discovered->name,"plutosdr")==0) {
max=73.0;
}
GtkWidget *adc_gain_b=gtk_spin_button_new_with_range(0.0,max,1.0);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(adc_gain_b),radio->adc[0].gain);
gtk_grid_attach(GTK_GRID(adc0_grid),adc_gain_b,1,1,1,1);
g_signal_connect(adc_gain_b,"value_changed",G_CALLBACK(adc_gain_value_changed_cb),&radio->adc[0]);
if(radio->discovered->info.soapy.rx_has_automatic_gain) {
GtkWidget *agc=gtk_check_button_new_with_label("Hardware AGC: ");
gtk_grid_attach(GTK_GRID(adc0_grid),agc,1,2,1,1);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(agc),radio->adc[0].agc);
g_signal_connect(agc,"toggled",G_CALLBACK(agc_changed_cb),&radio->adc[0]);
}
}
break;
#endif
case DEVICE_HERMES_LITE2:
attenuation_label=gtk_label_new("LNA gain (dB):");
gtk_grid_attach(GTK_GRID(adc0_grid),attenuation_label,0,0,1,1);
attenuation_b=gtk_spin_button_new_with_range(-12.0,48.0,1.0);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(attenuation_b),(double)radio->adc[0].attenuation);
gtk_grid_attach(GTK_GRID(adc0_grid),attenuation_b,2,0,1,1);
g_signal_connect(attenuation_b,"value_changed",G_CALLBACK(attenuation_value_changed_cb),&radio->adc[0]);
disable_fpgaclk_b=gtk_check_button_new_with_label("FPGA PSU clock");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (disable_fpgaclk_b), radio->psu_clk);
gtk_grid_attach(GTK_GRID(adc0_grid),disable_fpgaclk_b,0,1,1,1);
g_signal_connect(disable_fpgaclk_b,"toggled",G_CALLBACK(psu_clk_cb),radio);
break;
case DEVICE_HERMES_LITE:
attenuation_label=gtk_label_new("LNA gain (dB):");
gtk_grid_attach(GTK_GRID(adc0_grid),attenuation_label,0,0,1,1);
attenuation_b=gtk_spin_button_new_with_range(-12.0,48.0,1.0);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(attenuation_b),(double)radio->adc[0].attenuation);
gtk_grid_attach(GTK_GRID(adc0_grid),attenuation_b,2,0,1,1);
g_signal_connect(attenuation_b,"value_changed",G_CALLBACK(attenuation_value_changed_cb),&radio->adc[0]);
enable_attenuation_b=gtk_check_button_new_with_label("Enable 20dB Attenuation");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (enable_attenuation_b), radio->adc[0].dither);
gtk_grid_attach(GTK_GRID(adc0_grid),enable_attenuation_b,0,1,1,1);
//g_signal_connect(enable_attenuation_b,"toggled",G_CALLBACK(enable_step_attenuation_cb),&radio->adc[0]);
g_signal_connect(enable_attenuation_b,"toggled",G_CALLBACK(dither_cb),&radio->adc[0]);
break;
default:
adc0_antenna_combo_box=gtk_combo_box_text_new();
// Row 1
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(adc0_antenna_combo_box),NULL,"ANT_1");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(adc0_antenna_combo_box),NULL,"ANT_2");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(adc0_antenna_combo_box),NULL,"ANT_3");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(adc0_antenna_combo_box),NULL,"XVTR");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(adc0_antenna_combo_box),NULL,"EXT1");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(adc0_antenna_combo_box),NULL,"EXT2");
gtk_combo_box_set_active(GTK_COMBO_BOX(adc0_antenna_combo_box),radio->adc[0].antenna);
g_signal_connect(adc0_antenna_combo_box,"changed",G_CALLBACK(adc0_antenna_cb),radio);
gtk_grid_attach(GTK_GRID(adc0_grid),adc0_antenna_combo_box,0,0,1,1);
adc0_filters_combo_box=gtk_combo_box_text_new();
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(adc0_filters_combo_box),NULL,"Automatic");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(adc0_filters_combo_box),NULL,"Manual");
gtk_combo_box_set_active(GTK_COMBO_BOX(adc0_filters_combo_box),radio->adc[0].filters);
g_signal_connect(adc0_filters_combo_box,"changed",G_CALLBACK(adc0_filters_cb),radio);
gtk_grid_attach(GTK_GRID(adc0_grid),adc0_filters_combo_box,1,0,1,1);
adc0_hpf_combo_box=gtk_combo_box_text_new();
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(adc0_hpf_combo_box),NULL,"BYPASS HPF");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(adc0_hpf_combo_box),NULL,"1.5 MHz HPF");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(adc0_hpf_combo_box),NULL,"6.5 MHZ HPF");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(adc0_hpf_combo_box),NULL,"9.5 MHz HPF");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(adc0_hpf_combo_box),NULL,"13 MHz HPF");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(adc0_hpf_combo_box),NULL,"20 MHz HPF");
gtk_combo_box_set_active(GTK_COMBO_BOX(adc0_hpf_combo_box),radio->adc[0].hpf);
g_signal_connect(adc0_hpf_combo_box,"changed",G_CALLBACK(adc0_hpf_cb),radio);
gtk_grid_attach(GTK_GRID(adc0_grid),adc0_hpf_combo_box,2,0,1,1);
adc0_lpf_combo_box=gtk_combo_box_text_new();
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(adc0_lpf_combo_box),NULL,"160m LPF");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(adc0_lpf_combo_box),NULL,"80m LPF");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(adc0_lpf_combo_box),NULL,"60/40m LPF");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(adc0_lpf_combo_box),NULL,"30/20m LPF");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(adc0_lpf_combo_box),NULL,"17/15m LPF");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(adc0_lpf_combo_box),NULL,"12/10m LPF");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(adc0_lpf_combo_box),NULL,"6m LPF");
gtk_combo_box_set_active(GTK_COMBO_BOX(adc0_lpf_combo_box),radio->adc[0].lpf);
g_signal_connect(adc0_lpf_combo_box,"changed",G_CALLBACK(adc0_lpf_cb),radio);
gtk_grid_attach(GTK_GRID(adc0_grid),adc0_lpf_combo_box,3,0,1,1);
// Row 2
dither_b=gtk_check_button_new_with_label("Dither");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dither_b), radio->adc[0].dither);
gtk_grid_attach(GTK_GRID(adc0_grid),dither_b,0,1,1,1);
g_signal_connect(dither_b,"toggled",G_CALLBACK(dither_cb),&radio->adc[0]);
random_b=gtk_check_button_new_with_label("Random");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (random_b), radio->adc[0].random);
gtk_grid_attach(GTK_GRID(adc0_grid),random_b,1,1,1,1);
g_signal_connect(random_b,"toggled",G_CALLBACK(random_cb),&radio->adc[0]);
preamp_b=gtk_check_button_new_with_label("Preamp");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (preamp_b), radio->adc[0].preamp);
gtk_grid_attach(GTK_GRID(adc0_grid),preamp_b,2,1,1,1);
g_signal_connect(preamp_b,"toggled",G_CALLBACK(preamp_cb),&radio->adc[0]);
attenuation_label=gtk_label_new("Attenuation (dB):");
gtk_grid_attach(GTK_GRID(adc0_grid),attenuation_label,3,1,1,1);
attenuation_b=gtk_spin_button_new_with_range(0.0,31.0,1.0);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(attenuation_b),(double)radio->adc[0].attenuation);
gtk_grid_attach(GTK_GRID(adc0_grid),attenuation_b,4,1,1,1);
g_signal_connect(attenuation_b,"value_changed",G_CALLBACK(attenuation_value_changed_cb),&radio->adc[0]);
break;
}
switch(radio->discovered->device) {
case DEVICE_HERMES2:
case DEVICE_ANGELIA:
case DEVICE_ORION:
case DEVICE_ORION2:
adc1_frame=gtk_frame_new("ADC-1");
GtkWidget *adc1_grid=gtk_grid_new();
gtk_grid_set_row_homogeneous(GTK_GRID(adc1_grid),TRUE);
gtk_grid_set_column_homogeneous(GTK_GRID(adc1_grid),TRUE);
gtk_container_add(GTK_CONTAINER(adc1_frame),adc1_grid);
gtk_grid_attach(GTK_GRID(grid),adc1_frame,col,row++,1,1);
adc1_antenna_combo_box=gtk_combo_box_text_new();
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(adc1_antenna_combo_box),NULL,"RX2");
gtk_combo_box_set_active(GTK_COMBO_BOX(adc1_antenna_combo_box),radio->adc[1].antenna);
g_signal_connect(adc1_antenna_combo_box,"changed",G_CALLBACK(adc1_antenna_cb),radio);
gtk_grid_attach(GTK_GRID(adc1_grid),adc1_antenna_combo_box,0,0,1,1);
adc1_filters_combo_box=gtk_combo_box_text_new();
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(adc1_filters_combo_box),NULL,"Automatic");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(adc1_filters_combo_box),NULL,"Manual");
gtk_combo_box_set_active(GTK_COMBO_BOX(adc1_filters_combo_box),radio->adc[1].filters);
g_signal_connect(adc1_filters_combo_box,"changed",G_CALLBACK(adc1_filters_cb),radio);
gtk_grid_attach(GTK_GRID(adc1_grid),adc1_filters_combo_box,1,0,1,1);
adc1_hpf_combo_box=gtk_combo_box_text_new();
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(adc1_hpf_combo_box),NULL,"BYPASS HPF");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(adc1_hpf_combo_box),NULL,"1.5 MHz HPF");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(adc1_hpf_combo_box),NULL,"6.5 MHZ HPF");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(adc1_hpf_combo_box),NULL,"9.5 MHz HPF");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(adc1_hpf_combo_box),NULL,"13 MHz HPF");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(adc1_hpf_combo_box),NULL,"20 MHz HPF");
gtk_combo_box_set_active(GTK_COMBO_BOX(adc1_hpf_combo_box),radio->adc[1].hpf);
g_signal_connect(adc1_hpf_combo_box,"changed",G_CALLBACK(adc1_hpf_cb),radio);
gtk_grid_attach(GTK_GRID(adc1_grid),adc1_hpf_combo_box,2,0,1,1);
dither_b=gtk_check_button_new_with_label("Dither");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dither_b), radio->adc[1].dither);
gtk_grid_attach(GTK_GRID(adc1_grid),dither_b,0,1,1,1);
g_signal_connect(dither_b,"toggled",G_CALLBACK(dither_cb),&radio->adc[1]);
random_b=gtk_check_button_new_with_label("Random");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (random_b), radio->adc[1].random);
gtk_grid_attach(GTK_GRID(adc1_grid),random_b,1,1,1,1);
g_signal_connect(random_b,"toggled",G_CALLBACK(random_cb),&radio->adc[1]);
preamp_b=gtk_check_button_new_with_label("Preamp");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (preamp_b), radio->adc[1].preamp);
gtk_grid_attach(GTK_GRID(adc1_grid),preamp_b,2,1,1,1);
g_signal_connect(preamp_b,"toggled",G_CALLBACK(preamp_cb),&radio->adc[1]);
attenuation_label=gtk_label_new("Attenuation (dB):");
gtk_grid_attach(GTK_GRID(adc1_grid),attenuation_label,3,1,1,1);
attenuation_b=gtk_spin_button_new_with_range(0.0,31.0,1.0);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(attenuation_b),(double)radio->adc[1].attenuation);
gtk_grid_attach(GTK_GRID(adc1_grid),attenuation_b,4,1,1,1);
g_signal_connect(attenuation_b,"value_changed",G_CALLBACK(attenuation_value_changed_cb),&radio->adc[1]);
break;
default:
break;
}
radio_dialog_update_controls();
switch(radio->discovered->device) {
#ifdef SOAPYSDR
case DEVICE_SOAPYSDR:
if(radio->can_transmit) {
int r=0;
dac0_frame=gtk_frame_new("DAC-0");
GtkWidget *dac0_grid=gtk_grid_new();
gtk_grid_set_row_homogeneous(GTK_GRID(dac0_grid),TRUE);
gtk_grid_set_column_homogeneous(GTK_GRID(dac0_grid),TRUE);
gtk_container_add(GTK_CONTAINER(dac0_frame),dac0_grid);
gtk_grid_attach(GTK_GRID(grid),dac0_frame,col,row++,1,1);
GtkWidget *antenna_label=gtk_label_new("Antenna:");
gtk_grid_attach(GTK_GRID(dac0_grid),antenna_label,0,r,1,1);
dac0_antenna_combo_box=gtk_combo_box_text_new();
for(int i=0;i<radio->discovered->info.soapy.tx_antennas;i++) {
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(dac0_antenna_combo_box),NULL,radio->discovered->info.soapy.tx_antenna[i]);
}
gtk_combo_box_set_active(GTK_COMBO_BOX(dac0_antenna_combo_box),radio->dac[0].antenna);
g_signal_connect(dac0_antenna_combo_box,"changed",G_CALLBACK(dac0_antenna_cb),radio);
gtk_grid_attach(GTK_GRID(dac0_grid),dac0_antenna_combo_box,1,r,1,1);
r++;
GtkWidget *gain_label=gtk_label_new("Gain");
gtk_grid_attach(GTK_GRID(dac0_grid),gain_label,0,r,1,1);
double max=100.0;
if(strcmp(radio->discovered->name,"lime")==0) {
max=64.0;