mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-06 19:38:14 +00:00
Fixed LED pending check failing when the controller timestamp is very large
In this case we know the controller has been on for a while and the Bluetooth connection LED cycle is complete.
Also fixed the timestamp being zero the first time it is checked
(cherry picked from commit bd4f155bbb
)
This commit is contained in:
@@ -729,7 +729,7 @@ static void HIDAPI_DriverPS5_CheckPendingLEDReset(SDL_HIDAPI_Device *device)
|
|||||||
packet->rgucSensorTimestamp[1],
|
packet->rgucSensorTimestamp[1],
|
||||||
packet->rgucSensorTimestamp[2],
|
packet->rgucSensorTimestamp[2],
|
||||||
packet->rgucSensorTimestamp[3]);
|
packet->rgucSensorTimestamp[3]);
|
||||||
if (SDL_TICKS_PASSED(timestamp, connection_complete)) {
|
if (timestamp >= connection_complete) {
|
||||||
led_reset_complete = SDL_TRUE;
|
led_reset_complete = SDL_TRUE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1407,15 +1407,15 @@ static SDL_bool HIDAPI_DriverPS5_UpdateDevice(SDL_HIDAPI_Device *device)
|
|||||||
/* This is the extended report, we can enable effects now */
|
/* This is the extended report, we can enable effects now */
|
||||||
HIDAPI_DriverPS5_SetEnhancedMode(device, joystick);
|
HIDAPI_DriverPS5_SetEnhancedMode(device, joystick);
|
||||||
}
|
}
|
||||||
if (ctx->led_reset_state == k_EDS5LEDResetStatePending) {
|
|
||||||
HIDAPI_DriverPS5_CheckPendingLEDReset(device);
|
|
||||||
}
|
|
||||||
HIDAPI_DriverPS5_HandleStatePacketCommon(joystick, device->dev, ctx, (PS5StatePacketCommon_t *)&data[2]);
|
HIDAPI_DriverPS5_HandleStatePacketCommon(joystick, device->dev, ctx, (PS5StatePacketCommon_t *)&data[2]);
|
||||||
if (ctx->use_alternate_report) {
|
if (ctx->use_alternate_report) {
|
||||||
HIDAPI_DriverPS5_HandleStatePacketAlt(joystick, device->dev, ctx, (PS5StatePacketAlt_t *)&data[2]);
|
HIDAPI_DriverPS5_HandleStatePacketAlt(joystick, device->dev, ctx, (PS5StatePacketAlt_t *)&data[2]);
|
||||||
} else {
|
} else {
|
||||||
HIDAPI_DriverPS5_HandleStatePacket(joystick, device->dev, ctx, (PS5StatePacket_t *)&data[2]);
|
HIDAPI_DriverPS5_HandleStatePacket(joystick, device->dev, ctx, (PS5StatePacket_t *)&data[2]);
|
||||||
}
|
}
|
||||||
|
if (ctx->led_reset_state == k_EDS5LEDResetStatePending) {
|
||||||
|
HIDAPI_DriverPS5_CheckPendingLEDReset(device);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
#ifdef DEBUG_JOYSTICK
|
#ifdef DEBUG_JOYSTICK
|
||||||
|
Reference in New Issue
Block a user