master
Friedl Ulrich 10 years ago
parent 789dc3ba73
commit 80a4e9945f

@ -46,9 +46,7 @@ func NewDevice(spi *spidev.SPIDevice, gpio gpio.Pin, nodeID, networkID byte, isR
powerLevel: 31, powerLevel: 31,
} }
log.Println("before setup")
err := ret.setup() err := ret.setup()
log.Println("after setup")
return ret, err return ret, err
} }
@ -73,7 +71,6 @@ func (r *Device) readReg(addr byte) (byte, error) {
if err != nil { if err != nil {
log.Println(err) log.Println(err)
} }
//log.Printf("read %x: %x", addr, rx[1])
return rx[1], err return rx[1], err
} }
@ -118,7 +115,6 @@ func (r *Device) setup() error {
/* 0x6F */ {REG_TESTDAGC, RF_DAGC_IMPROVED_LOWBETA0}, // run DAGC continuously in RX mode for Fading Margin Improvement, recommended default for AfcLowBetaOn=0 /* 0x6F */ {REG_TESTDAGC, RF_DAGC_IMPROVED_LOWBETA0}, // run DAGC continuously in RX mode for Fading Margin Improvement, recommended default for AfcLowBetaOn=0
} }
log.Println("start setup")
for data, err := r.readReg(REG_SYNCVALUE1); err == nil && data != 0xAA; data, err = r.readReg(REG_SYNCVALUE1) { for data, err := r.readReg(REG_SYNCVALUE1); err == nil && data != 0xAA; data, err = r.readReg(REG_SYNCVALUE1) {
err := r.writeReg(REG_SYNCVALUE1, 0xAA) err := r.writeReg(REG_SYNCVALUE1, 0xAA)
if err != nil { if err != nil {

@ -16,7 +16,6 @@ func (r *Device) Loop() (chan Data, chan Data, chan int) {
irq := make(chan int) irq := make(chan int)
r.gpio.BeginWatch(gpio.EdgeRising, func() { r.gpio.BeginWatch(gpio.EdgeRising, func() {
log.Print("irq")
irq <- 1 irq <- 1
}) })
@ -53,8 +52,7 @@ func (r *Device) Loop() (chan Data, chan Data, chan int) {
log.Fatal(err) log.Fatal(err)
} }
log.Print("transmit") log.Print("transmit", dataToTransmit)
log.Print(dataToTransmit)
err = r.SetMode(RF_OPMODE_TRANSMITTER) err = r.SetMode(RF_OPMODE_TRANSMITTER)
if err != nil { if err != nil {
@ -101,8 +99,7 @@ func (r *Device) Loop() (chan Data, chan Data, chan int) {
return return
} }
log.Print("receive") log.Print("receive", data)
log.Print(data)
if data.ToAddress != 255 && data.RequestAck { if data.ToAddress != 255 && data.RequestAck {
resp := Data{ resp := Data{

Loading…
Cancel
Save