Skip to content

Commit

Permalink
- corrected TX panadapter frequency markers and band edges
Browse files Browse the repository at this point in the history
- corrected analog RF output watt meter
- OC menu TX labels corrected
- put all ALC stuff in one column in the meter menu
- corrected HERMESlite rxgain setting in P1
  • Loading branch information
dl1ycf committed Feb 27, 2020
1 parent 31c160b commit 7c07e79
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 20 deletions.
15 changes: 4 additions & 11 deletions hpsdrsim.c
Original file line number Diff line number Diff line change
Expand Up @@ -1056,17 +1056,10 @@ void process_ep2(uint8_t *frame)
// Some firmware/emulators use bit6 to indicate a 6-bit format
// for a combined attenuator/preamplifier with the AD9866 chip.
// The value is between 0 and 60 and formally correspondes to
// to an RX gain of -12 to +48 dB. However the front-end hardware
// determines which is the correct "zero level", that is, the gain
// which corresponds to full-amplitude IQ samples for a 0 dBm input.
// Experimentally, we set this "zero level" to +13 dB that (that is,
// a RxGain value of 25). So the "attenuation" is (25 -G) where G
// is the RXgain value.
// NOTE: according to the AD9866 data sheet, this "calibration value"
// should be 22 instead of 25, while a value of 31 is used
// by the HermesLite firmware when bit6 is not set.
//
chk_data(25 -(frame[4] & 0x3F) , rx_att[0], "RX1 HL ATT/GAIN");
// to an RX gain of -12 to +48 dB. However, we set here that
// a value of +16 (that is, 28 on the 0-60 scale) corresponds to
// "zero attenuation"
chk_data(40 -(frame[4] & 0x3F) , rx_att[0], "RX1 HL ATT/GAIN");
} else {
chk_data((frame[4] & 0x1F) >> 0, rx_att[0], "RX1 ATT");
chk_data((frame[4] & 0x20) >> 5, rx1_attE, "RX1 ATT enable");
Expand Down
2 changes: 1 addition & 1 deletion meter.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ if(analog_meter) {
max_count++;

//angle=(max_level/2.0)+offset;
angle=(max_level*10.0*interval)+offset;
angle=(max_level*10.0/(double)interval)+offset;
radians=angle*M_PI/180.0;
cairo_arc(cr, cx, cy, radius+8, radians, radians);
cairo_line_to(cr, cx, cy);
Expand Down
1 change: 1 addition & 0 deletions meter_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ void meter_menu (GtkWidget *parent) {
row++;
col=0;

col++;
GtkWidget *alc_gain=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(alc_peak),"ALC Gain");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (alc_gain), alc==TXA_ALC_GAIN);
gtk_widget_show(alc_gain);
Expand Down
3 changes: 2 additions & 1 deletion oc_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ void oc_menu(GtkWidget *parent) {
//gtk_widget_override_font(oc_rx_title, pango_font_description_from_string("Arial 18"));
gtk_widget_show(oc_rx_title);
gtk_grid_attach(GTK_GRID(grid),oc_rx_title,i,2,1,1);
GtkWidget *oc_tx_title=gtk_label_new(oc_id);
GtkWidget *oc_tx_title=gtk_label_new(NULL);
gtk_label_set_markup(GTK_LABEL(oc_tx_title), oc_id);
//gtk_widget_override_font(oc_tx_title, pango_font_description_from_string("Arial 18"));
gtk_widget_show(oc_tx_title);
gtk_grid_attach(GTK_GRID(grid),oc_tx_title,i+7,2,1,1);
Expand Down
8 changes: 3 additions & 5 deletions old_protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -1395,12 +1395,10 @@ if(last_power!=power) {
if (have_rx_gain) {
//
// HERMESlite has a RXgain value in the range 0-60 that
// is stored in gx_gain_slider. The firmware uses bit 6
// of C4 to determine this case. However RadioBerry seems
// to behave differently and stores bit5 of the gain in the
// dither bit (see above) and a 5-bit attenuation value here.
// is stored in rx_gain_slider. The firmware uses bit 6
// of C4 to determine this case.
//
int rxgain = - adc_attenuation[active_receiver->adc]+12; // -12..48 to 0..60
int rxgain = adc_attenuation[active_receiver->adc]+12; // -12..48 to 0..60
if (rxgain < 0) rxgain=0;
if (rxgain > 60) rxgain=60;
// encode all 6 bits of RXgain in ATT value and set bit6
Expand Down
4 changes: 2 additions & 2 deletions tx_panadapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ void tx_panadapter_update(TRANSMITTER *tx) {
}

// plot frequency markers
long long half=6000LL; //(long long)(tx->output_rate/2);
long long half= duplex ? 3000LL : 12000LL; //(long long)(tx->output_rate/2);
long long frequency;
if(vfo[txvfo].ctun) {
frequency=vfo[txvfo].ctun_frequency;
Expand All @@ -262,7 +262,7 @@ void tx_panadapter_update(TRANSMITTER *tx) {
#ifdef TX_FREQ_MARKERS
cairo_text_extents_t extents;
long long f;
long long divisor=50000;
long long divisor=2000;
for(i=0;i<display_width;i++) {
f = frequency - half + (long) (hz_per_pixel * i);
if (f > 0) {
Expand Down

0 comments on commit 7c07e79

Please sign in to comment.