Skip to content

Commit

Permalink
Fix FastMag.
Browse files Browse the repository at this point in the history
  • Loading branch information
bemasher committed Sep 16, 2014
1 parent 659a8b3 commit 0092dd1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions decode/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ type PacketConfig struct {
PreambleLength, PacketLength int
BufferLength int
Preamble string

FastMag bool
}

func (cfg PacketConfig) Log() {
Expand Down Expand Up @@ -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.
Expand All @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions recv.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0092dd1

Please sign in to comment.