static void band_select_cb(GtkWidget *widget, gpointer data) { GtkWidget *label; int b=(int)data; BANDSTACK_ENTRY *entry; if(b==band_get_current()) { entry=bandstack_entry_next(); } else { BAND* band=band_set_current(b); entry=bandstack_entry_get_current(); gtk_widget_override_background_color(last_band, GTK_STATE_NORMAL, &white); last_band=widget; gtk_widget_override_background_color(last_band, GTK_STATE_NORMAL, &gray); } setMode(entry->mode); FILTER* band_filters=filters[entry->mode]; FILTER* band_filter=&band_filters[entry->filter]; setFilter(band_filter->low,band_filter->high); setFrequency(entry->frequencyA); BAND *band=band_get_current_band(); set_alex_rx_antenna(band->alexRxAntenna); set_alex_tx_antenna(band->alexTxAntenna); set_alex_attenuation(band->alexAttenuation); vfo_update(NULL); setFrequency(entry->frequencyA); }
static gboolean vfo_step_select_cb (GtkWidget *widget, gpointer data) { step=steps[(int)data]; vfo_update(NULL); }
void vfo_move_to(int hz) { if(!locked) { BANDSTACK_ENTRY* entry=bandstack_entry_get_current(); #ifdef LIMESDR if(protocol==LIMESDR_PROTOCOL) { setFrequency((entry->frequencyA+ddsOffset-hz)/step*step); } else { #endif if(ctun) { setFrequency((entry->frequencyA+hz)/step*step); } else { long f=(entry->frequencyA+ddsOffset+hz)/step*step; if(mode==modeCWL) { f+=cw_keyer_sidetone_frequency; } else if(mode==modeCWU) { f-=cw_keyer_sidetone_frequency; } setFrequency(f); } #ifdef LIMESDR } #endif vfo_update(NULL); } }
static void update_noise() { SetRXAANRRun(CHANNEL_RX0, nr); SetRXAEMNRRun(CHANNEL_RX0, nr2); SetRXAANFRun(CHANNEL_RX0, anf); SetRXASNBARun(CHANNEL_RX0, snb); vfo_update(NULL); }
static gboolean vfo_scroll_event_cb (GtkWidget *widget, GdkEventScroll *event, gpointer data) { int i; if(event->direction==GDK_SCROLL_UP) { i=1; } else { i=-1; } if(event->x>(my_width/2)) { if(event->x>((my_width/4)*3)) { // rit rit+=i; if(rit>10000) { rit=1000; } if(rit<-1000) { rit=-1000; } } else { // step } } else { // frequency } vfo_update(NULL); }
void vfo_step(int steps) { if(!locked) { BANDSTACK_ENTRY* entry=bandstack_entry_get_current(); //entry->frequencyA=entry->frequencyA+(steps*step); //setFrequency(entry->frequencyA); setFrequency(entry->frequencyA+(steps*step)); vfo_update(NULL); } }
void tune_cb(GtkWidget *widget, gpointer data) { if(getMox()==1) { setMox(0); } if(canTransmit() || tx_out_of_band) { setTune(getTune()==0?1:0); vfo_update(NULL); } }
static gboolean rit_timer_cb(gpointer data) { if((GtkWidget*)data==rit_plus_b) { rit++; } else { rit--; } if(rit>1000) rit=1000; if(rit<-1000) rit=-1000; vfo_update(NULL); return TRUE; }
static gboolean rit_step_pressed_event_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) { if(widget==rit_plus_b) { rit++; } else { rit--; } if(rit>1000) rit=1000; if(rit<-1000) rit=-1000; vfo_update(NULL); rit_timer=g_timeout_add(200,rit_timer_cb,widget); return TRUE; }
static int vfo_encoder_changed(void *data) { if(!locked) { int pos=*(int*)data; // VFO BANDSTACK_ENTRY* entry=bandstack_entry_get_current(); setFrequency(entry->frequencyA+ddsOffset+(pos*step)); vfo_update(NULL); } free(data); return 0; }
static void filter_select_cb(GtkWidget *widget, gpointer data) { int f=(int)data; BANDSTACK_ENTRY *entry; entry=bandstack_entry_get_current(); entry->filter=f; FILTER* band_filters=filters[entry->mode]; FILTER* band_filter=&band_filters[entry->filter]; setFilter(band_filter->low,band_filter->high); gtk_widget_override_background_color(last_filter, GTK_STATE_NORMAL, &white); last_filter=widget; gtk_widget_override_background_color(last_filter, GTK_STATE_NORMAL, &gray); vfo_update(NULL); }
void vfo_move_to(int hz) { if(!locked) { BANDSTACK_ENTRY* entry=bandstack_entry_get_current(); //entry->frequencyA=(entry->frequencyA+hz)/step*step; //setFrequency(entry->frequencyA); #ifdef LIMESDR if(protocol==LIMESDR_PROTOCOL) setFrequency((entry->frequencyA+ddsOffset-hz)/step*step); else #endif setFrequency((entry->frequencyA+ddsOffset+hz)/step*step); vfo_update(NULL); } }
static gboolean rit_pressed_event_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) { if(rit_enabled) { rit_enabled=FALSE; set_button_text_color(rit_b,"black"); rit=0; gtk_widget_set_sensitive(rit_plus_b,FALSE); gtk_widget_set_sensitive(rit_minus_b,FALSE); } else { rit_enabled=TRUE; set_button_text_color(rit_b,"red"); gtk_widget_set_sensitive(rit_plus_b,TRUE); gtk_widget_set_sensitive(rit_minus_b,TRUE); } vfo_update(NULL); }
static gboolean ctun_pressed_event_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) { ctun=ctun==1?0:1; if(ctun) { set_button_text_color(ctun_b,"red"); } else { set_button_text_color(ctun_b,"black"); if(ddsOffset!=0) { ddsOffset=0; wdsp_set_offset(ddsOffset); vfo_update(NULL); } } return TRUE; }
void sim_bandstack_cb(GtkWidget *widget, gpointer data) { BANDSTACK_ENTRY *entry; fprintf(stderr,"sim_bandstack_cb\n"); if(function) { entry=bandstack_entry_previous(); } else { entry=bandstack_entry_next(); } setFrequency(entry->frequencyA); setMode(entry->mode); FILTER* band_filters=filters[entry->mode]; FILTER* band_filter=&band_filters[entry->filter]; setFilter(band_filter->low,band_filter->high); vfo_update(NULL); }
void sim_agc_cb(GtkWidget *widget, gpointer data) { fprintf(stderr,"sim_agc_cb\n"); if(function) { agc--; if(agc<0) { agc=3; } } else { agc++; if(agc>=4) { agc=0; } } SetRXAAGCMode(CHANNEL_RX0, agc); vfo_update(NULL); }
void sim_band_cb(GtkWidget *widget, gpointer data) { BAND* band; BANDSTACK_ENTRY *entry; fprintf(stderr,"sim_band_cb\n"); int b=band_get_current(); if(function) { b--; if(b<0) { b=BANDS-1; } #ifdef LIMESDR if(protocol!=LIMESDR_PROTOCOL) { if(b==band3400) { b=band6; } } #endif } else { b++; if(b>=BANDS) { b=0; } #ifdef LIMESDR if(protocol!=LIMESDR_PROTOCOL) { if(b==band70) { b=bandGen; } } #endif } band=band_set_current(b); entry=bandstack_entry_get_current(); setFrequency(entry->frequencyA); setMode(entry->mode); FILTER* band_filters=filters[entry->mode]; FILTER* band_filter=&band_filters[entry->filter]; setFilter(band_filter->low,band_filter->high); band=band_get_current_band(); set_alex_rx_antenna(band->alexRxAntenna); set_alex_tx_antenna(band->alexTxAntenna); set_alex_attenuation(band->alexAttenuation); vfo_update(NULL); }
void sim_noise_cb(GtkWidget *widget, gpointer data) { fprintf(stderr,"sim_noise_cb\n"); if(function) { if(nr) { nr=0; } else if(nr2) { nr2=0; nr=1; } else if(anf) { anf=0; nr2=1; } else if(snb) { snb=0; anf=1; } else { snb=1; } } else { if(nr) { nr=0; nr2=1; } else if(nr2) { nr2=0; anf=1; } else if(anf) { anf=0; snb=1; } else if(snb) { snb=0; } else { nr=1; } } SetRXAANRRun(CHANNEL_RX0, nr); SetRXAEMNRRun(CHANNEL_RX0, nr2); SetRXAANFRun(CHANNEL_RX0, anf); SetRXASNBARun(CHANNEL_RX0, snb); vfo_update(NULL); }
void lock_cb(GtkWidget *widget, gpointer data) { locked=locked==1?0:1; vfo_update(NULL); }
void sim_function_cb(GtkWidget *widget, gpointer data) { fprintf(stderr,"sim_function_cb\n"); function=function==1?0:1; update_toolbar(); vfo_update(NULL); }