mirror of https://bitbucket.org/ausocean/av.git
setup ticker
This commit is contained in:
parent
bdb44214a1
commit
0c6d9d0132
|
@ -11,6 +11,7 @@ AUTHORS
|
||||||
Jack Richardson <jack@ausocean.org>
|
Jack Richardson <jack@ausocean.org>
|
||||||
Trek Hopton <trek@ausocean.org>
|
Trek Hopton <trek@ausocean.org>
|
||||||
Scott Barnard <scott@ausocean.org>
|
Scott Barnard <scott@ausocean.org>
|
||||||
|
Russell Stanley <russell@ausocean.org>
|
||||||
|
|
||||||
LICENSE
|
LICENSE
|
||||||
Copyright (C) 2020 the Australian Ocean Lab (AusOcean)
|
Copyright (C) 2020 the Australian Ocean Lab (AusOcean)
|
||||||
|
@ -103,6 +104,7 @@ const (
|
||||||
profilePath = "rv.prof"
|
profilePath = "rv.prof"
|
||||||
pkg = "rv: "
|
pkg = "rv: "
|
||||||
runPreDelay = 20 * time.Second
|
runPreDelay = 20 * time.Second
|
||||||
|
turbidity
|
||||||
)
|
)
|
||||||
|
|
||||||
// Software define pin values.
|
// Software define pin values.
|
||||||
|
@ -122,6 +124,18 @@ type turbidityProbe struct {
|
||||||
|
|
||||||
// TODO(Russell): complete this implementation of Write.
|
// TODO(Russell): complete this implementation of Write.
|
||||||
func (tp *turbidityProbe) Write(p []byte) (int, error) {
|
func (tp *turbidityProbe) Write(p []byte) (int, error) {
|
||||||
|
|
||||||
|
ticker := time.NewTicker(500 * time.Millisecond)
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
for {
|
||||||
|
select {
|
||||||
|
case <-ticker.C:
|
||||||
|
|
||||||
|
// Implementation here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
return len(p), nil
|
return len(p), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,7 +187,7 @@ func main() {
|
||||||
|
|
||||||
err = rv.SetProbe(p)
|
err = rv.SetProbe(p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Log(logger.Error, pkg+"could not set probe","error",err.Error())
|
log.Log(logger.Error, pkg+"could not set probe", "error", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
// NB: Problems were encountered with communicating with RTSP inputs. When trying to
|
// NB: Problems were encountered with communicating with RTSP inputs. When trying to
|
||||||
|
|
Loading…
Reference in New Issue