|
|
@ -90,7 +90,7 @@ static void update_status_boxes(struct blmc_status *status) |
|
|
|
snprintf(buf, sizeof(buf), "%d", status->pwm_real); |
|
|
|
gtk_entry_set_text(GTK_ENTRY(entry402), buf); |
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "%d", status->rpm); |
|
|
|
snprintf(buf, sizeof(buf), "%d", status->rpm * 60 / 42); |
|
|
|
gtk_entry_set_text(GTK_ENTRY(entry403), buf); |
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "%d", status->current); |
|
|
@ -134,6 +134,7 @@ static void on_button101_clicked(GtkButton *button, gpointer user_data) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/* fetch bootloader info 150ms after bootloader was requested */ |
|
|
|
static gint bootloader_cb(gpointer data) |
|
|
|
{ |
|
|
|
char info_buf[16]; |
|
|
@ -143,7 +144,7 @@ static gint bootloader_cb(gpointer data) |
|
|
|
i2c_cmd_getsignature(i2c_fd, sig_buf, sizeof(sig_buf)); |
|
|
|
|
|
|
|
char msg_buf[64]; |
|
|
|
snprintf(msg_buf, sizeof(msg_buf), "%-16s (sig: 0x%02x%02x%02x)\n", |
|
|
|
snprintf(msg_buf, sizeof(msg_buf), "bootloader: %-16s (sig: 0x%02x%02x%02x)\n", |
|
|
|
info_buf, sig_buf[0], sig_buf[1], sig_buf[2]); |
|
|
|
|
|
|
|
add_message(msg_buf); |
|
|
@ -157,6 +158,7 @@ static void on_button102_clicked(GtkButton *button, gpointer user_data) |
|
|
|
g_timeout_add(150, bootloader_cb, NULL); |
|
|
|
} |
|
|
|
|
|
|
|
/* fetch application info 150ms after application was started */ |
|
|
|
static gint application_cb(gpointer data) |
|
|
|
{ |
|
|
|
char info_buf[16]; |
|
|
@ -165,7 +167,7 @@ static gint application_cb(gpointer data) |
|
|
|
i2c_cmd_getparameters(i2c_fd, &blmc_parameters); |
|
|
|
|
|
|
|
char msg_buf[64]; |
|
|
|
snprintf(msg_buf, sizeof(msg_buf), "%-16s\n", info_buf); |
|
|
|
snprintf(msg_buf, sizeof(msg_buf), "application: %-16s\n", info_buf); |
|
|
|
add_message(msg_buf); |
|
|
|
|
|
|
|
update_parameter_boxes(); |
|
|
@ -185,18 +187,14 @@ static void on_button201_clicked(GtkButton *button, gpointer user_data) |
|
|
|
add_message("sorry, not implemented yet\n"); |
|
|
|
} |
|
|
|
|
|
|
|
static void progress_cb(double progress) |
|
|
|
/* progress-bar callback */ |
|
|
|
static void progress_cb(int pos, int size) |
|
|
|
{ |
|
|
|
if (progress < 0.0) |
|
|
|
progress = 0.0; |
|
|
|
else if (progress > 1.0) |
|
|
|
progress = 1.0; |
|
|
|
|
|
|
|
char buf[16]; |
|
|
|
snprintf(buf, sizeof(buf), "%3.0f%%", progress * 100); |
|
|
|
snprintf(buf, sizeof(buf), "%3d%%", pos * 100 / size); |
|
|
|
|
|
|
|
gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progressbar201), buf); |
|
|
|
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progressbar201), progress); |
|
|
|
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progressbar201), (double)pos / (double)size); |
|
|
|
gdk_window_process_updates(gtk_widget_get_parent_window(progressbar201), 1); |
|
|
|
} |
|
|
|
|
|
|
@ -299,7 +297,7 @@ static gint pwm_update_cb(gpointer data) |
|
|
|
/* Motor Togglebutton */ |
|
|
|
static void on_togglebutton401_toggled(GtkToggleButton *togglebutton, gpointer user_data) |
|
|
|
{ |
|
|
|
g_timeout_add(50, pwm_update_cb, NULL); |
|
|
|
g_timeout_add(250, pwm_update_cb, NULL); |
|
|
|
} |
|
|
|
|
|
|
|
static unsigned int i2c_interface_count; |
|
|
@ -612,9 +610,7 @@ GtkWidget * gui_create_window (void) |
|
|
|
gtk_table_attach (GTK_TABLE (table201), filechooserbutton201, 0, 2, 1, 2, |
|
|
|
(GtkAttachOptions) (GTK_FILL), |
|
|
|
(GtkAttachOptions) (0), 5, 0); |
|
|
|
g_object_set (filechooserbutton201, |
|
|
|
"width-chars", 15, |
|
|
|
NULL); |
|
|
|
g_object_set (filechooserbutton201, "width-chars", 15, NULL); |
|
|
|
|
|
|
|
label202 = gtk_label_new ("EEPROM:"); |
|
|
|
gtk_widget_show (label202); |
|
|
@ -627,9 +623,7 @@ GtkWidget * gui_create_window (void) |
|
|
|
gtk_table_attach (GTK_TABLE (table201), filechooserbutton202, 3, 5, 1, 2, |
|
|
|
(GtkAttachOptions) (GTK_FILL), |
|
|
|
(GtkAttachOptions) (0), 5, 0); |
|
|
|
g_object_set (filechooserbutton202, |
|
|
|
"width-chars", 16, |
|
|
|
NULL); |
|
|
|
g_object_set (filechooserbutton202, "width-chars", 16, NULL); |
|
|
|
|
|
|
|
button207 = gtk_button_new_with_mnemonic ("VERIFY"); |
|
|
|
gtk_widget_show (button207); |
|
|
|