Better Transmit

This commit is contained in:
Friedl Ulrich 2015-02-08 17:29:21 +01:00
parent 05637feaf5
commit b3a45db48a

View file

@ -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,6 +43,11 @@ func (r *Device) Loop() (chan Data, chan Data, chan int) {
log.Fatal(err)
}
err = r.writeReg(REG_DIOMAPPING1, RF_DIOMAPPING1_DIO0_00)
if err != nil {
log.Fatal(err)
}
err = r.writeFifo(&dataToTransmit)
if err != nil {
log.Fatal(err)
@ -49,11 +56,6 @@ func (r *Device) Loop() (chan Data, chan Data, chan int) {
log.Print("transmit")
log.Print(dataToTransmit)
err = r.writeReg(REG_DIOMAPPING1, RF_DIOMAPPING1_DIO0_00)
if err != nil {
log.Fatal(err)
}
err = r.SetMode(RF_OPMODE_TRANSMITTER)
if err != nil {
log.Fatal(err)