Fix error handling

master
Friedl Ulrich 9 years ago
parent d939a19efc
commit 582954a052

@ -20,8 +20,7 @@ func (r *Device) loop() {
err := r.SetMode(RF_OPMODE_RECEIVER) err := r.SetMode(RF_OPMODE_RECEIVER)
if err != nil { if err != nil {
log.Print(err) log.Fatal(err)
return
} }
defer r.SetMode(RF_OPMODE_STANDBY) defer r.SetMode(RF_OPMODE_STANDBY)
@ -67,15 +66,14 @@ func (r *Device) loop() {
} }
flags, err := r.readReg(REG_IRQFLAGS2) flags, err := r.readReg(REG_IRQFLAGS2)
if err != nil { if err != nil {
return log.Fatal(err)
} }
if flags&RF_IRQFLAGS2_PAYLOADREADY == 0 { if flags&RF_IRQFLAGS2_PAYLOADREADY == 0 {
continue continue
} }
data, err := r.readFifo() data, err := r.readFifo()
if err != nil { if err != nil {
log.Print(err) log.Fatal(err)
return
} }
if r.OnReceive != nil { if r.OnReceive != nil {
go r.OnReceive(&data) go r.OnReceive(&data)

Loading…
Cancel
Save