service: hid: Fix motion refresh rate
This commit is contained in:
parent
7eb0992d2c
commit
babd580c64
|
@ -3,7 +3,9 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <chrono>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/bit_field.h"
|
#include "common/bit_field.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
@ -547,7 +549,9 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing
|
||||||
|
|
||||||
const auto set_motion_state = [&](SixAxisSensorState& state,
|
const auto set_motion_state = [&](SixAxisSensorState& state,
|
||||||
const Core::HID::ControllerMotion& hid_state) {
|
const Core::HID::ControllerMotion& hid_state) {
|
||||||
|
using namespace std::literals::chrono_literals;
|
||||||
static constexpr SixAxisSensorState default_motion_state = {
|
static constexpr SixAxisSensorState default_motion_state = {
|
||||||
|
.delta_time = std::chrono::nanoseconds(5ms).count(),
|
||||||
.accel = {0, 0, -1.0f},
|
.accel = {0, 0, -1.0f},
|
||||||
.orientation =
|
.orientation =
|
||||||
{
|
{
|
||||||
|
@ -566,6 +570,7 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.attribute.is_connected.Assign(1);
|
state.attribute.is_connected.Assign(1);
|
||||||
|
state.delta_time = std::chrono::nanoseconds(5ms).count();
|
||||||
state.accel = hid_state.accel;
|
state.accel = hid_state.accel;
|
||||||
state.gyro = hid_state.gyro;
|
state.gyro = hid_state.gyro;
|
||||||
state.rotation = hid_state.rotation;
|
state.rotation = hid_state.rotation;
|
||||||
|
|
|
@ -37,8 +37,7 @@ namespace Service::HID {
|
||||||
// Period time is obtained by measuring the number of samples in a second on HW using a homebrew
|
// Period time is obtained by measuring the number of samples in a second on HW using a homebrew
|
||||||
constexpr auto pad_update_ns = std::chrono::nanoseconds{4 * 1000 * 1000}; // (4ms, 250Hz)
|
constexpr auto pad_update_ns = std::chrono::nanoseconds{4 * 1000 * 1000}; // (4ms, 250Hz)
|
||||||
constexpr auto mouse_keyboard_update_ns = std::chrono::nanoseconds{8 * 1000 * 1000}; // (8ms, 125Hz)
|
constexpr auto mouse_keyboard_update_ns = std::chrono::nanoseconds{8 * 1000 * 1000}; // (8ms, 125Hz)
|
||||||
// TODO: Correct update rate for motion is 5ms. Check why some games don't behave at that speed
|
constexpr auto motion_update_ns = std::chrono::nanoseconds{5 * 1000 * 1000}; // (5ms, 200Hz)
|
||||||
constexpr auto motion_update_ns = std::chrono::nanoseconds{10 * 1000 * 1000}; // (10ms, 100Hz)
|
|
||||||
|
|
||||||
IAppletResource::IAppletResource(Core::System& system_,
|
IAppletResource::IAppletResource(Core::System& system_,
|
||||||
KernelHelpers::ServiceContext& service_context_)
|
KernelHelpers::ServiceContext& service_context_)
|
||||||
|
|
Loading…
Reference in New Issue