jeelabs / jeelib

JeeLib for Arduino IDE: Ports, RF12, and RF69 drivers from JeeLabs
https://jeelabs.org/202x/sw/jeelib/
The Unlicense
490 stars 215 forks source link

Adjust FSM handling of non-broadcast #77

Closed JohnOH closed 8 years ago

JohnOH commented 9 years ago

Depending on how the calling sketch uses rf12_recvDone and thence rf69::recvDone_compat. It is possible to stall in TXIDLE after a uninteresting non-broadcast packet is delay discarded rather than discarded immediatley.

jcw commented 9 years ago

I've merged a somewhat altered version of this code - I think the whole problem can be ascribed to "rxstate = TXIDLE" being set too late in the "case TXRECV:" branch of the switch.

JohnOH commented 9 years ago

Does this not have the same problem outcome for rf12_canSend() since the packet isn't fully discarded until a call into rf12_recvdone happens. I think this code still has the stall..

jcw commented 9 years ago

Ah, I see your point. But hasn't this always been the case: when recvDone returns true, you get a brief hold on the data, and things resume on the next recvDone call. The RF12 code is written under the assumption of lots of polling to keep the FSM moving.

Hm.. need to think more about this, am re-opening this for now.

JohnOH commented 9 years ago

Yes, I think it has always been the case but I don't think it needs to be. Once it comes out of TXRECV it has to deliver something because rxfill != 0 if nothing else.