mirror of https://bitbucket.org/ausocean/av.git
Use sliceUtils.ContainsString instead of stringInSlice.
This commit is contained in:
parent
41945c9868
commit
85c4c7857a
|
@ -35,6 +35,7 @@ import (
|
|||
"bitbucket.org/ausocean/av/device"
|
||||
"bitbucket.org/ausocean/av/revid/config"
|
||||
"bitbucket.org/ausocean/utils/logger"
|
||||
"bitbucket.org/ausocean/utils/sliceutils"
|
||||
)
|
||||
|
||||
// To indicate package when logging.
|
||||
|
@ -180,12 +181,12 @@ func (r *Raspivid) Set(c config.Config) error {
|
|||
c.Saturation = defaultRaspividSaturation
|
||||
}
|
||||
|
||||
if c.Exposure == "" || !stringInSlice(c.Exposure, ExposureModes[:]) {
|
||||
if c.Exposure == "" || !sliceutils.ContainsString(ExposureModes[:], c.Exposure) {
|
||||
errs = append(errs, errBadExposure)
|
||||
c.Exposure = defaultRaspividExposure
|
||||
}
|
||||
|
||||
if c.AutoWhiteBalance == "" || !stringInSlice(c.AutoWhiteBalance, AutoWhiteBalanceModes[:]) {
|
||||
if c.AutoWhiteBalance == "" || !sliceutils.ContainsString(AutoWhiteBalanceModes[:], c.AutoWhiteBalance) {
|
||||
errs = append(errs, errBadAutoWhiteBalance)
|
||||
c.AutoWhiteBalance = defaultRaspividAutoWhiteBalance
|
||||
}
|
||||
|
@ -277,13 +278,3 @@ func (r *Raspivid) Stop() error {
|
|||
}
|
||||
return r.out.Close()
|
||||
}
|
||||
|
||||
// stringInSlice returns true if want is in slice.
|
||||
func stringInSlice(want string, slice []string) bool {
|
||||
for _, s := range slice {
|
||||
if s == want {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue