Skip to content

Conversation

@amerca9664
Copy link

@amerca9664 amerca9664 commented Jun 4, 2025

Hi a added 3 simple effects and an example to use:

  • rigid
  • weapon
  • vibration

I got the information from yesbotics https://github.com/yesbotics/dualsense-controller-python/blob/main/research/ADAPTIVE_TRIGGER_EFFECTS.md

flok and others added 5 commits May 30, 2025 00:43
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>
Copy link
Owner

@flok flok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed it

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
Copy link
Owner

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?

Copy link
Author

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

@amerca9664 amerca9664 requested a review from flok June 8, 2025 17:27
@flok flok changed the base branch from master to dev November 5, 2025 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants