//fprintf(stderr,"Create transmitter\n");
if(can_transmit) {
- transmitter=create_transmitter(CHANNEL_TX, buffer_size, fft_size, updates_per_second, display_width/2, tx_height/2);
+ transmitter=create_transmitter(CHANNEL_TX, buffer_size, fft_size, updates_per_second, display_width/3, PANADAPTER_HEIGHT);
transmitter->x=0;
transmitter->y=VFO_HEIGHT;
if (event->button == 1) {
if(has_moved) {
// drag
- vfo_move((long long)((float)(x-last_x)*rx->hz_per_pixel));
+ vfo_move((long long)((float)(x-last_x)*rx->hz_per_pixel),TRUE);
} else {
// move to this frequency
vfo_move_to((long long)((float)x*rx->hz_per_pixel));
//if(state & GDK_BUTTON1_MASK) {
//int moved=last_x-x;
int moved=x-last_x;
- vfo_move((long long)((float)moved*rx->hz_per_pixel));
+ vfo_move((long long)((float)moved*rx->hz_per_pixel),FALSE);
last_x=x;
has_moved=TRUE;
//}
gboolean receiver_scroll_event(GtkWidget *widget, GdkEventScroll *event, gpointer data) {
if(event->direction==GDK_SCROLL_UP) {
- vfo_move(step);
+ vfo_move(step,TRUE);
} else {
- vfo_move(-step);
+ vfo_move(-step,TRUE);
}
return TRUE;
}
}
void reconfigure_transmitter(TRANSMITTER *tx,int height) {
+g_print("reconfigure_transmitter: width=%d height=%d\n",tx->width,height);
gtk_widget_set_size_request(tx->panadapter, tx->width, height);
}
}
}
- meter_update(active_receiver,POWER,transmitter->fwd,transmitter->rev,transmitter->exciter,transmitter->alc);
+ if(!duplex) {
+ meter_update(active_receiver,POWER,transmitter->fwd,transmitter->rev,transmitter->exciter,transmitter->alc);
+ }
return TRUE; // keep going
}
static void create_visual(TRANSMITTER *tx) {
- fprintf(stderr,"transmitter: create_visual: id=%d\n",tx->id);
+ fprintf(stderr,"transmitter: create_visual: id=%d width=%d height=%d\n",tx->id, tx->width,tx->height);
tx->panel=gtk_fixed_new();
gtk_widget_set_size_request (tx->panel, tx->width, tx->height);
void tx_set_mode(TRANSMITTER* tx,int mode) {
if(tx!=NULL) {
tx->mode=mode;
+g_print("tx_set_mode: %s\n",mode_string[tx->mode]);
SetTXAMode(tx->id, tx->mode);
tx_set_filter(tx,tx_filter_low,tx_filter_high);
}
if (event->button == 1) {
if(has_moved) {
// drag
- vfo_move((long long)((float)(x-last_x)*hz_per_pixel));
+ vfo_move((long long)((float)(x-last_x)*hz_per_pixel),TRUE);
} else {
// move to this frequency
vfo_move_to((long long)((float)(x-(display_width/2))*hz_per_pixel));
&state);
if(state & GDK_BUTTON1_MASK) {
int moved=last_x-x;
- vfo_move((long long)((float)moved*hz_per_pixel));
+ vfo_move((long long)((float)moved*hz_per_pixel),FALSE);
last_x=x;
has_moved=TRUE;
}
gpointer data)
{
if(event->direction==GDK_SCROLL_UP) {
- vfo_move(step);
+ vfo_move(step,TRUE);
} else {
- vfo_move(-step);
+ vfo_move(-step,TRUE);
}
return FALSE;
}
}
#endif
+ if(duplex) {
+ char text[64];
+ cairo_set_source_rgb(cr,1.0,0.0,0.0);
+
+ sprintf(text,"FWD: %f",transmitter->fwd);
+ cairo_move_to(cr,10,display_height-40);
+ cairo_show_text(cr, text);
+
+ sprintf(text,"REV: %f",transmitter->rev);
+ cairo_move_to(cr,10,display_height-30);
+ cairo_show_text(cr, text);
+
+ sprintf(text,"ALC: %f",transmitter->alc);
+ cairo_move_to(cr,10,display_height-20);
+ cairo_show_text(cr, text);
+ }
+
cairo_destroy (cr);
gtk_widget_queue_draw (tx->panadapter);
void tx_panadapter_init(TRANSMITTER *tx, int width,int height) {
- int display_width=width;
- int display_height=height;
-
-fprintf(stderr,"tx_panadapter_init: %d x %d\n",display_width,display_height);
+fprintf(stderr,"tx_panadapter_init: %d x %d\n",width,height);
tx->panadapter_surface=NULL;
tx->panadapter=gtk_drawing_area_new ();
}
}
-void vfo_move(long long hz) {
+void vfo_move(long long hz,int round) {
int id=active_receiver->id;
g_print("vfo_move: id=%d hz=%lld\n",id,hz);
if(!locked) {
if(vfo[id].ctun) {
- vfo[id].ctun_frequency=((vfo[id].ctun_frequency+hz)/step)*step;
+ vfo[id].ctun_frequency=vfo[id].ctun_frequency+hz;
+ if(round) {
+ vfo[id].ctun_frequency=(vfo[id].ctun_frequency/step)*step;
+ }
} else {
- vfo[id].frequency=((vfo[id].frequency+hz)/step)*step;
+ vfo[id].frequency=vfo[id].frequency-hz;
+ if(round) {
+ vfo[id].frequency=(vfo[id].frequency/step)*step;
+ }
}
int sid=id==0?1:0;
switch(sat_mode) {
case SAT_MODE:
// A and B increment and decrement together
if(vfo[sid].ctun) {
- vfo[sid].ctun_frequency=((vfo[sid].ctun_frequency+hz)/step)*step;
+ vfo[sid].ctun_frequency=vfo[sid].ctun_frequency+hz;
+ if(round) {
+ vfo[sid].ctun_frequency=(vfo[sid].ctun_frequency/step)*step;
+ }
} else {
- vfo[sid].frequency=((vfo[sid].frequency+hz)/step)*step;
+ vfo[sid].frequency=vfo[sid].frequency-hz;
+ if(round) {
+ vfo[sid].frequency=(vfo[sid].frequency/step)*step;
+ }
}
break;
case RSAT_MODE:
// A increments and B decrements or A decrments and B increments
if(vfo[sid].ctun) {
vfo[sid].ctun_frequency=((vfo[sid].ctun_frequency-hz)/step)*step;
+ if(round) {
+ vfo[sid].ctun_frequency=(vfo[sid].ctun_frequency/step)*step;
+ }
} else {
- vfo[sid].frequency=((vfo[sid].frequency-hz)/step)*step;
+ vfo[sid].frequency=((vfo[sid].frequency+hz)/step)*step;
+ if(round) {
+ vfo[sid].ctun_frequency=(vfo[sid].ctun_frequency/step)*step;
+ }
}
break;
}
{
int i;
if(event->direction==GDK_SCROLL_UP) {
- vfo_move(step);
+ vfo_move(step,TRUE);
} else {
- vfo_move(-step);
+ vfo_move(-step,TRUE);
}
return FALSE;
}
cairo_show_text(cr, "Locked");
//cairo_move_to(cr, 55, 50);
- cairo_move_to(cr, 260, 15);
+ cairo_move_to(cr, 260, 18);
if(split) {
cairo_set_source_rgb(cr, 1.0, 0.0, 0.0);
} else {
cairo_show_text(cr, "Split");
//cairo_move_to(cr, 95, 50);
- cairo_move_to(cr, 260, 25);
+ cairo_move_to(cr, 260, 28);
if(sat_mode!=SAT_NONE) {
cairo_set_source_rgb(cr, 1.0, 0.0, 0.0);
} else {
}
sprintf(temp_text,"DUP");
//cairo_move_to(cr, 130, 50);
- cairo_move_to(cr, 260, 35);
+ cairo_move_to(cr, 260, 38);
cairo_set_font_size(cr, 12);
cairo_show_text(cr, temp_text);
extern GtkWidget* vfo_init(int width,int height,GtkWidget *parent);
extern void vfo_step(int steps);
-extern void vfo_move(long long hz);
+extern void vfo_move(long long hz,int round);
extern void vfo_move_to(long long hz);
extern void vfo_update();
extern void set_frequency();