Skip to content

Commit

Permalink
Merge pull request #70 from AndunHH/fixSwitchYZ
Browse files Browse the repository at this point in the history
Fixing SwitchYZ
  • Loading branch information
AndunHH authored Jan 20, 2025
2 parents 937c45a + 790ef76 commit cdf87f5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
14 changes: 14 additions & 0 deletions spacemouse-keys/kinematics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,18 @@ void switchXY(int16_t *velocity)
tmp = velocity[ROTX];
velocity[ROTX] = velocity[ROTY];
velocity[ROTY] = tmp;
}

/// @brief Switch position of Y and Z values
/// @param velocity pointer to velocity array
void switchYZ(int16_t *velocity)
{
int16_t tmp = 0;
tmp = velocity[TRANSY];
velocity[TRANSY] = velocity[TRANSZ];
velocity[TRANSZ] = tmp;

tmp = velocity[ROTY];
velocity[ROTY] = velocity[ROTZ];
velocity[ROTZ] = tmp;
}
1 change: 1 addition & 0 deletions spacemouse-keys/kinematics.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ void FilterAnalogReadOuts(int* centered);
void calculateKinematic(int* centered, int16_t* velocity);

void switchXY(int16_t *velocity);
void switchYZ(int16_t *velocity);

// The following constants are here for more readable access to the arrays. You don't need to change this values!
// Axes in centered or rawValues array
Expand Down
2 changes: 1 addition & 1 deletion spacemouse-keys/spacemouse-keys.ino
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ void loop()
}

#if SWITCHYZ > 0
switchXY(velocity);
switchYZ(velocity);
#endif

// get the values to the USB HID driver to send if necessary
Expand Down

0 comments on commit cdf87f5

Please sign in to comment.