-
Notifications
You must be signed in to change notification settings - Fork 37
Simple triggers effects #71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
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
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed it
pydualsense/pydualsense.py
Outdated
| 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we please change the effects from string type to a enum?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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