pwm_pin - Fix DutyCycle() parse error, need to trim off trailing '\n' before calling strconv.Atoi(), as other functions in this package do

This commit is contained in:
Chris Morgan 2019-01-24 10:23:37 -05:00 committed by Ron Evans
parent 515c4e8288
commit c3f4b1f6f8
1 changed files with 2 additions and 1 deletions

View File

@ -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
}