adjusted logs; fixed typo
This commit is contained in:
2
main.go
2
main.go
@@ -188,5 +188,5 @@ func main() {
|
|||||||
keys = append(keys, int(c))
|
keys = append(keys, int(c))
|
||||||
}
|
}
|
||||||
|
|
||||||
pca9685.SwichOff(keys)
|
pca9685.SwitchOff(keys)
|
||||||
}
|
}
|
||||||
|
@@ -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 {
|
if !p.initiated {
|
||||||
return errors.New(fmt.Sprintf("Device \"%v\"is not initiated!", p.name))
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PCA9685) SwichOff(pwm []int) error {
|
func (p *PCA9685) SwitchOff(pwm []int) error {
|
||||||
if !p.initiated {
|
if !p.initiated {
|
||||||
return errors.New(fmt.Sprintf("Device \"%v\"is not initiated!", p.name))
|
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))
|
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.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
|
return nil
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user