askl
This commit is contained in:
@ -51,7 +51,7 @@ Common::Input::DriverResult GenericProtocol::GetControllerType(ControllerType& c
|
||||
|
||||
Common::Input::DriverResult GenericProtocol::EnableImu(bool enable) {
|
||||
ScopedSetBlocking sb(this);
|
||||
const std::array<u8, 1> buffer{static_cast<u8>(enable ? 1 : 0)};
|
||||
const std::array<u8, 1> buffer{static_cast<u8>(enable ? 3 : 0)};
|
||||
return SendSubCommand(SubCommand::ENABLE_IMU, buffer);
|
||||
}
|
||||
|
||||
|
@ -528,11 +528,9 @@ struct InputReportActive {
|
||||
std::array<u8, 3> left_stick_state;
|
||||
std::array<u8, 3> right_stick_state;
|
||||
u8 vibration_code;
|
||||
std::array<s16, 6 * 2> motion_input;
|
||||
INSERT_PADDING_BYTES(0x2);
|
||||
s16 ring_input;
|
||||
std::array<s16, 6 * 3> motion_input;
|
||||
};
|
||||
static_assert(sizeof(InputReportActive) == 0x29, "InputReportActive is an invalid size");
|
||||
static_assert(sizeof(InputReportActive) > 0x29, "InputReportActive is an invalid size");
|
||||
|
||||
struct InputReportNfcIr {
|
||||
ReportMode report_mode;
|
||||
|
@ -36,7 +36,7 @@ void JoyconPoller::ReadActiveMode(std::span<u8> buffer, const MotionStatus& moti
|
||||
}
|
||||
|
||||
if (ring_status.is_enabled) {
|
||||
UpdateRing(data.ring_input, ring_status);
|
||||
// UpdateRing(data.ring_input, ring_status);
|
||||
}
|
||||
|
||||
callbacks.on_battery_data(data.battery_status);
|
||||
@ -347,14 +347,18 @@ s16 JoyconPoller::GetRawIMUValues(std::size_t sensor, size_t axis,
|
||||
MotionData JoyconPoller::GetMotionInput(const InputReportActive& input,
|
||||
const MotionStatus& motion_status) const {
|
||||
MotionData motion{};
|
||||
for (int i = 0; i < 1; i++) {
|
||||
const auto& accel_cal = motion_calibration.accelerometer;
|
||||
const auto& gyro_cal = motion_calibration.gyro;
|
||||
const s16 raw_accel_x = input.motion_input[1];
|
||||
const s16 raw_accel_y = input.motion_input[0];
|
||||
const s16 raw_accel_z = input.motion_input[2];
|
||||
const s16 raw_gyro_x = input.motion_input[4];
|
||||
const s16 raw_gyro_y = input.motion_input[3];
|
||||
const s16 raw_gyro_z = input.motion_input[5];
|
||||
const s16 raw_accel_x = input.motion_input[1 + (i*6)];
|
||||
const s16 raw_accel_y = input.motion_input[0 + (i * 6)];
|
||||
const s16 raw_accel_z = input.motion_input[2 + (i * 6)];
|
||||
const s16 raw_gyro_x = input.motion_input[4 + (i * 6)];
|
||||
const s16 raw_gyro_y = input.motion_input[3 + (i * 6)];
|
||||
const s16 raw_gyro_z = input.motion_input[5 + (i * 6)];
|
||||
|
||||
LOG_WARNING(Input, "raw sample{}, accel ({},{},{}), gyro ({},{},{})", i, raw_accel_x, raw_accel_y, raw_accel_z,
|
||||
raw_gyro_x, raw_gyro_y, raw_gyro_z);
|
||||
|
||||
motion.delta_timestamp = motion_status.delta_time;
|
||||
motion.accel_x =
|
||||
@ -367,6 +371,10 @@ MotionData JoyconPoller::GetMotionInput(const InputReportActive& input,
|
||||
motion.gyro_y = GetGyroValue(raw_gyro_y, gyro_cal[0], motion_status.gyro_sensitivity);
|
||||
motion.gyro_z = GetGyroValue(raw_gyro_z, gyro_cal[2], motion_status.gyro_sensitivity);
|
||||
|
||||
|
||||
LOG_ERROR(Input, "calibrated samples{}, accel ({},{},{}), gyro ({},{},{})", i, motion.accel_x, motion.accel_y,
|
||||
motion.accel_z, motion.gyro_x, motion.gyro_y, motion.gyro_z);
|
||||
}
|
||||
// TODO(German77): Return all three samples data
|
||||
return motion;
|
||||
}
|
||||
|
Reference in New Issue
Block a user