Browse Source

adjusted logs; fixed typo

master
Giovanni Harting 1 year ago
parent
commit
6d99ade955
2 changed files with 4 additions and 4 deletions
  1. +1
    -1
      main.go
  2. +3
    -3
      pca9685.go

+ 1
- 1
main.go View File

@@ -188,5 +188,5 @@ func main() {
keys = append(keys, int(c))
}

pca9685.SwichOff(keys)
pca9685.SwitchOff(keys)
}

+ 3
- 3
pca9685.go View File

@@ -98,7 +98,7 @@ func (p *PCA9685) Init() {
}
}

func (p *PCA9685) SwichOn(pwm []int) error {
func (p *PCA9685) SwitchOn(pwm []int) error {
if !p.initiated {
return errors.New(fmt.Sprintf("Device \"%v\"is not initiated!", p.name))
}
@@ -111,7 +111,7 @@ func (p *PCA9685) SwichOn(pwm []int) error {
return nil
}

func (p *PCA9685) SwichOff(pwm []int) error {
func (p *PCA9685) SwitchOff(pwm []int) error {
if !p.initiated {
return errors.New(fmt.Sprintf("Device \"%v\"is not initiated!", p.name))
}
@@ -180,8 +180,8 @@ func (pwm *Pwm) setPercentage(percentage float32) error {
return errors.New(fmt.Sprintf("Percentage must be between 0.0 and 100.0. Got %v.", percentage))
}

pwm.pca.log.Info(fmt.Sprintf("Setting pwm #%v to %v%% (%v) at \"%v\" device.", pwm.pin, percentage, uint16((percentage/100)*float32(pwm.pca.maxPulse)), pwm.pca.name))
pwm.pca.setPwm(pwm.pin, 0, uint16((percentage/100)*float32(pwm.pca.maxPulse)))
pwm.pca.log.Info(fmt.Sprintf("Setting pwm #%v to %v%% (%v) at \"%v\" device.", pwm.pin, percentage, uint16((percentage/100)*float32(pwm.pca.maxPulse)), pwm.pca.name))

return nil
}

Loading…
Cancel
Save