Open
Conversation
Add dialsense edge support + analog trigger reading
Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.5 to 3.1.6. - [Release notes](https://github.com/pallets/jinja/releases) - [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst) - [Commits](pallets/jinja@3.1.5...3.1.6) --- updated-dependencies: - dependency-name: jinja2 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com>
flok
requested changes
Jun 8, 2025
pydualsense/pydualsense.py
Outdated
Comment on lines
971
to
1000
| match effect: | ||
| case 'vibration': | ||
| self.mode = TriggerModes.Pulse_AB | ||
| self.forces[0] = 255 | ||
| self.forces[1] = 3 | ||
| self.forces[2] = 255 | ||
| self.forces[3] = 255 | ||
| self.forces[4] = 255 | ||
| self.forces[5] = 63 | ||
| self.forces[6] = 15 | ||
| case 'weapon': | ||
| self.mode = TriggerModes.Rigid_AB | ||
| self.forces[0] = 36 | ||
| self.forces[1] = 0 | ||
| self.forces[2] = 7 | ||
| self.forces[3] = 0 | ||
| self.forces[4] = 0 | ||
| self.forces[5] = 0 | ||
| self.forces[6] = 0 | ||
| case 'rigid': | ||
| self.mode = TriggerModes.Rigid | ||
| self.forces[0] = 0 | ||
| self.forces[1] = 255 | ||
| self.forces[2] = 0 | ||
| self.forces[3] = 0 | ||
| self.forces[4] = 0 | ||
| self.forces[5] = 0 | ||
| self.forces[6] = 0 | ||
| case _: | ||
| self.mode = TriggerModes.Off |
Owner
There was a problem hiding this comment.
Could we please change the effects from string type to a enum?
Author
There was a problem hiding this comment.
Done, i think now it is easier add new effects in the future:
class TriggersEffects(Enum):
VIBRATION = (TriggerModes.Pulse_AB, [255, 3, 255, 255, 255, 63, 15])
WEAPON = (TriggerModes.Rigid_AB, [36, 0, 7, 0, 0, 0, 0])
RIGID = (TriggerModes.Rigid, [0, 255, 0, 0, 0, 0, 0])
OFF = (TriggerModes.Off, [0] * 7)
Also reduce code
def setEffect(self, effect: TriggersEffects) -> None:
"""
Select effect
"""
if not isinstance(effect, TriggersEffects):
raise TypeError("Triggers effects parameter needs to be of type 'TriggersEffects'")
self.mode, self.forces = effect.value
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi a added 3 simple effects and an example to use:
I got the information from yesbotics https://github.com/yesbotics/dualsense-controller-python/blob/main/research/ADAPTIVE_TRIGGER_EFFECTS.md