|
Motion Plus and Wiiuse September 08, 2009 11:06AM | Registered: 16 years ago Posts: 5 |
|
Re: Motion Plus and Wiiuse September 09, 2009 03:08AM | Moderator Registered: 17 years ago Posts: 441 |
|
Re: Motion Plus and Wiiuse September 09, 2009 03:41AM | Registered: 17 years ago Posts: 98 |
|
Re: Motion Plus and Wiiuse September 09, 2009 05:36PM | Registered: 16 years ago Posts: 5 |
|
Re: Motion Plus and Wiiuse September 09, 2009 08:30PM | Moderator Registered: 17 years ago Posts: 441 |
|
Re: Motion Plus and Wiiuse September 10, 2009 09:35PM | Registered: 16 years ago Posts: 116 |
bool initMotionPlus(s32 wiimote)
{
expansion_t exp;
s32 result = WPAD_SetMotionPlus(wiimote, 1);
if (result == WPAD_ERR_NONE)
{
printf("\nMotion plus is set\n");
WPAD_Expansion(wiimote, &exp);
if (exp.type == EXP_MOTION_PLUS)
{
printf("YESS!");
return true;
} else
{
printf("NOPEZ! %x", exp.type);
return false;
}
} else {
printf("\nError setting motion plus %d\n", result);
return false;
}
}
...excerpt from main...
WPAD_Init();
WPAD_SetDataFormat(0,WPAD_FMT_BTNS_ACC);
int retries = 5;
while (!initMotionPlus(WPAD_CHAN_0) && retries--)
{
sleep(1);
}
sleep(1);
WPAD_ScanPads();
WPADData * wp = WPAD_Data(0);
exp = wp->exp;
printf("\nRX>>%d", exp.mp.rx);
usleep(500);
WPAD_ScanPads();
wp = WPAD_Data(0);
exp = wp->exp;
printf("\nRX>>%d", exp.mp.rx);
|
Re: Motion Plus and Wiiuse September 14, 2009 04:12AM | Registered: 16 years ago Posts: 2 |
|
Re: Motion Plus and Wiiuse September 30, 2009 04:21AM | Registered: 16 years ago Posts: 2 |
|
Re: Motion Plus and Wiiuse October 01, 2009 07:45AM | Registered: 17 years ago Posts: 10 |
// in main loop
if(!mpConnected)
{
sleep(2);
WPAD_SetMotionPlus(0, 1);
}
WPAD_Expansion(0, &exp);
if (exp.type == EXP_MOTION_PLUS)
mpConnected = true;
else
mpConnected = false;|
Re: Motion Plus and Wiiuse October 01, 2009 09:27AM | Registered: 16 years ago Posts: 116 |
Quote
melw
So, what is the correct way of initializing the MotionPlus extension? I had first similar problems to I.R.on above, but after playing around a bit I got readings from the extension - in not so pretty way:// in main loop if(!mpConnected) { sleep(2); WPAD_SetMotionPlus(0, 1); } WPAD_Expansion(0, &exp); if (exp.type == EXP_MOTION_PLUS) mpConnected = true; else mpConnected = false;
Without sleep() the MotionPlus doesn't seem to get initialized... So obviously some waiting is needed? Doing it like this succeeds after the second WPAD_SetMotionPlus() call. In any case, any pointers to a better initialization routine are highly welcome. Thanks!
|
Re: Motion Plus and Wiiuse October 01, 2009 01:04PM | Registered: 17 years ago Posts: 10 |
|
Re: Motion Plus and Wiiuse October 01, 2009 04:25PM | Registered: 16 years ago Posts: 116 |
|
Re: Motion Plus and Wiiuse October 02, 2009 02:07PM | Registered: 16 years ago Posts: 116 |
s32 WPAD_ScanPads()
{
return WPAD_ReadPending(WPAD_CHAN_ALL, NULL);
}|
Re: Motion Plus and Wiiuse December 11, 2009 06:12PM | Registered: 16 years ago Posts: 1 |
|
Re: Motion Plus and Wiiuse December 11, 2009 06:38PM | Registered: 16 years ago Posts: 55 |
|
Re: Motion Plus and Wiiuse December 11, 2009 09:36PM | Registered: 17 years ago Posts: 175 |
|
Re: Motion Plus and Wiiuse December 11, 2009 10:03PM | Registered: 16 years ago Posts: 55 |
|
Re: Motion Plus and Wiiuse April 28, 2010 08:18AM | Registered: 15 years ago Posts: 2 |
|
Re: Motion Plus and Wiiuse April 28, 2010 04:43PM | Registered: 16 years ago Posts: 55 |
|
Re: Motion Plus and Wiiuse May 18, 2010 08:55AM | Registered: 15 years ago Posts: 2 |