Reaktivate RX after received data
This commit is contained in:
parent
ec805e2772
commit
e541265f23
2 changed files with 15 additions and 4 deletions
|
@ -31,6 +31,7 @@ type Data struct {
|
|||
Data []byte
|
||||
RequestAck bool
|
||||
SendAck bool
|
||||
Rssi int
|
||||
}
|
||||
|
||||
// NewDevice creates a new device
|
||||
|
@ -388,5 +389,11 @@ func (r *Device) readFifo() (Data, error) {
|
|||
data.SendAck = bool(rx[2]&0x80 > 0)
|
||||
data.RequestAck = bool(rx[2]&0x40 > 0)
|
||||
data.Data = rx[3:]
|
||||
|
||||
data.Rssi, err = r.readRSSI(false)
|
||||
if err != nil {
|
||||
return data, err
|
||||
}
|
||||
|
||||
return data, nil
|
||||
}
|
||||
|
|
|
@ -72,10 +72,6 @@ func (r *Device) Loop() (chan Data, chan int) {
|
|||
log.Fatal(err)
|
||||
}
|
||||
case <-irq:
|
||||
err = r.SetMode(RF_OPMODE_STANDBY)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
data, err := r.readFifo()
|
||||
if err != nil {
|
||||
|
@ -94,6 +90,14 @@ func (r *Device) Loop() (chan Data, chan int) {
|
|||
}
|
||||
txChan <- resp
|
||||
}
|
||||
|
||||
rxChan <- data
|
||||
|
||||
err = r.SetMode(RF_OPMODE_RECEIVER)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
case <-quit:
|
||||
quit <- 1
|
||||
return
|
||||
|
|
Loading…
Add table
Reference in a new issue