JP_STRICT: dynamic MAX_TEXT_LEN based on runtime CR value

Instead of compile-time LORA_CR define, MAX_TEXT_LEN is now determined
at runtime by reading the actual coding rate from the radio hardware.

Added getMaxTextLen() to RadioLibWrapper and Dispatcher:
- CR4/5: 48 bytes (~16 JP chars, TX ~3808ms)
- CR4/6: 32 bytes (~10 JP chars)
- CR4/7: 24 bytes (~8 JP chars)
- CR4/8: 16 bytes (~5 JP chars, default)

getCodingRate() added to CustomSX1262Wrapper to read codingRate
from RadioLib PhysicalLayer at runtime.

Tested: 48-byte limit with LORA_CR=5, 16-byte limit with LORA_CR=8.
This commit is contained in:
jirogit 2026-03-26 00:29:36 -07:00
parent eb58523775
commit c5bacd7de9
5 changed files with 30 additions and 21 deletions

View file

@ -38,6 +38,10 @@ public:
virtual float packetScore(float snr, int packet_len) = 0;
#ifdef JP_STRICT
virtual int getMaxTextLen() const { return 1 * 16; } // default: CR4/8
#endif
/**
* \brief starts the raw packet send. (no wait)
* \param bytes the raw packet data