From d8fefc0930d9bd2d085e308cc4c87b7cc4217ba5 Mon Sep 17 00:00:00 2001 From: Russell Stanley Date: Tue, 8 Feb 2022 11:20:20 +1030 Subject: [PATCH] split turbidity probe declaration --- cmd/rv/main.go | 9 --------- cmd/rv/probe.go | 8 ++++++++ cmd/rv/probe_circleci.go | 9 ++++++--- turbidity/turbidity.go | 3 +++ 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/cmd/rv/main.go b/cmd/rv/main.go index ba5b6b55..817a0e18 100644 --- a/cmd/rv/main.go +++ b/cmd/rv/main.go @@ -67,7 +67,6 @@ import ( "bitbucket.org/ausocean/av/container/mts/meta" "bitbucket.org/ausocean/av/revid" "bitbucket.org/ausocean/av/revid/config" - "bitbucket.org/ausocean/av/turbidity" "bitbucket.org/ausocean/iot/pi/netlogger" "bitbucket.org/ausocean/iot/pi/netsender" "bitbucket.org/ausocean/iot/pi/sds" @@ -118,14 +117,6 @@ const ( // This is set to true if the 'profile' build tag is provided on build. var canProfile = false -type turbidityProbe struct { - sharpness, contrast float64 - delay time.Duration - ticker time.Ticker - ts *turbidity.TurbiditySensor - log logger.Logger -} - func main() { mts.Meta = meta.NewWith([][2]string{{metaPreambleKey, metaPreambleData}}) diff --git a/cmd/rv/probe.go b/cmd/rv/probe.go index ac4a90a3..d58d92d9 100644 --- a/cmd/rv/probe.go +++ b/cmd/rv/probe.go @@ -52,6 +52,14 @@ const ( maxImages = 10 // Max number of images read when evaluating turbidity. ) +type turbidityProbe struct { + sharpness, contrast float64 + delay time.Duration + ticker time.Ticker + ts *turbidity.TurbiditySensor + log logger.Logger +} + // NewTurbidityProbe returns a new turbidity probe. func NewTurbidityProbe(log logger.Logger, delay time.Duration) (*turbidityProbe, error) { tp := new(turbidityProbe) diff --git a/cmd/rv/probe_circleci.go b/cmd/rv/probe_circleci.go index a63e6e77..26175f3b 100644 --- a/cmd/rv/probe_circleci.go +++ b/cmd/rv/probe_circleci.go @@ -35,14 +35,17 @@ import ( "bitbucket.org/ausocean/utils/logger" ) -// NewTurbidityProbe returns a new turbidity probe. +type turbidityProbe struct { + sharpness, contrast float64 +} + +// NewTurbidityProbe returns a empty turbidity probe for CircleCI testing only. func NewTurbidityProbe(log logger.Logger, delay time.Duration) (*turbidityProbe, error) { tp := new(turbidityProbe) return tp, nil } -// Write, reads input h264 frames in the form of a byte stream and writes the the sharpness and contrast -// scores of a video to the the turbidity probe. +// Write performs no operation for CircleCI testing only. func (tp *turbidityProbe) Write(p []byte) (int, error) { return len(p), nil } diff --git a/turbidity/turbidity.go b/turbidity/turbidity.go index 8456e174..75eac3d6 100644 --- a/turbidity/turbidity.go +++ b/turbidity/turbidity.go @@ -1,3 +1,6 @@ +//go:build !nocv +// +build !nocv + /* DESCRIPTION Holds the turbidity sensor struct. Can evaluate 4x4 chessboard markers in an