-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Add 5s and 10s average of ampere to help calibrate ampere sensor. #4657
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
base: master
Are you sure you want to change the base?
Add 5s and 10s average of ampere to help calibrate ampere sensor. #4657
Conversation
WalkthroughAdds 5s/10s amperage average telemetry to Motors and Power tabs. Introduces history buffers and average computations in JS, new UI elements in HTML, and corresponding i18n strings in English and Chinese. No existing keys removed; history pruned to 10s window; averages updated during existing data pull cycles. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Telemetry as Telemetry Source
participant MotorsJS as motors.js
participant MotorsUI as motors.html
rect rgb(245,248,255)
note over Telemetry, MotorsUI: Motors tab data update
Telemetry->>MotorsJS: power data (amperage, timestamp)
MotorsJS->>MotorsJS: push reading to amperageHistory
MotorsJS->>MotorsJS: prune readings older than 10s
MotorsJS->>MotorsJS: compute avg(5s), avg(10s)
MotorsJS->>MotorsUI: update 5s/10s average fields
end
sequenceDiagram
autonumber
participant Telemetry as Telemetry Source
participant PowerJS as power.js
participant PowerUI as power.html
rect rgb(245,255,245)
note over Telemetry, PowerUI: Power tab slow data pull
Telemetry->>PowerJS: amperage reading + timestamp
PowerJS->>PowerJS: push to amperageHistory
PowerJS->>PowerJS: prune >10s
PowerJS->>PowerJS: compute avg(5s), avg(10s)
PowerJS->>PowerUI: render 5s/10s average cells
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (6)
🧰 Additional context used🧬 Code graph analysis (2)src/js/tabs/motors.js (3)
src/js/tabs/power.js (2)
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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
This PR adds 5-second and 10-second rolling averages for amperage readings to help with battery sensor calibration. The amperage values currently jump rapidly, making it difficult to determine accurate current readings for calibration purposes.
- Adds amperage history tracking with timestamp-based calculations for 5s and 10s averages
- Updates UI in both power and motors tabs to display the averaged values
- Adds internationalization support for the new labels in English and Chinese
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
src/tabs/power.html | Adds table rows for 5s and 10s amperage averages in the power tab |
src/tabs/motors.html | Adds display elements for amperage averages in the motors tab |
src/js/tabs/power.js | Implements amperage history tracking and average calculations for power tab |
src/js/tabs/motors.js | Implements amperage history tracking and average calculations for motors tab |
locales/zh_CN/messages.json | Adds Chinese translations for amperage average labels |
locales/en/messages.json | Adds English translations for amperage average labels |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
TABS.motors.amperageHistory.push({ | ||
value: currentAmperage, | ||
timestamp: currentTimestamp, | ||
}); |
Copilot
AI
Oct 5, 2025
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.
The amperage history array could grow indefinitely if the data collection runs for extended periods. Consider adding a maximum array size limit to prevent memory issues.
Copilot uses AI. Check for mistakes.
|
Preview URL: https://pr4657.betaflight-app-preview.pages.dev |
Why?
My ampere values is jumping fast and that makes me very hard to know the current ampere to calibrate battery.
So having 5s and 10s average makes everything easier.
Summary by CodeRabbit