xtrinch / sx127x-node-driver

Node.js driver for Semtech SX1276/77/78/79 LoRa circuits
MIT License
10 stars 6 forks source link

setCodingRate logic incorrect #3

Closed rgillan closed 4 years ago

rgillan commented 4 years ago

Hello, I raised this on node-sx127x a few years back and is the same issue here. The logic to determine coding rate is incorrect, it should be:

if (cr <= (4/8)) { denominator = 8; } else if (cr <= (4/7)) { denominator = 7; } else if (cr <= (4/6)) { denominator = 6; } else { denominator = 5; }

xtrinch commented 4 years ago

You're right it's in wrong order, fixed in #174180d, thanks!