Re: [Cpia2-development] qx5view: lights at startup
Brought to you by:
smiller
|
From: Christoph W. <wi...@it...> - 2005-11-30 03:01:49
|
On 30/11/2005, at 2:47 AM, Steven L. MILLER wrote:
> Christoph Willing wrote:
>> The current cvs version of qx5view currently does not turn on the
>> led lights at startup (althought once running, they work as
>> expected). Below is a patch which corrects the startup behaviour.
>> The -l option is now honoured, as is the default light setting
>> (top light), if no - l option is given. The patch is against a cvs
>> checkout on 28th November.
>> I'm new to the list and not sure of the mechanism to contribute
>> patches - hope sending like this is OK.
>> chris
>
> Hi Chris,
>
> Thanks. This is the best way to get something in - those with qx5s
> can now try it out and commit it. Unfortunately I don't have
> access to one, so I'll leave it to one of the qx5 maintainers to do
> this.
Actually, here's a new version of the patch. Although the previous
one set the light properly at startup, it didn't set the light
selection radio button - so although the (say) bottom light was
turned on at startup (with the -l 128 option), the selection button
was still set to "Top". This patch correctly sets the radio button as
well.
BTW, this patch _replaces_ the previous one completely, rather than
laying over the top of it.
chris
========================= snip ======================
--- frontend.h.orig 2005-11-30 11:27:51.000000000 +1000
+++ frontend.h 2005-11-30 11:28:12.000000000 +1000
@@ -44,6 +44,7 @@
void setdepth4(GtkWidget *widget, GdkEvent *event, gpointer data);
void setdepth6(GtkWidget *widget, GdkEvent *event, gpointer data);
void snap(GtkWidget *widget, GdkEvent *event, gpointer data);
+void setlight();
extern struct video_window vid_win;
extern unsigned char *compressedPic;
--- frontend.c.orig 2005-11-29 16:53:19.000000000 +1000
+++ frontend.c 2005-11-30 11:25:51.000000000 +1000
@@ -78,6 +78,7 @@
} LightSetting;
static LightSetting light_setting = LIGHT_TOP;
+static GtkWidget *lightbuttons[4];
#ifdef HAVE_V4L2
struct {
@@ -158,6 +159,7 @@
GdkRectangle update_rec;
static int lasttime = 0;
static int framecount = 0;
+ static int lightSet = 0;
static float rate;
static int size = 0;
int thetime;
@@ -312,6 +314,26 @@
vid_win.width * bytes_per_pixel);
gtk_widget_draw (drawing_area, &update_rec);
+ if( lightSet == 0 ) {
+ switch( light_setting ) {
+ case LIGHT_TOP:
+ gtk_button_clicked((GtkButton*)lightbuttons[0]);
+ break;
+ case LIGHT_BOTTOM:
+ gtk_button_clicked((GtkButton*)lightbuttons[1]);
+ break;
+ case LIGHT_BOTH:
+ gtk_button_clicked((GtkButton*)lightbuttons[2]);
+ break;
+ case LIGHT_OFF:
+ default:
+ gtk_button_clicked((GtkButton*)lightbuttons[3]);
+ break;
+ }
+ setlight();
+ lightSet = 1;
+ }
+
return (TRUE);
}
@@ -970,24 +992,28 @@
gtk_signal_connect_object (GTK_OBJECT (radiobutton), "pressed",
GTK_SIGNAL_FUNC(setlight_top), NULL);
gtk_widget_show (radiobutton);
radiogroup = gtk_radio_button_group (GTK_RADIO_BUTTON
(radiobutton));
+ lightbuttons[0] = radiobutton;
radiobutton = gtk_radio_button_new_with_label (radiogroup,
"Bottom");
gtk_box_pack_start (GTK_BOX (innerbox), radiobutton, TRUE,
TRUE, 0);
gtk_signal_connect_object (GTK_OBJECT (radiobutton), "pressed",
GTK_SIGNAL_FUNC(setlight_bottom), NULL);
gtk_widget_show (radiobutton);
radiogroup = gtk_radio_button_group (GTK_RADIO_BUTTON
(radiobutton));
+ lightbuttons[1] = radiobutton;
radiobutton = gtk_radio_button_new_with_label (radiogroup,
"Both");
gtk_box_pack_start (GTK_BOX (innerbox), radiobutton, TRUE,
TRUE, 0);
gtk_signal_connect_object (GTK_OBJECT (radiobutton), "pressed",
GTK_SIGNAL_FUNC(setlight_both), NULL);
gtk_widget_show (radiobutton);
radiogroup = gtk_radio_button_group (GTK_RADIO_BUTTON
(radiobutton));
+ lightbuttons[2] = radiobutton;
radiobutton = gtk_radio_button_new_with_label (radiogroup, "Off");
gtk_box_pack_start (GTK_BOX (innerbox), radiobutton, TRUE,
TRUE, 0);
gtk_signal_connect_object (GTK_OBJECT (radiobutton), "pressed",
GTK_SIGNAL_FUNC(setlight_off), NULL);
gtk_widget_show (radiobutton);
radiogroup = gtk_radio_button_group (GTK_RADIO_BUTTON
(radiobutton));
+ lightbuttons[3] = radiobutton;
}
/* Create a couple buttons */
========================= snip ======================
Christoph Willing +61 7 3365 8350
QPSF Access Grid Manager
University of Queensland
|