mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-10-12 02:09:17 +00:00
ps move: only try to reconnect once per second
This commit is contained in:
@@ -51,6 +51,8 @@ public:
|
||||
bool enable_player_leds{};
|
||||
bool update_player_leds{true};
|
||||
|
||||
steady_clock::time_point last_reconnect_attempt{};
|
||||
|
||||
std::shared_ptr<FusionAhrs> ahrs; // Used to calculate quaternions from sensor data
|
||||
u64 last_ahrs_update_time_us = 0; // Last ahrs update
|
||||
bool ahrs_drift_correction = false; // Continuously correct the inclination using the accelerometer and estimate the gyro bias
|
||||
|
||||
@@ -434,6 +434,15 @@ PadHandlerBase::connection ps_move_handler::update_connection(const std::shared_
|
||||
|
||||
if (move_device->hidDevice == nullptr)
|
||||
{
|
||||
// Try to reconnect every now and then.
|
||||
const steady_clock::time_point now = steady_clock::now();
|
||||
const s64 elapsed_ms = std::chrono::duration_cast<std::chrono::milliseconds>(now - move_device->last_reconnect_attempt).count();
|
||||
|
||||
if (elapsed_ms < 1000)
|
||||
return connection::disconnected;
|
||||
|
||||
move_device->last_reconnect_attempt = now;
|
||||
|
||||
// try to reconnect
|
||||
#ifdef _WIN32
|
||||
if (hid_device* dev = connect_move_device(move_device, move_device->path))
|
||||
|
||||
@@ -500,12 +500,12 @@ PadHandlerBase::connection sdl_pad_handler::update_connection(const std::shared_
|
||||
|
||||
// Try to reconnect every now and then.
|
||||
const steady_clock::time_point now = steady_clock::now();
|
||||
const s64 elapsed_ms = std::chrono::duration_cast<std::chrono::milliseconds>(now - dev->last_update).count();
|
||||
const s64 elapsed_ms = std::chrono::duration_cast<std::chrono::milliseconds>(now - dev->last_reconnect_attempt).count();
|
||||
|
||||
if (elapsed_ms < 1000)
|
||||
return connection::disconnected;
|
||||
|
||||
dev->last_update = now;
|
||||
dev->last_reconnect_attempt = now;
|
||||
|
||||
int count = 0;
|
||||
SDL_JoystickID* gamepads = SDL_GetGamepads(&count);
|
||||
|
||||
@@ -77,7 +77,6 @@ public:
|
||||
bool led_is_on = true;
|
||||
bool led_is_blinking = false;
|
||||
steady_clock::time_point led_timestamp{};
|
||||
steady_clock::time_point last_update{};
|
||||
};
|
||||
|
||||
class sdl_pad_handler : public PadHandlerBase
|
||||
|
||||
Reference in New Issue
Block a user