I am trying to get a joystick working with n xforms program. Getting it
working realy isn't the problem. I try to set up a calibration routine
when a "Calibrate" button is pressed. The user is prompted by a text
object to move the joystick to the upper left corner and press a
joystick button. It then enters a loop reading /dev/js0 untill a js
button is pressed.
The problem is that the text message does not appear until AFTER the js
button is pressed. Below is the "Calibrate" button callback.
void calibrate_cb(FL_OBJECT *ob, long data)
{
long delay;
fl_set_object_label(fd_joytest->calibrateText,
"Move joystick to upper left");
fl_suspend_timer(fd_joytest->timer1);
js.buttons = 0;
sleep(1);
do{
read(fd, &js, JS_RETURN);
}while(js.buttons == 0);
fl_resume_timer(fd_joytest->timer1);
printf("Leaving calibrate.\n");
}
The timer is used to do the normal reading of the joystick. I even put
the sleep(1) to allow time to display the message BEFORE entering the
loop. But, teh message does not get displayed until AFTER a js button is
pressed.
Why????
-- Jeff Pierce piercej@preferred.com http://pages.preferred.com/~piercej _________________________________________________ To unsubscribe, send the message "unsubscribe" to xforms-request@bob.usuhs.mil or see http://bob.usuhs.mil/mailserv/xforms.html XForms Home Page: http://bragg.phys.uwm.edu/xforms List Archive: http://bob.usuhs.mil/mailserv/list-archives/