cmd/rv/main.go fix probe initialization

This commit is contained in:
Russell Stanley 2022-04-21 09:12:29 +09:30
parent 6dd32ea786
commit c58643e207
2 changed files with 6 additions and 6 deletions

View File

@ -146,6 +146,11 @@ func main() {
p *turbidityProbe p *turbidityProbe
) )
p, err := NewTurbidityProbe(*log, 60*time.Second)
if err != nil {
log.Log(logger.Fatal, "could not create new turbidity probe", "error", err.Error())
}
log.Log(logger.Debug, "initialising netsender client") log.Log(logger.Debug, "initialising netsender client")
ns, err := netsender.New(log, nil, readPin(p, rv, log), nil, createVarMap()) ns, err := netsender.New(log, nil, readPin(p, rv, log), nil, createVarMap())
if err != nil { if err != nil {
@ -158,11 +163,6 @@ func main() {
log.Log(logger.Fatal, pkg+"could not initialise revid", "error", err.Error()) log.Log(logger.Fatal, pkg+"could not initialise revid", "error", err.Error())
} }
p, err = NewTurbidityProbe(*log, 60*time.Second)
if err != nil {
log.Log(logger.Fatal, "could not create new turbidity probe", "error", err.Error())
}
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())

View File

@ -165,7 +165,7 @@ func (tp *turbidityProbe) Update(config config.Config) error {
return nil return nil
} }
} }
tp.log.Log(logger.Debug, "not update requried") tp.log.Log(logger.Debug, "no update requried")
return nil return nil
} }