Reading RSSI before data

master
Friedl Ulrich 10 years ago
parent e9326a1e33
commit 789dc3ba73

@ -360,7 +360,14 @@ func (r *Device) writeFifo(data *Data) error {
}
func (r *Device) readFifo() (Data, error) {
var err error
data := Data{}
data.Rssi, err = r.readRSSI(false)
if err != nil {
return data, err
}
tx := new([67]byte)
tx[0] = REG_FIFO & 0x7f
rx, err := r.SpiDevice.Xfer(tx[:3])
@ -384,10 +391,5 @@ func (r *Device) readFifo() (Data, error) {
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
}

Loading…
Cancel
Save