mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-17 22:41:40 +00:00
DolphinQt: Make Calibration autocomplete when data is "sensible" and stick is returned to neutral position.
This commit is contained in:
parent
fa9f71e482
commit
6a0963908d
4 changed files with 45 additions and 19 deletions
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <cmath>
|
||||
#include <ranges>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
@ -277,6 +278,16 @@ bool CalibrationBuilder::IsCalibrationDataSensible() const
|
|||
return stats.StandardDeviation() < REASONABLE_DEVIATION;
|
||||
}
|
||||
|
||||
bool CalibrationBuilder::IsComplete() const
|
||||
{
|
||||
if (!IsCalibrationDataSensible())
|
||||
return false;
|
||||
|
||||
const auto half_calibration =
|
||||
0.5 * GetCalibrationRadiusAtAngle(std::atan2(m_prev_point.y, m_prev_point.x) + MathUtil::TAU);
|
||||
return m_prev_point.LengthSquared() < (half_calibration * half_calibration);
|
||||
}
|
||||
|
||||
ControlState CalibrationBuilder::GetCalibrationRadiusAtAngle(double angle) const
|
||||
{
|
||||
return ControllerEmu::ReshapableInput::GetCalibrationDataRadiusAtAngle(m_calibration_data, angle);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue