Only update the battery status for Bluetooth Switch Pro controllers

Controllers that are plugged in are in the wired state
This commit is contained in:
Sam Lantinga
2023-11-10 17:09:39 -08:00
parent 87794d03ad
commit 09d1e9defb

View File

@@ -2035,6 +2035,7 @@ static void HandleFullControllerState(SDL_Joystick *joystick, SDL_DriverSwitch_C
SDL_SendJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTY, ~axis); SDL_SendJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHTY, ~axis);
} }
if (ctx->device->is_bluetooth) {
/* High nibble of battery/connection byte is battery level, low nibble is connection status /* High nibble of battery/connection byte is battery level, low nibble is connection status
* LSB of connection nibble is USB/Switch connection status * LSB of connection nibble is USB/Switch connection status
*/ */
@@ -2055,6 +2056,7 @@ static void HandleFullControllerState(SDL_Joystick *joystick, SDL_DriverSwitch_C
SDL_SendJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_FULL); SDL_SendJoystickBatteryLevel(joystick, SDL_JOYSTICK_POWER_FULL);
} }
} }
}
if (ctx->m_bReportSensors) { if (ctx->m_bReportSensors) {
SDL_bool bHasSensorData = (packet->imuState[0].sAccelZ != 0 || SDL_bool bHasSensorData = (packet->imuState[0].sAccelZ != 0 ||