Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix raspi PWMPin.SetDutyCycle #800

Merged
merged 2 commits into from
Apr 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions platforms/raspi/pwm_pin.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@ func (p *PWMPin) SetDutyCycle(duty uint32) (err error) {
p.dc = duty

val := gobot.FromScale(float64(p.dc), 0, float64(p.period))

// never go below minimum allowed duty for pi blaster
if val < 0.05 {
// unless the duty equals to 0
if val < 0.05 && val != 0 {
val = 0.05
}
return p.piBlaster(fmt.Sprintf("%v=%v\n", p.pin, val))
Expand Down