-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Calculate airtime of transmitted and received packets separately #8205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Separates airtime calculation for transmitted vs received LoRa packets, leveraging RadioLib 7.3.0 header introspection for dynamic coding rate and CRC differences. Refactors packet time logic to be virtual, improves preamble timing accuracy, and removes cached max packet time in favor of on-demand calculation.
- Add received-aware getPacketTime(...) API (now pure virtual) across radio interface implementations
- Use RadioLib calculateTimeOnAir with actual received header parameters (coding rate, CRC) for RX airtime
- Refine preamble time calculation to only include actual preamble symbols (exclude header portion)
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/platform/portduino/SimRadio.h | Adds override for new getPacketTime signature. |
src/platform/portduino/SimRadio.cpp | Adapts calls to new API; adds local getPacketTime implementation. |
src/mesh/SX128xInterface.h | Implements getPacketTime via shared computePacketTime helper. |
src/mesh/SX126xInterface.h | Implements getPacketTime via shared computePacketTime helper. |
src/mesh/ReliableRouter.cpp | Updates airtime adjustment to use received-aware packet time. |
src/mesh/RadioLibInterface.h | Introduces computePacketTime templated helper using RadioLib header info. |
src/mesh/RadioLibInterface.cpp | Updates receive detection logic and RX interrupt handling to use new timing. |
src/mesh/RadioInterface.h | Makes getPacketTime(uint32_t, ...) pure virtual; updates overloads. |
src/mesh/RadioInterface.cpp | Removes old generic time-on-air calculation; updates preamble timing computation. |
src/mesh/RF95Interface.h | Implements getPacketTime via computePacketTime. |
src/mesh/LR11x0Interface.h | Implements getPacketTime via computePacketTime. |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
* Create channel-mute toggle function * Added mute state to channel settings * Create node-mute toggle functions * Added mute state to nodedb entries * Rebase protos * Decouple protobuf changes * Disable bell-invoked ext notifs for muted nodes * Clearly dilineate module mute from sender or channel mute * Disable bell-invoked ext notifs for muted channels * Trunk fmt * Disable message-invoked ext notifs for muted channels and nodes * Disable on-screen 'new message' popup for muted nodes and channels * Don't mute alerts * Make use of pre-existing channel_settings.module_settings.is_client_muted setting * Revert previous commit - this needs it's own proto * Regen protos * T-Lora Pager: Interrupt based rotary encoder * T-Lora Pager: Fix amplifier fuzzing/popping * Fix build for other variants * Fix - reference actual channel when changing settings * Update protos * Refactor ref syntax * Fix defines * Update comments and remove unused function * Regen protos * Regen protobuffs again * Fix build failure in ci, add missing argument * Format * InputPollable: System for polling after interrupts * T-Lora Pager: Use InputPollable for RotaryEncoderImpl * Rename RotaryEncoderImpl to TLoraPagerRotaryEncoder * Revert "Rename RotaryEncoderImpl to TLoraPagerRotaryEncoder" This reverts commit a76cc88. * Revert unnecessary ifdefs * Regen protos * Use latest protos * Regen protos for latest changes * Decouple node-mute from channel-mute * Regen protos * Fix desktop build * More flexible InputPollable paradigm * Custom xPortInIsrContext() for nRF52/RP2xx0 * Use channel as specified in the received packet * Use channel as specified in the received packet for OLED screen notifications * add heltec tracker v2 board. * Use common power amp definition for Heltec v4 and Heltec Tracker v2 * Set appropriate mqtt root upon lora region change * Use user preferences root topic if present * delete SX126X_MAX_POWER=11 * Assume previous root on topic change * update mqtt root when region is changed via OLED menu handler * Regen protos * Removed magic numbers * Add DIRECT_MSG_ONLY buzzer mode (#8158) * Handle existing special case for M5STACK_UNITC6L for DIRECT_MSG_ONLY buzz mode There already exists a special case for M5STACK_UNITC6L. Modified it to adhere to new DIRECT_MSG_ONLY buzzer mode * Add new buzzer mode DIRECT_MSG_ONLY to BuzzerModeMenu * Disable notifications when buzzer mode is DIRECT_MSG_ONLY * Change alert_message_buzzer in notification module in DIRECT_MSG_ONLY buzz mode Better comments * Fixed spelling in debug log Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: nexpspace <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: Ben Meadors <[email protected]> * run trunk fmt * Update variants/esp32s3/heltec_wireless_tracker_v2/variant.h Co-authored-by: Copilot <[email protected]> * Regen protos * Pull latest protobufs * Don't use IS_ONE_OF when loading Modules * GAT562: Use PRIVATE_HW (fix build) (#8198) * ESP32s2 doesn't implement HWCDC (#8199) * Fix build script failure under certain conditions for devices that use UF2 binaries (#8150) * Validate CR and SF lora config (#8146) * Validate CR and SF lora config * No zero-bw * Update src/modules/AdminModule.cpp Co-authored-by: Copilot <[email protected]> * Fix braces --------- Co-authored-by: Copilot <[email protected]> * Quote firmware paths given to uf2conv --------- Co-authored-by: Ben Meadors <[email protected]> Co-authored-by: Copilot <[email protected]> * Calculate airtime of transmitted and received packets separately (#8205) * Correcting GPS PINs (#8087) #8084 Co-authored-by: Ben Meadors <[email protected]> * Clear out user.id except for sending to phone (#8202) * Null out user.id except for sending to phone * Fix * Update src/modules/NodeInfoModule.cpp Co-authored-by: Copilot <[email protected]> * Copilot garbage * This is unnecessary, because we don't stored user.id on userlite * Don't need this * Fix warning * Just alter the protobuf * Alter protobuf doesn't do anything with the altered data, so let's re-encode it * Check inputbroker before access --------- Co-authored-by: Copilot <[email protected]> * Add dropped packet count to LocalStats (#8207) * Add dropped packet count to LocalStats In case the transmit queue was full * Trunked --------- Co-authored-by: Ben Meadors <[email protected]> --------- Co-authored-by: ford-jones <[email protected]> Co-authored-by: WillyJL <[email protected]> Co-authored-by: Ford Jones <[email protected]> Co-authored-by: Tom Fifield <[email protected]> Co-authored-by: Quency-D <[email protected]> Co-authored-by: Quency-D <[email protected]> Co-authored-by: nexpspace <[email protected]> Co-authored-by: nexpspace <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: Austin Lane <[email protected]> Co-authored-by: Ken Piper <[email protected]> Co-authored-by: GUVWAF <[email protected]> Co-authored-by: Szetya <[email protected]>
This leverages the new methods
getLoRaRxHeaderInfo()
andcalculateTimeOnAir()
introduced in RadioLib 7.3.0 to calculate the airtime of a received packet based on the LoRa header info (coding rate and CRC).This is mostly important for when going to dynamic coding rates (#8108, #8114), but also now for nodes on older firmware or when people manually set the coding rate.
RadioInterface::getPacketTime()
is now pure virtual, hence I had to calculate the preamble time separately (which is now actually more accurate, as it only really considers preamble symbols and not also the LoRa header) and the max. packet length is only calculated when needed (which is very rare). SimRadio uses Meshtastic's original packet length calculation.