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,
}
log.Println("before setup")
err := ret.setup()
log.Println("after setup")
return ret, err
}
@ -73,7 +71,6 @@ func (r *Device) readReg(addr byte) (byte, error) {
if err != nil {
log.Println(err)
}
//log.Printf("read %x: %x", addr, rx[1])
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
}
log.Println("start setup")
for data, err := r.readReg(REG_SYNCVALUE1); err == nil && data != 0xAA; data, err = r.readReg(REG_SYNCVALUE1) {
err := r.writeReg(REG_SYNCVALUE1, 0xAA)
if err != nil {

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

Loading…
Cancel
Save