fix(llcc68): align airtime estimate with radio config

Calculate LoRa airtime from the exact LDRO value supplied to SetModulationParams instead of inferring it from symbol time.

Keep transmit_result airtime in microseconds for both LoRa and GFSK, using integer Hz math and 64-bit ceil division to avoid truncation errors.

Reapply modulation parameters during async TX flush so the estimator and the bytes sent to the radio stay in sync, and add a compile-time check for the intended SF7/BW125 implicit 6-byte airtime.
This commit is contained in:
2026-05-25 12:54:15 +08:00
parent d8db9e1eb0
commit 32a0c80ab0
3 changed files with 86 additions and 33 deletions
+5 -4
View File
@@ -41,12 +41,13 @@ constexpr auto DEFAULT_BUSY_TIMEOUT_MS = 100;
* @param preamble_length Preamble length in symbols
* @param header_type Header type (implicit or explicit).
* @param crc_type CRC type (none or 16-bit)
* @param ldro_on Low data rate optimization setting sent to the radio
*/
constexpr airtime_t calc_time_on_air(uint8_t len, uint8_t sf, LoRaBandwidth bw,
LoRaCodingRate cr,
uint16_t preamble_length,
LoRaHeaderType header_type,
LoRaCrcType crc_type);
LoRaCodingRate cr,
uint16_t preamble_length,
LoRaHeaderType header_type,
LoRaCrcType crc_type, bool ldro_on);
struct LLCC68 {
/** trivial getter */
+2 -2
View File
@@ -14,7 +14,7 @@
namespace app::driver::llcc68 {
struct LLCC68;
using airtime_t = std::chrono::duration<uint32_t, std::micro>;
using airtime_t = std::chrono::microseconds;
using error_code = std::error_code;
enum class Errc : uint8_t {
@@ -1097,7 +1097,7 @@ struct transmit_result {
error_code post_action();
LLCC68 *self{};
std::chrono::milliseconds airtime_estimated;
airtime_t airtime_estimated;
};
} // namespace app::driver::llcc68