Rename variable names for LED effects customs in the driver
Kanuan opened this issue · comments
Kanuan commented
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:
- LED starts off and stays off for ~16s
- (OffPeriodCycles * CycleDuration) = (0xFF * 0xFFFF)
- LED turns ON for ~16s
- (OffPeriodCycles * CycleDuration) = (0xFF * 0xFFFF)
- 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
Kanuan commented
I'm assuming it's counting clock ticks. Since I'm not sure maybe "ticks" should be replaces by something else
Kanuan commented
I think this would be more accurate:
TotalDuration
BasePortionDuration1
BasePortionDuration0
OffPortionMultiplier
OnPortionMultiplier
Benjamin Höglinger-Stelzer commented
This can be considered done, right?
Kanuan commented
Yes!