adjusted logs; fixed typo

This commit is contained in:
Giovanni Harting 2019-05-05 22:17:27 +02:00
parent eb2a0e7a98
commit 6d99ade955
2 changed files with 4 additions and 4 deletions

View File

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

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
}