reduce max frames

This commit is contained in:
Russell Stanley 2022-02-03 16:28:28 +10:30
parent 014230a274
commit 6505223782
1 changed files with 5 additions and 3 deletions

View File

@ -107,7 +107,7 @@ const (
profilePath = "rv.prof"
pkg = "rv: "
runPreDelay = 20 * time.Second
maxImages = 10 // Max number of images read when evaluating turbidity.
maxImages = 1 // Max number of images read when evaluating turbidity.
)
// Software define pin values.
@ -189,12 +189,14 @@ func (tp *turbidityProbe) Write(p []byte) (int, error) {
imgs = append(imgs, img.Clone())
}
if len(imgs) <= 0 {
tp.log.Log(logger.Info, "no frames found")
tp.log.Log(logger.Warning, "no frames found", "error", err.Error())
return len(p), nil
}
tp.log.Log(logger.Debug, "found frames", "frames", len(imgs))
// Process video data to get saturation and contrast scores.
res, err := tp.ts.Evaluate(imgs)
tp.log.Log(logger.Debug, "finished evaluation")
if err != nil {
tp.log.Error("evaluate failed", "error", err.Error())
return len(p), err
@ -240,7 +242,7 @@ func main() {
rv *revid.Revid
p *turbidityProbe
)
p, err := NewTurbidityProbe(*log, 60*time.Second)
p, err := NewTurbidityProbe(*log, 120*time.Second)
log.Log(logger.Debug, "initialising netsender client")
ns, err := netsender.New(log, nil, readPin(p, rv, log), nil, createVarMap())