cmd/rv/main.go: updating bitrate pin and using const

This commit is contained in:
Saxon Nelson-Milton 2021-09-20 17:59:51 +09:30
parent 7a265335f4
commit eafc0179c3
1 changed files with 3 additions and 2 deletions

View File

@ -103,6 +103,7 @@ const (
profilePath = "rv.prof" profilePath = "rv.prof"
pkg = "rv: " pkg = "rv: "
runPreDelay = 20 * time.Second runPreDelay = 20 * time.Second
bitratePin = "X36"
) )
// This is set to true if the 'profile' build tag is provided on build. // This is set to true if the 'profile' build tag is provided on build.
@ -269,11 +270,11 @@ func sleep(ns *netsender.Sender, l *logger.Logger) {
} }
// readPin provides a callback function of consistent signature for use by // readPin provides a callback function of consistent signature for use by
// netsender to retrieve software defined pin values e.g. revid bitrate (X23). // netsender to retrieve software defined pin values e.g. revid bitrate.
func readPin(rv *revid.Revid) func(pin *netsender.Pin) error { func readPin(rv *revid.Revid) func(pin *netsender.Pin) error {
return func(pin *netsender.Pin) error { return func(pin *netsender.Pin) error {
switch { switch {
case pin.Name == "X23": case pin.Name == bitratePin:
pin.Value = -1 pin.Value = -1
if rv != nil { if rv != nil {
pin.Value = rv.Bitrate() pin.Value = rv.Bitrate()