treat: nil read pin and add debug logging

This commit is contained in:
Trek H 2020-09-10 13:06:22 +09:30
parent a2e0b63f8b
commit 0646c36491
1 changed files with 6 additions and 3 deletions

View File

@ -62,7 +62,7 @@ const (
logMaxSize = 500 // MB logMaxSize = 500 // MB
logMaxBackup = 10 logMaxBackup = 10
logMaxAge = 28 // days logMaxAge = 28 // days
logVerbosity = logger.Info logVerbosity = logger.Debug
logSuppress = true logSuppress = true
) )
@ -113,14 +113,14 @@ func main() {
// The netsender client will handle communication with netreceiver and GPIO stuff. // The netsender client will handle communication with netreceiver and GPIO stuff.
log.Log(logger.Debug, "initialising netsender client") log.Log(logger.Debug, "initialising netsender client")
ns, err := netsender.New(log, gpio.InitPin, gpio.ReadPin, gpio.WritePin, varMap) ns, err := netsender.New(log, gpio.InitPin, nil, gpio.WritePin, varMap)
if err != nil { if err != nil {
log.Log(logger.Fatal, "could not initialise netsender client", "error", err.Error()) log.Log(logger.Fatal, "could not initialise netsender client", "error", err.Error())
} }
// Revid will handle the recording and sending of audio for sound checking. // Revid will handle the recording and sending of audio for sound checking.
log.Log(logger.Debug, "initialising revid") log.Log(logger.Debug, "initialising revid")
rv, err := revid.New(config.Config{Logger: log}, ns) rv, err := revid.New(config.Config{Logger: log, LogLevel: logger.Debug}, ns)
if err != nil { if err != nil {
log.Log(logger.Fatal, "could not initialise revid", "error", err.Error()) log.Log(logger.Fatal, "could not initialise revid", "error", err.Error())
} }
@ -208,6 +208,9 @@ func run(rv *revid.Revid, ns *netsender.Sender, file *string, l *logger.Logger,
sleep(ns, l) sleep(ns, l)
continue continue
} }
default:
l.Log(logger.Warning, "mode is not valid", "mode", ns.Mode())
} }
l.Log(logger.Info, "revid updated with new mode") l.Log(logger.Info, "revid updated with new mode")
sleep(ns, l) sleep(ns, l)