diff --git a/decode/decode.go b/decode/decode.go index 28097037a..f8896279d 100644 --- a/decode/decode.go +++ b/decode/decode.go @@ -33,8 +33,6 @@ type PacketConfig struct { PreambleLength, PacketLength int BufferLength int Preamble string - - FastMag bool } func (cfg PacketConfig) Log() { @@ -67,7 +65,7 @@ type Decoder struct { } // Create a new decoder with the given packet configuration. -func NewDecoder(cfg PacketConfig) (d Decoder) { +func NewDecoder(cfg PacketConfig, fastMag bool) (d Decoder) { d.Cfg = cfg // Allocate necessary buffers. @@ -78,7 +76,7 @@ func NewDecoder(cfg PacketConfig) (d Decoder) { d.csum = make([]float64, d.Cfg.BlockSize+d.Cfg.SymbolLength2+1) // Calculate magnitude lookup table specified by -fastmag flag. - if cfg.FastMag { + if fastMag { d.lut = NewAlphaMaxBetaMinLUT() } else { d.lut = NewSqrtMagLUT() diff --git a/recv.go b/recv.go index bcd36daf0..e65509513 100644 --- a/recv.go +++ b/recv.go @@ -49,10 +49,10 @@ type Receiver struct { func (rcvr *Receiver) NewReceiver() { switch strings.ToLower(*msgType) { case "scm": - rcvr.d = decode.NewDecoder(NewSCMPacketConfig(*symbolLength)) + rcvr.d = decode.NewDecoder(NewSCMPacketConfig(*symbolLength), *fastMag) rcvr.p = NewSCMParser() case "idm": - rcvr.d = decode.NewDecoder(NewIDMPacketConfig(*symbolLength)) + rcvr.d = decode.NewDecoder(NewIDMPacketConfig(*symbolLength), *fastMag) rcvr.p = NewIDMParser() default: log.Fatalf("Invalid message type: %q\n", *msgType)