Skip to content

Commit

Permalink
pwm_pin - Fix DutyCycle() parse error, need to trim off trailing '\n'…
Browse files Browse the repository at this point in the history
… before calling strconv.Atoi(), as other functions in this package do
  • Loading branch information
chmorgan authored and deadprogram committed May 22, 2019
1 parent 515c4e8 commit c3f4b1f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sysfs/pwm_pin.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ func (p *PWMPin) DutyCycle() (duty uint32, err error) {
return
}

val, e := strconv.Atoi(string(buf))
v := bytes.TrimRight(buf, "\n")
val, e := strconv.Atoi(string(v))
return uint32(val), e
}

Expand Down

0 comments on commit c3f4b1f

Please sign in to comment.