nefarius / DsHidMini

Virtual HID Mini-user-mode-driver for Sony DualShock 3 Controllers

Home Page:https://docs.nefarius.at/projects/DsHidMini/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rename variable names for LED effects customs in the driver

Kanuan opened this issue · comments

Apparently this is incorrect for how LED effects work:

1st byte -> Duration
2nd byte -> IntervalDuration
3rd byte -> EnableEffects (0x10 -> ON // 0x00 -> off)
4th byte -> Interval OFF
5th byte -> Interval ON

The correct seems to be:

- 1st byte: Duration
    - 0 = effect is off
    - 0xFE = effect runs for ~5s then LED is turned off
    - 0xFF = effect repeats forever
- 2nd AND 3rd byte: Cycle duration
    - Cycle duration is probably (ClockTicks * tick duration) 
- 4th byte: Off period cycles
- 5th byte: On period cycles

The effect the goes like this:

OffPeriodCycles * CycleDuration + OffPeriodCycles * CycleDuration

Example: by setting everything to the max (0xFF) we have:

  1. LED starts off and stays off for ~16s
    • (OffPeriodCycles * CycleDuration) = (0xFF * 0xFFFF)
  2. LED turns ON for ~16s
    • (OffPeriodCycles * CycleDuration) = (0xFF * 0xFFFF)
  3. Repeat forever

Based on this, at max cycle duration (0xFFFF), the On/Off period durations will be ~1s for 0x10, ~2s to 0x20 and so forth.

Based on this, I recommend renaming dshidmini driver's fields related to led customs to:

1st byte -> Duration
2nd byte -> CycleDuration1
3rd byte -> CycleDuration0
4th byte -> OffPeriodCycles
5th byte -> OnPeriodCycles

I'm assuming it's counting clock ticks. Since I'm not sure maybe "ticks" should be replaces by something else

I think this would be more accurate:

TotalDuration
BasePortionDuration1
BasePortionDuration0
OffPortionMultiplier
OnPortionMultiplier

This can be considered done, right?

Yes!