g_signal_connect(b_agc_gain,"pressed",G_CALLBACK(action_select_cb),(gpointer *)ENCODER_AGC_GAIN);
row++;
-
- b_attenuation=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(b_agc_gain),"Attenuation");
+#ifdef RADIOBERRY
+ b_attenuation=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(b_agc_gain),"RX GAIN");
+#else
+ b_attenuation=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(b_agc_gain),"Attenuation");
+#endif
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (b_attenuation), encoder_action==ENCODER_ATTENUATION);
gtk_widget_show(b_attenuation);
gtk_grid_attach(GTK_GRID(grid),b_attenuation,col,row,2,1);
#define SPEED_192K 0x02
#define SPEED_384K 0x03
-#define RECEIVED_SAMPLES 128
+#define RECEIVED_SAMPLES 64
static GThread *radioberry_thread_id;
static gpointer radioberry_thread(gpointer arg);
fprintf(stderr, "====================================================================\n");
fprintf(stderr, " Radioberry V2.0 beta 2.\n");
fprintf(stderr, "\n");
- fprintf(stderr, " PIHPSDR plugin version 11-5-2018 \n");
+ fprintf(stderr, " PIHPSDR plugin version 19-5-2018 \n");
fprintf(stderr, "\n");
fprintf(stderr, "\n");
fprintf(stderr, " Have fune Johan PA3GSB\n");
}
iqdata[0] = (sampleSpeed[0] & 0x03);
- iqdata[1] = (((active_receiver->random << 6) & 0x40) | ((active_receiver->dither <<5) & 0x20) | (radioberry_attenuation & 0x1F));
+ iqdata[1] = (((active_receiver->random << 6) & 0x40) | (~(radioberry_attenuation & 0x2F)));
iqdata[2] = ((rxFrequency >> 24) & 0xFF);
iqdata[3] = ((rxFrequency >> 16) & 0xFF);
iqdata[4] = ((rxFrequency >> 8) & 0xFF);
gtk_range_set_value (GTK_RANGE(attenuation_scale),(double)adc_attenuation[active_receiver->adc]);
char title[64];
+#ifdef RADIOBERRY
+ sprintf(title,"RX GAIN"/*,active_receiver->adc*/);
+#else
sprintf(title,"ATT (dB)"/*,active_receiver->adc*/);
+#endif
gtk_label_set_text(GTK_LABEL(attenuation_label),title);
sliders_update();
}
}
static void attenuation_value_changed_cb(GtkWidget *widget, gpointer data) {
+#ifdef RADIOBERRY
+ //redfined the att slider to a rx-gain slider.
+ //AD9866 contains a pga amplifier from -12 - 48 dB
+ //from -12 to 0; the rx-gain slider functions as an att slider
+ //from 0 - 48 db; the rx-gain slider functions as a gain slider with att = 0;
+ //att set to 20 for good power measurement.
+ int rx_gain = (int)gtk_range_get_value(GTK_RANGE(attenuation_scale));
+ if (rx_gain > 12) {
+ adc_attenuation[active_receiver->adc]= 20;
+ } else {
+ adc_attenuation[active_receiver->adc]= 20 + (12- rx_gain);
+ }
+ set_attenuation(rx_gain);
+#else
adc_attenuation[active_receiver->adc]=(int)gtk_range_get_value(GTK_RANGE(attenuation_scale));
set_attenuation(adc_attenuation[active_receiver->adc]);
+#endif
}
void set_attenuation_value(double value) {
}
if(scale_status==NONE) {
char title[64];
+#ifdef RADIOBERRY
+ sprintf(title,"RX GAIN - ADC-%d (dB)",active_receiver->adc);
+#else
sprintf(title,"Attenuation - ADC-%d (dB)",active_receiver->adc);
- scale_status=ATTENUATION;
+#endif
+ scale_status=ATTENUATION;
scale_dialog=gtk_dialog_new_with_buttons(title,GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL);
GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(scale_dialog));
attenuation_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,0.0, 31.0, 1.00);
g_signal_connect(G_OBJECT(agc_scale),"value_changed",G_CALLBACK(agcgain_value_changed_cb),NULL);
char title[64];
+#ifdef RADIOBERRY
+ sprintf(title,"RX-GAIN:"/*,active_receiver->adc*/);
+#else
sprintf(title,"ATT (dB)"/*,active_receiver->adc*/);
+#endif
attenuation_label=gtk_label_new(title);
gtk_widget_show(attenuation_label);
gtk_grid_attach(GTK_GRID(sliders),attenuation_label,6,0,1,1);
- attenuation_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,0.0, 31.0, 1.0);
+#ifdef RADIOBERRY
+ attenuation_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,0.0, 60.0, 1.0);
+#else
+ attenuation_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,0.0, 31.0, 1.0);
+#endif
gtk_range_set_value (GTK_RANGE(attenuation_scale),adc_attenuation[active_receiver->adc]);
gtk_widget_show(attenuation_scale);
gtk_grid_attach(GTK_GRID(sliders),attenuation_scale,7,0,2,1);