Replace explicit 32 lengths for MAX_PAYLOAD
This commit is contained in:
6
src/io.c
6
src/io.c
@@ -69,7 +69,7 @@ void wiiuse_wait_report(struct wiimote_t *wm, int report, byte *data)
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
if(wiiuse_io_read(wm, data, 32) > 0)
|
||||
if(wiiuse_io_read(wm, data, MAX_PAYLOAD) > 0)
|
||||
if(data[1] == report)
|
||||
break;
|
||||
}
|
||||
@@ -91,7 +91,7 @@ void wiiuse_wait_report(struct wiimote_t *wm, int report, byte *data)
|
||||
void wiiuse_read(struct wiimote_t *wm, byte memory, unsigned addr, unsigned short size, byte *data)
|
||||
{
|
||||
byte pkt[8];
|
||||
byte buf[32];
|
||||
byte buf[MAX_PAYLOAD];
|
||||
unsigned n_full_reports;
|
||||
unsigned last_report;
|
||||
byte *output;
|
||||
@@ -154,7 +154,7 @@ void wiiuse_read(struct wiimote_t *wm, byte memory, unsigned addr, unsigned shor
|
||||
void wiiuse_handshake(struct wiimote_t* wm, byte* data, uint16_t len)
|
||||
{
|
||||
/* send request to wiimote for accelerometer calibration */
|
||||
byte buf[32];
|
||||
byte buf[MAX_PAYLOAD];
|
||||
byte report_type;
|
||||
|
||||
/* step 0 - Reset wiimote */
|
||||
|
||||
@@ -45,7 +45,7 @@ static void calculate_gyro_rates(struct motion_plus_t* mp);
|
||||
|
||||
void wiiuse_probe_motion_plus(struct wiimote_t *wm)
|
||||
{
|
||||
byte buf[32];
|
||||
byte buf[MAX_PAYLOAD];
|
||||
unsigned id;
|
||||
|
||||
wiiuse_read(wm, 0, WM_EXP_MOTION_PLUS_IDENT, 6, buf);
|
||||
|
||||
@@ -657,7 +657,7 @@ void wiiuse_send_next_pending_write_request(struct wiimote_t* wm) {
|
||||
* This function should replace any write()s directly to the wiimote device.
|
||||
*/
|
||||
int wiiuse_send(struct wiimote_t* wm, byte report_type, byte* msg, int len) {
|
||||
byte buf[32]; /* no payload is better than this */
|
||||
byte buf[MAX_PAYLOAD]; /* no payload is better than this */
|
||||
int rumble = 0;
|
||||
|
||||
#ifdef WIIUSE_WIN32
|
||||
|
||||
Reference in New Issue
Block a user