#include "fft_menu.h"
#include "main.h"
#include "gpio.h"
+#ifdef RESTART_BUTTON
+#include "old_protocol.h"
+#include "new_protocol.h"
+#endif
static GtkWidget *menu_b=NULL;
return TRUE;
}
+#ifdef RESTART_BUTTON
+//
+// To recover from certain error conditions, this function
+// restart the protocol.
+//
+static gboolean restart_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ cleanup();
+ switch(protocol) {
+ case ORIGINAL_PROTOCOL:
+ old_protocol_stop();
+ usleep(200000);
+ old_protocol_run();
+ break;
+ case NEW_PROTOCOL:
+ new_protocol_restart();
+ break;
+#ifdef SOAPYSDR
+ case SOAPYSDR_PROTOCOL:
+ // dunno how to do this for soapy
+ break;
+#endif
+ }
+ return TRUE;
+}
+#endif
+
static gboolean about_b_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
cleanup();
about_menu(top_window);
g_signal_connect (close_b, "button-press-event", G_CALLBACK(close_cb), NULL);
gtk_grid_attach(GTK_GRID(grid),close_b,0,0,2,1);
+#ifdef RESTART_BUTTON
+ //
+ // The new "Restart" button activates a function that restarts
+ // the protocol and closes the menu window
+ //
+ GtkWidget *restart_b=gtk_button_new_with_label("Restart");
+ g_signal_connect (restart_b, "button-press-event", G_CALLBACK(restart_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),restart_b,2,0,2,1);
+#endif
+
GtkWidget *exit_b=gtk_button_new_with_label("Exit piHPSDR");
g_signal_connect (exit_b, "button-press-event", G_CALLBACK(exit_cb), NULL);
gtk_grid_attach(GTK_GRID(grid),exit_b,4,0,2,1);