RadioLib icon indicating copy to clipboard operation
RadioLib copied to clipboard

Limit copy-paste by moving common functionality to PhysicaLayer class

Open jgromes opened this issue 3 months ago • 1 comments

We are starting to accumulate some copy-pasted code, which is prone to mistakes and is hard to maintain. We should think a bit about how to limit this, preferrably by exploiting the existing abstraction in PhysicaLayer.

List of items (non-exhaustive and will be added to):

  • [ ] setDataRate in module classes - repeating check for modem configuration

jgromes avatar Sep 20 '25 08:09 jgromes

When working on the calculateTimeOnAir() function, I also wondered about this. Since LoRa packets are compatible between radios, they should also produce the same results given the same settings. Semtech’s calculator also shows this and the methods for SX126x and LR11x0 are already (largely) the same. The only thing that might actually be different is sub-GHz versus 2.4GHz LoRa, but this can be considered a different "modem".

GUVWAF avatar Sep 20 '25 10:09 GUVWAF