From b3a45db48a784c77748f50b43938cf3301ae40e2 Mon Sep 17 00:00:00 2001 From: Friedl Ulrich Date: Sun, 8 Feb 2015 17:29:21 +0100 Subject: [PATCH] Better Transmit --- rfm69handler.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/rfm69handler.go b/rfm69handler.go index 2cbb2fa..98cffaa 100644 --- a/rfm69handler.go +++ b/rfm69handler.go @@ -30,7 +30,9 @@ func (r *Device) Loop() (chan Data, chan Data, chan int) { for { select { case dataToTransmit := <-txChan: - // can send? + // TODO: can send? + r.readWriteReg(REG_PACKETCONFIG2, 0xFB, RF_PACKET2_RXRESTART) // avoid RX deadlocks + err = r.SetMode(RF_OPMODE_STANDBY) if err != nil { log.Fatal(err) @@ -41,19 +43,19 @@ func (r *Device) Loop() (chan Data, chan Data, chan int) { log.Fatal(err) } - err = r.writeFifo(&dataToTransmit) + err = r.writeReg(REG_DIOMAPPING1, RF_DIOMAPPING1_DIO0_00) if err != nil { log.Fatal(err) } - log.Print("transmit") - log.Print(dataToTransmit) - - err = r.writeReg(REG_DIOMAPPING1, RF_DIOMAPPING1_DIO0_00) + err = r.writeFifo(&dataToTransmit) if err != nil { log.Fatal(err) } + log.Print("transmit") + log.Print(dataToTransmit) + err = r.SetMode(RF_OPMODE_TRANSMITTER) if err != nil { log.Fatal(err)