Fix Smith Predictor compilation guards#1094
Merged
nerdCopter merged 1 commit intomasterfrom Oct 21, 2025
Merged
Conversation
Move applySmithPredictor function declaration inside USE_SMITH_PREDICTOR guard and guard the function call in gyro_filter_impl.h to prevent compilation errors when the Smith Predictor feature is disabled.
There was a problem hiding this comment.
Pull Request Overview
This PR fixes compilation errors that occur when the Smith Predictor feature is disabled by adding missing preprocessor guards. The function declaration and call site were not properly protected, causing build failures in configurations without USE_SMITH_PREDICTOR defined.
Key changes:
- Moved
applySmithPredictor()function declaration inside the#ifdef USE_SMITH_PREDICTORguard - Added
#ifdef USE_SMITH_PREDICTORguard around the function call in the gyro filter implementation
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/main/sensors/gyro.h | Relocated function declaration inside existing preprocessor guard for Smith Predictor feature |
| src/main/sensors/gyro_filter_impl.h | Added preprocessor guard around Smith Predictor function call |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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.
TL;DR: Move applySmithPredictor function declaration inside USE_SMITH_PREDICTOR guard
and guard the function call in gyro_filter_impl.h to prevent compilation errors
when the Smith Predictor feature is disabled.
Pull Request Description
Title: Fix Smith Predictor compilation guards
Description:
Problem
The Smith Predictor feature had incomplete preprocessor guards, causing compilation errors when
USE_SMITH_PREDICTORis undefined. Two unguarded locations were found:applySmithPredictor()function declaration insrc/main/sensors/gyro.hwas not protected with#ifdef USE_SMITH_PREDICTORapplySmithPredictor()insrc/main/sensors/gyro_filter_impl.hwas not guardedRoot Cause
smithPredictor_ttypedef: ✅ Guarded with#ifdef USE_SMITH_PREDICTORapplySmithPredictordeclaration: ❌ NOT guarded (was outside the#ifdef)applySmithPredictorcall: ❌ NOT guardedSolution
applySmithPredictordeclaration inside the existing#ifdef USE_SMITH_PREDICTORblock ingyro.happlySmithPredictorcall ingyro_filter_impl.hwith#ifdef USE_SMITH_PREDICTORFiles Changed
src/main/sensors/gyro.h: Moved function declaration into proper guardsrc/main/sensors/gyro_filter_impl.h: Guarded function callImpact
USE_SMITH_PREDICTORis undefinedTesting
USE_SMITH_PREDICTORdefined (types/functions available)USE_SMITH_PREDICTORdefined (no compilation errors)USE_SMITH_PREDICTOR: CLI shows Smith Predictor settings availableUSE_SMITH_PREDICTOR: CLI shows no Smith Predictor settings (feature properly disabled)Resolves: Unit test compilation blocker documented in
tmp/20251021_FIRMWARE_BUG_SMITH_PREDICTOR_DECLARATION.md