cmd/revid-cli: made Revid global so that revid.Bitrate() can be accessed in readPin

This commit is contained in:
saxon 2019-02-12 10:39:23 +10:30
parent f67fb1ec8a
commit 4e1c8e7c45
1 changed files with 6 additions and 4 deletions

View File

@ -75,6 +75,8 @@ var canProfile = true
// The logger that will be used throughout
var log *logger.Logger
var rv *revid.Revid
const (
metaPreambleKey = "copyright"
metaPreambleData = "ausocean.org/license/content2019"
@ -87,9 +89,9 @@ func main() {
runDurationPtr := flag.Duration("runDuration", defaultRunDuration, "How long do you want revid to run for?")
cfg := handleFlags()
var err error
if !*useNetsender {
rv, err := revid.New(cfg, nil)
rv, err = revid.New(cfg, nil)
if err != nil {
cfg.Logger.Log(logger.Fatal, pkg+"failed to initialiase revid", "error", err.Error())
}
@ -276,7 +278,7 @@ func run(cfg revid.Config) error {
vars, _ = ns.Vars()
vs := ns.VarSum()
rv, err := revid.New(cfg, ns)
rv, err = revid.New(cfg, ns)
if err != nil {
log.Log(logger.Fatal, pkg+"could not initialise revid", "error", err.Error())
}
@ -358,7 +360,7 @@ func run(cfg revid.Config) error {
func readPin(pin *netsender.Pin) error {
switch {
case pin.Name == "X23":
//pin.Value = rv.Bitrate()
pin.Value = rv.Bitrate()
case pin.Name[0] == 'X':
return sds.ReadSystem(pin)
default: