Skip to content

Commit bd28e19

Browse files
authored
Send status request after command fails so Wiimote continues communications (#237)
1 parent fb5d0f5 commit bd28e19

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

wiiuse/events.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,17 @@ static void event_ack(struct wiimote_t *wm,ubyte *msg)
8989
}
9090
if(msg[3]) {
9191
WIIUSE_WARNING("Command %02x %02x%02x%02x%02x failed: status %02x", cmd->data[0], cmd->data[1], cmd->data[2], cmd->data[3], cmd->data[4], msg[3]);
92+
// Send a status request to reset Wiimote error state
93+
// Without this, the Wiimote will stop sending any data after the error occurs
94+
wiiuse_status(wm,NULL);
95+
96+
wm->cmd_head = cmd->next;
97+
98+
cmd->state = CMD_DONE;
99+
if(cmd->cb) cmd->cb(wm,NULL,0);
100+
101+
__lwp_queue_append(&wm->cmdq,&cmd->node);
102+
wiiuse_send_next_command(wm);
92103
return;
93104
}
94105

0 commit comments

Comments
 (0)