Allow inverting x axis
This commit is contained in:
parent
8c8a488466
commit
75c19eace1
6 changed files with 13 additions and 2 deletions
|
|
@ -39,6 +39,7 @@ int main(int argc, char ** argv) {
|
|||
.controller_bluetooth = false,
|
||||
.dualsense_edge = false,
|
||||
.swap_y_z = false,
|
||||
.invert_x = false,
|
||||
.gyro_to_analog_activation_treshold = 16,
|
||||
.gyro_to_analog_mapping = 4,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ touchbar = true;
|
|||
controller_bluetooth = true;
|
||||
dualsense_edge = false;
|
||||
swap_y_z = true;
|
||||
invert_x = false;
|
||||
enable_thermal_profiles_switching = true;
|
||||
default_thermal_profile = -1;
|
||||
enable_leds_commands = true;
|
||||
|
|
|
|||
|
|
@ -186,14 +186,14 @@ static void handle_incoming_message_gamepad_set(
|
|||
}
|
||||
case GAMEPAD_GYROSCOPE: {
|
||||
inout_gamepad->last_gyro_motion_timestamp_ns = msg_payload->status.gyro.sample_timestamp_ns;
|
||||
inout_gamepad->raw_gyro[0] = msg_payload->status.gyro.x;
|
||||
inout_gamepad->raw_gyro[0] = in_settings->invert_x ? (int16_t)(-1) * msg_payload->status.gyro.x : msg_payload->status.gyro.x;
|
||||
inout_gamepad->raw_gyro[1] = in_settings->swap_y_z ? msg_payload->status.gyro.z : msg_payload->status.gyro.y;
|
||||
inout_gamepad->raw_gyro[2] = in_settings->swap_y_z ? msg_payload->status.gyro.y : msg_payload->status.gyro.z;
|
||||
break;
|
||||
}
|
||||
case GAMEPAD_ACCELEROMETER: {
|
||||
inout_gamepad->last_accel_motion_timestamp_ns = msg_payload->status.accel.sample_timestamp_ns;
|
||||
inout_gamepad->raw_accel[0] = msg_payload->status.accel.x;
|
||||
inout_gamepad->raw_accel[0] = in_settings->invert_x ? (int16_t)(-1) * msg_payload->status.accel.x : msg_payload->status.accel.x;
|
||||
inout_gamepad->raw_accel[1] = in_settings->swap_y_z ? msg_payload->status.accel.z : msg_payload->status.accel.y;
|
||||
inout_gamepad->raw_accel[2] = in_settings->swap_y_z ? msg_payload->status.accel.y : msg_payload->status.accel.z;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -155,6 +155,13 @@ void load_out_config(dev_out_settings_t *const out_conf, const char* const filep
|
|||
fprintf(stderr, "swap_y_z (bool) configuration not found. Default value will be used.\n");
|
||||
}
|
||||
|
||||
int invert_x;
|
||||
if (config_lookup_bool(&cfg, "invert_x", &invert_x) != CONFIG_FALSE) {
|
||||
out_conf->invert_x = invert_x;
|
||||
} else {
|
||||
fprintf(stderr, "invert_x (bool) configuration not found. Default value will be used.\n");
|
||||
}
|
||||
|
||||
int gyro_to_analog_activation_treshold;
|
||||
if (config_lookup_int(&cfg, "gyro_to_analog_activation_treshold", &gyro_to_analog_activation_treshold) != CONFIG_FALSE) {
|
||||
out_conf->gyro_to_analog_activation_treshold = gyro_to_analog_activation_treshold;
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ typedef struct dev_out_settings {
|
|||
bool controller_bluetooth;
|
||||
bool dualsense_edge;
|
||||
bool swap_y_z;
|
||||
bool invert_x;
|
||||
int gyro_to_analog_activation_treshold;
|
||||
int gyro_to_analog_mapping;
|
||||
} dev_out_settings_t;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ int main(int argc, char ** argv) {
|
|||
.controller_bluetooth = false,
|
||||
.dualsense_edge = false,
|
||||
.swap_y_z = false,
|
||||
.invert_x = false,
|
||||
.gyro_to_analog_activation_treshold = 16,
|
||||
.gyro_to_analog_mapping = 4,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue