Skip to content
This repository has been archived by the owner on May 3, 2021. It is now read-only.

Commit

Permalink
Fixing assorted controller issues:
Browse files Browse the repository at this point in the history
* UpdateEmulatedTrackpad() wasn't checking to see if the button bound was actually pressed
* fixed config typo with extend_Z_meters
* changing default meters_per_touchpad_axis_units to (7.5f/100.f)
  • Loading branch information
HipsterSloth committed Dec 3, 2018
1 parent 984b331 commit 3448b7d
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 49 deletions.
19 changes: 9 additions & 10 deletions src/main/cpp/driver/ps_ds4_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,16 +425,15 @@ namespace steamvrbridge {
eEmulatedTrackpadAction action= getConfig()->ps_button_id_to_emulated_touchpad_action[buttonIndex];
if (action != k_EmulatedTrackpadAction_None) {
PSMButtonState button_state= PSMButtonState_UP;
if (Controller::GetButtonState((ePSMButtonID)buttonIndex, button_state))
{
if (action >= highestPriorityAction)
{
highestPriorityAction= action;
}

if (action >= k_EmulatedTrackpadAction_Press)
{
break;
if (Controller::GetButtonState((ePSMButtonID)buttonIndex, button_state)) {
if (button_state == PSMButtonState_DOWN || button_state == PSMButtonState_PRESSED) {
if (action >= highestPriorityAction) {
highestPriorityAction= action;
}

if (action >= k_EmulatedTrackpadAction_Press) {
break;
}
}
}
}
Expand Down
31 changes: 13 additions & 18 deletions src/main/cpp/driver/ps_move_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace steamvrbridge {
// General Settings
pt["rumble_suppressed"] = rumble_suppressed;
pt["extend_y_cm"] = extend_Y_meters * 100.f;
pt["extend_x_cm"] = extend_Z_meters * 100.f;
pt["extend_z_cm"] = extend_Z_meters * 100.f;
pt["rotate_z_90"] = z_rotate_90_degrees;
pt["calibration_offset_cm"] = calibration_offset_meters * 100.f;
pt["disable_alignment_gesture"] = disable_alignment_gesture;
Expand Down Expand Up @@ -68,7 +68,7 @@ namespace steamvrbridge {
// General Settings
rumble_suppressed = pt.get_or<bool>("rumble_suppressed", rumble_suppressed);
extend_Y_meters = pt.get_or<float>("extend_y_cm", 0.f) / 100.f;
extend_Z_meters = pt.get_or<float>("extend_x_cm", 0.f) / 100.f;
extend_Z_meters = pt.get_or<float>("extend_z_cm", -7.5f) / 100.f;
z_rotate_90_degrees = pt.get_or<bool>("rotate_z_90", z_rotate_90_degrees);
calibration_offset_meters = pt.get_or<float>("calibration_offset_cm", 6.f) / 100.f;
disable_alignment_gesture = pt.get_or<bool>("disable_alignment_gesture", disable_alignment_gesture);
Expand Down Expand Up @@ -409,16 +409,15 @@ namespace steamvrbridge {
eEmulatedTrackpadAction action= getConfig()->ps_button_id_to_emulated_touchpad_action[buttonIndex];
if (action != k_EmulatedTrackpadAction_None) {
PSMButtonState button_state= PSMButtonState_UP;
if (Controller::GetButtonState((ePSMButtonID)buttonIndex, button_state))
{
if (action >= highestPriorityAction)
{
highestPriorityAction= action;
}
if (Controller::GetButtonState((ePSMButtonID)buttonIndex, button_state)) {
if (button_state == PSMButtonState_DOWN || button_state == PSMButtonState_PRESSED) {
if (action >= highestPriorityAction) {
highestPriorityAction= action;
}

if (action >= k_EmulatedTrackpadAction_Press)
{
break;
if (action >= k_EmulatedTrackpadAction_Press) {
break;
}
}
}
}
Expand All @@ -429,20 +428,16 @@ namespace steamvrbridge {
PSMButtonState emulatedTouchPadTouchedState= PSMButtonState_UP;
PSMButtonState emulatedTouchPadPressedState= PSMButtonState_UP;

if (highestPriorityAction == k_EmulatedTrackpadAction_Touch)
{
if (highestPriorityAction == k_EmulatedTrackpadAction_Touch) {
emulatedTouchPadTouchedState= PSMButtonState_DOWN;
}
else if (highestPriorityAction == k_EmulatedTrackpadAction_Press)
{
} else if (highestPriorityAction == k_EmulatedTrackpadAction_Press) {
emulatedTouchPadTouchedState= PSMButtonState_DOWN;
emulatedTouchPadPressedState= PSMButtonState_DOWN;
}

// If the action specifies a specific trackpad direction,
// then use the given trackpad axis
if (highestPriorityAction > k_EmulatedTrackpadAction_Press)
{
if (highestPriorityAction > k_EmulatedTrackpadAction_Press) {
emulatedTouchPadTouchedState= PSMButtonState_DOWN;
emulatedTouchPadPressedState= PSMButtonState_DOWN;

Expand Down
3 changes: 2 additions & 1 deletion src/main/cpp/driver/ps_move_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ namespace steamvrbridge {
, extend_Z_meters(0.f)
, z_rotate_90_degrees(false)
, delay_after_touchpad_press(false)
, meters_per_touchpad_axis_units()
, meters_per_touchpad_axis_units(7.5f/100.f)
, calibration_offset_meters(0.f)
, disable_alignment_gesture(false)
, use_orientation_in_hmd_alignment(true)
, linear_velocity_multiplier(1.f)
, linear_velocity_exponent(0.f)
{
ps_button_id_to_emulated_touchpad_action[k_PSMButtonID_Move]= eEmulatedTrackpadAction::k_EmulatedTrackpadAction_Press;
};

configuru::Config WriteToJSON() override;
Expand Down
19 changes: 9 additions & 10 deletions src/main/cpp/driver/ps_navi_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,16 +304,15 @@ namespace steamvrbridge {
eEmulatedTrackpadAction action= getConfig()->ps_button_id_to_emulated_touchpad_action[buttonIndex];
if (action != k_EmulatedTrackpadAction_None) {
PSMButtonState button_state= PSMButtonState_UP;
if (Controller::GetButtonState((ePSMButtonID)buttonIndex, button_state))
{
if (action >= highestPriorityAction)
{
highestPriorityAction= action;
}

if (action >= k_EmulatedTrackpadAction_Press)
{
break;
if (Controller::GetButtonState((ePSMButtonID)buttonIndex, button_state)) {
if (button_state == PSMButtonState_DOWN || button_state == PSMButtonState_PRESSED) {
if (action >= highestPriorityAction) {
highestPriorityAction= action;
}

if (action >= k_EmulatedTrackpadAction_Press) {
break;
}
}
}
}
Expand Down
19 changes: 9 additions & 10 deletions src/main/cpp/driver/virtual_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,16 +451,15 @@ namespace steamvrbridge {
eEmulatedTrackpadAction action= getConfig()->ps_button_id_to_emulated_touchpad_action[buttonIndex];
if (action != k_EmulatedTrackpadAction_None) {
PSMButtonState button_state= PSMButtonState_UP;
if (Controller::GetButtonState((ePSMButtonID)buttonIndex, button_state))
{
if (action >= highestPriorityAction)
{
highestPriorityAction= action;
}

if (action >= k_EmulatedTrackpadAction_Press)
{
break;
if (Controller::GetButtonState((ePSMButtonID)buttonIndex, button_state)) {
if (button_state == PSMButtonState_DOWN || button_state == PSMButtonState_PRESSED) {
if (action >= highestPriorityAction) {
highestPriorityAction= action;
}

if (action >= k_EmulatedTrackpadAction_Press) {
break;
}
}
}
}
Expand Down

0 comments on commit 3448b7d

Please sign in to comment.