Display Temperature and PA current for Hermes Lite 2.
// DL1YCF: "response" is global (used in new_protocol_programmer.c)
extern int response;
+/*
extern unsigned int exciter_power;
extern unsigned int alex_forward_power;
extern unsigned int alex_reverse_power;
+*/
/*
extern int send_high_priority;
} else {
strcpy(discovered[devices].name,"HermesLite V2");
discovered[devices].device = DEVICE_HERMES_LITE2;
+g_print("discovered HL2: Gateware Major Version=%d Minor Version=%d\n",buffer[9],buffer[15]);
}
discovered[devices].frequency_min=0.0;
discovered[devices].frequency_max=30720000.0;
g_idle_add(ext_mox_update,(gpointer)(long)(local_ptt));
}
-
switch((control_in[0]>>3)&0x1F) {
case 0:
adc_overload=control_in[1]&0x01;
// HL2 uses C1/C2 for measuring the temperature
//
exciter_power=((control_in[1]&0xFF)<<8)|(control_in[2]&0xFF); // from Penelope or Hermes
+ temperature=0;
} else {
exciter_power=0;
+ temperature+=((control_in[1]&0xFF)<<8)|(control_in[2]&0xFF); // HL2
+ n_temperature++;
+ if(n_temperature==10) {
+ average_temperature=temperature/10;
+ temperature=0;
+ n_temperature=0;
+ }
}
alex_forward_power=((control_in[3]&0xFF)<<8)|(control_in[4]&0xFF); // from Alex or Apollo
break;
case 2:
alex_reverse_power=((control_in[1]&0xFF)<<8)|(control_in[2]&0xFF); // from Alex or Apollo
- AIN3=(control_in[3]<<8)+control_in[4]; // from Pennelope or Hermes
+ if (device != DEVICE_HERMES_LITE2) {
+ AIN3=((control_in[3]&0xFF)<<8)|(control_in[4]&0xFF); // For Penelope or Hermes
+ current=0;
+ } else {
+ AIN3=0;
+ current+=((control_in[3]&0xFF)<<8)|(control_in[4]&0xFF); // HL2
+ n_current++;
+ if(n_current==10) {
+ average_current=current/10;
+ current=0;
+ n_current=0;
+ }
+ }
break;
case 3:
- AIN4=(control_in[1]<<8)+control_in[2]; // from Pennelope or Hermes
- AIN6=(control_in[3]<<8)+control_in[4]; // from Pennelope or Hermes
+ AIN4=((control_in[1]&0xFF)<<8)|(control_in[2]&0xFF); // For Penelope or Hermes
+ AIN6=((control_in[3]&0xFF)<<8)|(control_in[4]&0xFF); // For Penelope or Hermes
break;
}
int adc_overload;
int pll_locked;
unsigned int exciter_power;
+unsigned int temperature;
+unsigned int average_temperature;
+unsigned int n_temperature;
+unsigned int current;
+unsigned int average_current;
+unsigned int n_current;
unsigned int alex_forward_power;
unsigned int alex_reverse_power;
unsigned int AIN3;
display_toolbar=1;
#endif
+ temperature=0;
+ average_temperature=0;
+ n_temperature=0;
+ current=0;
+ average_current=0;
+ n_current=0;
+
radioRestoreState();
//
extern int adc_overload;
extern int pll_locked;
extern unsigned int exciter_power;
+extern unsigned int temperature;
+extern unsigned int average_temperature;
+extern unsigned int n_temperature;
+extern unsigned int current;
+extern unsigned int average_current;
+extern unsigned int n_current;
extern unsigned int alex_forward_power;
extern unsigned int alex_reverse_power;
extern unsigned int IO1;
rx->displaying=state;
if(state) {
if(rx->update_timer_id>=0) g_source_remove(rx->update_timer_id);
- rx->update_timer_id=g_timeout_add_full(G_PRIORITY_HIGH_IDLE,1000/rx->fps, update_display, rx, NULL);
+ rx->update_timer_id=gdk_threads_add_timeout_full(G_PRIORITY_HIGH_IDLE,1000/rx->fps, update_display, rx, NULL);
} else {
rx->update_timer_id=-1;
}
rx->id=id;
g_mutex_init(&rx->mutex);
g_mutex_init(&rx->display_mutex);
-fprintf(stderr,"create_receiver: g_mutex_init: %p\n",&rx->mutex);
switch(id) {
case 0:
rx->adc=0;
//
g_mutex_lock(&rx->mutex);
-fprintf(stderr,"receiver_change_sample_rate: g_mutex_lock: %p\n",&rx->mutex);
rx->sample_rate=sample_rate;
int scale=rx->sample_rate/48000;
init_analyzer(rx);
fprintf(stderr,"PS FEEDBACK change sample rate:id=%d rate=%d buffer_size=%d output_samples=%d\n",
rx->id, rx->sample_rate, rx->buffer_size, rx->output_samples);
-fprintf(stderr,"receiver_change_sample_rate: g_mutex_unlock: %p\n",&rx->mutex);
g_mutex_unlock(&rx->mutex);
return;
}
SetChannelState(rx->id,1,0);
-fprintf(stderr,"receiver_change_sample_rate: g_mutex_unlock: %p\n",&rx->mutex);
g_mutex_unlock(&rx->mutex);
fprintf(stderr,"receiver_change_sample_rate: id=%d rate=%d buffer_size=%d output_samples=%d\n",rx->id, rx->sample_rate, rx->buffer_size, rx->output_samples);
void full_rx_buffer(RECEIVER *rx) {
int error;
+ g_mutex_lock(&rx->mutex);
+
// noise blanker works on original IQ samples
if(rx->nb) {
xanbEXT (rx->id, rx->iq_input_buffer, rx->iq_input_buffer);
//g_print("full_rx_buffer: rx=%d buffer_size=%d samples=%d\n",rx->id,rx->buffer_size,rx->samples);
process_rx_buffer(rx);
+ g_mutex_unlock(&rx->mutex);
}
static int rx_buffer_seen=0;
rx->pixel_samples=g_new(float,rx->pixels);
rx->hz_per_pixel=(double)rx->sample_rate/(double)rx->pixels;
rx->zoom=(int)zoom;
- if(rx->zoom==1) {
+ if(zoom==1) {
rx->pan=0;
} else {
if(vfo[rx->id].ctun) {
rx->pan=(rx->pixels/2)-(rx->width/2);
}
}
+ rx->zoom=(int)zoom;
init_analyzer(rx);
}
int i;
int x1,x2;
float *samples;
+ char text[64];
cairo_text_extents_t extents;
gboolean active=active_receiver==rx;
cairo_stroke(cr);
#ifdef GPIO
- if(active && controller==CONTROLLER1) {
- char text[64];
+ if(rx->id==0 && controller==CONTROLLER1) {
cairo_set_source_rgb(cr,1.0,1.0,0.0);
cairo_set_font_size(cr,16);
if(ENABLE_E2_ENCODER) {
- cairo_move_to(cr, display_width-200,30);
+ cairo_move_to(cr, display_width-200,70);
sprintf(text,"%s (%s)",encoder_string[e2_encoder_action],sw_string[e2_sw_action]);
cairo_show_text(cr, text);
}
if(ENABLE_E3_ENCODER) {
- cairo_move_to(cr, display_width-200,50);
+ cairo_move_to(cr, display_width-200,90);
sprintf(text,"%s (%s)",encoder_string[e3_encoder_action],sw_string[e3_sw_action]);
cairo_show_text(cr, text);
}
if(ENABLE_E4_ENCODER) {
- cairo_move_to(cr, display_width-200,70);
+ cairo_move_to(cr, display_width-200,110);
sprintf(text,"%s (%s)",encoder_string[e4_encoder_action],sw_string[e4_sw_action]);
cairo_show_text(cr, text);
}
#endif
if(sequence_errors!=0) {
- cairo_move_to(cr,100,20);
+ cairo_move_to(cr,100.0,50.0);
cairo_set_source_rgb(cr,1.0,0.0,0.0);
cairo_set_font_size(cr,12);
cairo_show_text(cr, "Sequence Error");
sequence_error_count++;
- // show for 1 second
+ // show for 2 second
if(sequence_error_count==2*rx->fps) {
sequence_errors=0;
sequence_error_count=0;
}
}
- if(rx->fexchange_errors!=0) {
- cairo_move_to(cr,100,30);
- cairo_set_source_rgb(cr,1.0,0.0,0.0);
- cairo_set_font_size(cr,12);
- cairo_show_text(cr, "fexchange Error");
- fexchange_error_count++;
- // show for 1 second
- if(fexchange_error_count==2*rx->fps) {
- rx->fexchange_errors=0;
- fexchange_error_count=0;
- }
+ if(rx->id==0 && protocol==ORIGINAL_PROTOCOL && device==DEVICE_HERMES_LITE2) {
+ cairo_set_source_rgb(cr,1.0,1.0,0.0);
+ cairo_set_font_size(cr,16);
+
+ double t = (3.26 * ((double)average_temperature / 4096.0) - 0.5) / 0.01;
+ sprintf(text,"%0.1fC",t);
+ cairo_move_to(cr, 100.0, 30.0);
+ cairo_show_text(cr, text);
+
+ double c = (((3.26 * ((double)average_current / 4096.0)) / 50.0) / 0.04 * 1000 * 1270 / 1000);
+ sprintf(text,"%0.0fmA",c);
+ cairo_move_to(cr, 160.0, 30.0);
+ cairo_show_text(cr, text);
}
cairo_destroy (cr);
cairo_set_source_rgb(cr,1.0,1.0,0.0);
cairo_set_font_size(cr,16);
if(ENABLE_E2_ENCODER) {
- cairo_move_to(cr, display_width-200,30);
+ cairo_move_to(cr, display_width-200,70);
sprintf(text,"%s (%s)",encoder_string[e2_encoder_action],sw_string[e2_sw_action]);
cairo_show_text(cr, text);
}
if(ENABLE_E3_ENCODER) {
- cairo_move_to(cr, display_width-200,50);
+ cairo_move_to(cr, display_width-200,90);
sprintf(text,"%s (%s)",encoder_string[e3_encoder_action],sw_string[e3_sw_action]);
cairo_show_text(cr, text);
}
if(ENABLE_E4_ENCODER) {
- cairo_move_to(cr, display_width-200,70);
+ cairo_move_to(cr, display_width-200,110);
sprintf(text,"%s (%s)",encoder_string[e4_encoder_action],sw_string[e4_sw_action]);
cairo_show_text(cr, text);
}
*/
}
+ if(tx->dialog==NULL && protocol==ORIGINAL_PROTOCOL && device==DEVICE_HERMES_LITE2) {
+ char text[64];
+ cairo_set_source_rgb(cr,1.0,1.0,0.0);
+ cairo_set_font_size(cr,16);
+
+ double t = (3.26 * ((double)average_temperature / 4096.0) - 0.5) / 0.01;
+ sprintf(text,"%0.1fC",t);
+ cairo_move_to(cr, 100.0, 30.0);
+ cairo_show_text(cr, text);
+
+ double c = (((3.26 * ((double)average_current / 4096.0)) / 50.0) / 0.04 * 1000 * 1270 / 1000);
+ sprintf(text,"%0.0fmA",c);
+ cairo_move_to(cr, 160.0, 30.0);
+ cairo_show_text(cr, text);
+ }
+
cairo_destroy (cr);
gtk_widget_queue_draw (tx->panadapter);