Closed jarosz closed 7 years ago
Looks good, and looks safe! :) Thanks for the contribution.
Could you tell me where does rxWindowWidth take its value from?
Hehe... umm it depends on the microgriffage factor of the selected baud rate.
IIRC, it is a fudge factor that has two purposes: it is a fixed-point fractional addition to the bit time(s) that effectively rounds the division result (actually a multiply); and it helps accommodate the interrupt dispatch time that happens for each bit change (0-to-1 or 1-to-0). Rather than go with a "tuned" calculation that may be processor/clock/compiler version depending, I added a SWAG until it worked reliably. :( It may be susceptible to compiler version, but I do not "expect" much change in the dispatch time. (I may have jinxed myself by saying that...)
I assumed it wouldn't work on 8MHz, so there is fallback to 19200.
I guessed the value of rxWindowWidth - it works for me, but I don't know the formula to calculate it.