AntiMicroX
Loading...
Searching...
No Matches
joyaccelerometersensor.h
Go to the documentation of this file.
1/* antimicrox Gamepad to KB+M event mapper
2 * Copyright (C) 2022 Max Maisel <max.maisel@posteo.de>
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#pragma once
19
20#include "joysensor.h"
21
22class SetJoystick;
23
28{
29 public:
30 explicit JoyAccelerometerSensor(double rate, int originset, SetJoystick *parent_set, QObject *parent);
32
33 virtual float getXCoordinate() const override;
34 virtual float getYCoordinate() const override;
35 virtual float getZCoordinate() const override;
36 virtual QString sensorTypeName() const override;
37
38 virtual void getCalibration(double *offsetX, double *offsetY, double *offsetZ) const override;
39 virtual void setCalibration(double offsetX, double offsetY, double offsetZ) override;
40
41 public slots:
42 virtual void reset() override;
43
44 protected:
45 static const double SHOCK_DETECT_THRESHOLD;
46 static const double SHOCK_SUPPRESS_FACTOR;
47 static const double SHOCK_TAU;
48
49 virtual void populateButtons() override;
51 virtual void applyCalibration() override;
52
53 double m_rate;
57};
Represents an accelerometer sensor.
Definition joyaccelerometersensor.h:28
static const double SHOCK_TAU
Definition joyaccelerometersensor.h:47
virtual QString sensorTypeName() const override
Get the translated sensor type name.
Definition joyaccelerometersensor.cpp:63
virtual float getYCoordinate() const override
Get the value for the corresponding Y axis.
Definition joyaccelerometersensor.cpp:51
virtual JoySensorDirection calculateSensorDirection() override
Find the direction zone of the current sensor position.
Definition joyaccelerometersensor.cpp:166
virtual void reset() override
Resets internal variables back to default.
Definition joyaccelerometersensor.cpp:113
virtual ~JoyAccelerometerSensor()
Definition joyaccelerometersensor.cpp:39
virtual void applyCalibration() override
Applies calibration to queued input values.
Definition joyaccelerometersensor.cpp:222
static const double SHOCK_DETECT_THRESHOLD
Definition joyaccelerometersensor.h:45
virtual float getZCoordinate() const override
Get the value for the corresponding Z axis.
Definition joyaccelerometersensor.cpp:57
virtual void getCalibration(double *offsetX, double *offsetY, double *offsetZ) const override
Reads the calibration values of the sensor.
Definition joyaccelerometersensor.cpp:71
virtual void populateButtons() override
Initializes the JoySensorButton objects for this sensor.
Definition joyaccelerometersensor.cpp:125
virtual float getXCoordinate() const override
Get the value for the corresponding X axis.
Definition joyaccelerometersensor.cpp:45
static const double SHOCK_SUPPRESS_FACTOR
Definition joyaccelerometersensor.h:46
size_t m_shock_suppress_count
Definition joyaccelerometersensor.h:55
PT1Filter m_shock_filter
Definition joyaccelerometersensor.h:54
double m_rate
Definition joyaccelerometersensor.h:53
virtual void setCalibration(double offsetX, double offsetY, double offsetZ) override
Sets the sensor calibration values and sets the calibration flag.
Definition joyaccelerometersensor.cpp:88
double m_calibration_matrix[3][3]
Definition joyaccelerometersensor.h:56
Definition joydpadxml.h:27
Represents one sensor in a SetJoystick and its connections to other parts of the application....
Definition joysensor.h:40
Implementation of a first order lag or PT1 filter. Can be used for example to smooth noisy values a b...
Definition pt1filter.h:26
A set of mapped events which can by switched by a controller event. Contains controller input objects...
Definition setjoystick.h:40
JoySensorDirection
A bitfield style enum which encodes all possible three dimensional sensor directions....
Definition joysensordirection.h:28