File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -412,21 +412,26 @@ func (d *Device) Invert(invert bool) {
412412func (d * Device ) SetLUT (speed Speed , flickerFree bool ) error {
413413 var lut LUTSet
414414
415+ if speed == DEFAULT {
416+ return nil
417+ }
418+
415419 // Num. of frames for single direction change.
416420 period := 64
417- p := uint8 (period / (2 ^ (int (speed ) - 1 )))
421+ scale := 1 << (int (speed ) - 1 )
422+ p := uint8 (period / scale )
418423 if p < 1 {
419424 p = 1
420425 }
421426
422427 // Num. of frames for back-and-forth change.
423- hperiod := period % 2
424- hp := uint8 (hperiod / ( 2 ^ ( int ( speed ) - 1 )) )
428+ hperiod := period / 2
429+ hp := uint8 (hperiod / scale )
425430 if hp < 1 {
426431 hp = 1
427432 }
428433
429- if speed < FAST && ! flickerFree {
434+ if speed <= FAST && ! flickerFree {
430435 // For low speed everything is charge-neutral, even WB/BW.
431436
432437 // Phase 1: long go-inverted-color.
You can’t perform that action at this time.
0 commit comments