Add variants of the CH Flightstick Pro and Thrustmaster FCS

with rudder pedals (CH Pedals and Thrustmaster RCS respectively) attached
This commit is contained in:
Alexander Babikov
2025-01-18 15:47:41 +05:00
parent 4e4ad8913c
commit 0a5fa0da39
4 changed files with 102 additions and 12 deletions

View File

@@ -112,6 +112,26 @@ ch_flightstick_pro_read_axis(UNUSED(void *priv), int axis)
}
}
static int
ch_flightstick_pro_ch_pedals_read_axis(UNUSED(void *priv), int axis)
{
if (!JOYSTICK_PRESENT(0, 0))
return AXIS_NOT_PRESENT;
switch (axis) {
case 0:
return joystick_state[0][0].axis[0];
case 1:
return joystick_state[0][0].axis[1];
case 2:
return joystick_state[0][0].axis[3];
case 3:
return joystick_state[0][0].axis[2];
default:
return 0;
}
}
static void
ch_flightstick_pro_a0_over(UNUSED(void *priv))
{
@@ -135,3 +155,21 @@ const joystick_if_t joystick_ch_flightstick_pro = {
.button_names = { "Button 1", "Button 2", "Button 3", "Button 4" },
.pov_names = { "POV" }
};
const joystick_if_t joystick_ch_flightstick_pro_ch_pedals = {
.name = "CH Flightstick Pro + CH Pedals",
.internal_name = "ch_flightstick_pro_ch_pedals",
.init = ch_flightstick_pro_init,
.close = ch_flightstick_pro_close,
.read = ch_flightstick_pro_read,
.write = ch_flightstick_pro_write,
.read_axis = ch_flightstick_pro_ch_pedals_read_axis,
.a0_over = ch_flightstick_pro_a0_over,
.axis_count = 4,
.button_count = 4,
.pov_count = 1,
.max_joysticks = 1,
.axis_names = { "X axis", "Y axis", "Throttle", "Rudder" },
.button_names = { "Button 1", "Button 2", "Button 3", "Button 4" },
.pov_names = { "POV" }
};