Revert "[crsf] add temperature, RPM and AirSpeed telemetry"#11139
Merged
sensei-hacker merged 2 commits intomasterfrom Nov 28, 2025
Merged
Revert "[crsf] add temperature, RPM and AirSpeed telemetry"#11139sensei-hacker merged 2 commits intomasterfrom
sensei-hacker merged 2 commits intomasterfrom
Conversation
Copilot
AI
changed the title
[WIP] Revert changes introduced by PR #11025
Revert "[crsf] add temperature, RPM and AirSpeed telemetry"
Nov 28, 2025
Contributor
PR Compliance Guide 🔍All compliance sections have been disabled in the configurations. |
Comment on lines
465
to
+472
| CRSF_FRAME_GPS_INDEX, | ||
| CRSF_FRAME_VARIO_SENSOR_INDEX, | ||
| CRSF_FRAME_BAROMETER_ALTITUDE_INDEX, | ||
| CRSF_FRAME_TEMP_INDEX, | ||
| CRSF_FRAME_RPM_INDEX, | ||
| CRSF_FRAME_AIRSPEED_INDEX, | ||
| CRSF_SCHEDULE_COUNT_MAX | ||
| } crsfFrameTypeIndex_e; | ||
|
|
||
| static uint8_t crsfScheduleCount; | ||
| static uint16_t crsfSchedule[CRSF_SCHEDULE_COUNT_MAX]; | ||
| static uint8_t crsfSchedule[CRSF_SCHEDULE_COUNT_MAX]; |
Contributor
There was a problem hiding this comment.
Suggestion: Add a compile-time assert that the highest used index fits in the schedule mask width and update any docs/comments to reflect removed frames to prevent future mismatches. [Learned best practice, importance: 6]
New proposed code:
typedef enum {
CRSF_FRAME_ATTITUDE_INDEX,
CRSF_FRAME_BATTERY_SENSOR_INDEX,
CRSF_FRAME_FLIGHT_MODE_INDEX,
CRSF_FRAME_DEVICE_INFO_INDEX,
CRSF_FRAME_GPS_INDEX,
CRSF_FRAME_VARIO_SENSOR_INDEX,
CRSF_FRAME_BAROMETER_ALTITUDE_INDEX,
CRSF_SCHEDULE_COUNT_MAX
} crsfFrameTypeIndex_e;
static uint8_t crsfScheduleCount;
static uint8_t crsfSchedule[CRSF_SCHEDULE_COUNT_MAX];
+
+_Static_assert(CRSF_SCHEDULE_COUNT_MAX <= 8, "crsfSchedule bitmask exceeds uint8_t width");
...
const uint8_t currentSchedule = crsfSchedule[crsfScheduleIndex];
if (currentSchedule & BV(CRSF_FRAME_ATTITUDE_INDEX)) {
...
}
if (currentSchedule & BV(CRSF_FRAME_BATTERY_SENSOR_INDEX)) {
...
}
if (currentSchedule & BV(CRSF_FRAME_FLIGHT_MODE_INDEX)) {
...
}
...
if (currentSchedule & BV(CRSF_FRAME_VARIO_SENSOR_INDEX)) {
...
}
if (currentSchedule & BV(CRSF_FRAME_BAROMETER_ALTITUDE_INDEX)) {
...
}
sensei-hacker
added a commit
to sensei-hacker/inav_unofficial_targets
that referenced
this pull request
Dec 18, 2025
This commit fixes the critical bugs that caused PR iNavFlight#11025 to be reverted (PR iNavFlight#11139). The original implementation caused telemetry stream corruption by emitting malformed frames when sensors were unavailable. Root Cause: The original PR scheduled telemetry frames unconditionally (if feature compiled in) but frame functions only wrote data when sensors were available. This resulted in frames containing only [SYNC][CRC] instead of the proper [SYNC][LENGTH][TYPE][PAYLOAD][CRC] structure, corrupting the CRSF protocol stream and breaking ALL telemetry (not just new frames). Fixes Implemented: 1. RPM Frame (Bug #1 - CRITICAL): - Added conditional scheduling: only schedule if ESC_SENSOR_ENABLED and motorCount > 0 - Added protocol limit enforcement: max 19 RPM values per CRSF spec - Location: src/main/telemetry/crsf.c:705-707, 337-343 2. Temperature Frame (Bug #2 - CRITICAL): - Added conditional scheduling: only schedule if temperature sources are actually available (ESC sensors OR temperature sensors) - Added bounds checking: prevent buffer overflow beyond 20 temperatures - Location: src/main/telemetry/crsf.c:709-732, 361-381 3. Buffer Overflow Protection (Bug #4): - Added MAX_CRSF_TEMPS constant and bounds checks in loops - Prevents array overflow if >20 temperature sources configured - Location: src/main/telemetry/crsf.c:361, 368, 376 4. Protocol Limit Enforcement (Bug #5): - Added MAX_CRSF_RPM_VALUES constant (19 per CRSF spec) - Clamp motorCount to protocol limit before sending - Location: src/main/telemetry/crsf.c:337, 342-344 Implementation Pattern: Follows the GPS frame pattern: ✓ Conditional scheduling - only schedule if sensor available ✓ Unconditional writing - always write complete frame data when called Testing: - Code compiles successfully (verified with SITL build) - No syntax errors or warnings - All fixes follow existing code patterns in crsf.c Related Issues: - Original PR: iNavFlight#11025 (merged Nov 28, 2025, reverted same day) - Revert PR: iNavFlight#11139 - Investigation: claude/developer/sent/pr11025-root-cause-analysis.md Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
Reverts PR #11025 which added CRSF temperature, RPM, and AirSpeed telemetry support.
Changes Reverted
src/main/rx/crsf.h: Removed frame type definitions (CRSF_FRAMETYPE_AIRSPEED_SENSOR,CRSF_FRAMETYPE_RPM,CRSF_FRAMETYPE_TEMP) and payload size constantsrc/main/telemetry/crsf.c: RemovedcrsfFrameAirSpeedSensor(),crsfRpm(),crsfTemperature()functions, helpercrsfSerialize24(), and associated frame scheduling logicCreated via
git revert -m 1 acefeca61de5ef01883c14d262688dbd4cd3d298.Original prompt
This pull request was created as a result of the following prompt from Copilot chat.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.
PR Type
Bug fix
Description
Reverts CRSF telemetry additions that caused regressions
Removes airspeed, RPM, and temperature frame support
Removes associated sensor includes and helper functions
Simplifies frame scheduling logic and reduces payload complexity
Diagram Walkthrough
File Walkthrough
crsf.h
Remove CRSF telemetry frame type definitionssrc/main/rx/crsf.h
CRSF_FRAME_AIRSPEED_PAYLOAD_SIZEconstant definitionCRSF_FRAMETYPE_AIRSPEED_SENSOR,CRSF_FRAMETYPE_RPM,CRSF_FRAMETYPE_TEMPcrsf.c
Remove CRSF telemetry functions and sensor supportsrc/main/telemetry/crsf.c
flight/mixer.h,sensors/esc_sensor.h,sensors/pitotmeter.h,sensors/temperature.hcrsfFrameAirSpeedSensor(),crsfRpm(),crsfTemperature(), and helpercrsfSerialize24()telemetry
crsfSchedulearray fromuint16_ttouint8_ttypeairspeed sensors
initCrsfTelemetry()for ESC andpitot sensors