Skip to content

Conversation

@sensei-hacker
Copy link
Member

@sensei-hacker sensei-hacker commented Dec 18, 2025

## Summary

Documents INAV's power and current limiting feature (added in 3.0.0) which has never had sufficient user-facing documentation, and fixes a bug where burst limit of 0 (unlimited) was incorrectly overwritten to match continuous limit.

Changes

1. Documentation (docs/Battery.md) - 149 lines added

  • Power and Current Limiting section explaining burst vs continuous modes
  • Configuration tables for all 8 limit settings
  • Three practical examples: battery protection, racing compliance, combined limits
  • OSD elements and calibration tips

2. Bug Fix (src/main/flight/power_limits.c)

Problem: Setting limit_burst_current = 0 (unlimited) was overwritten to match limit_cont_current because 0 was treated numerically instead of as "disabled".

Example:

set limit_cont_current = 1000    # 100A continuous
set limit_burst_current = 0      # Want unlimited bursts
save
# After reboot: limit_burst_current = 1000 (incorrect)

Fix: Only enforce burst >= continuous when burst is non-zero. Applied to both current and power limits.

INAV has had power/current limiting since version 3.0.0 but it was
never documented in the main Battery.md documentation file. This
commit adds comprehensive documentation for the existing feature.

Added sections:
- Power and Current Limiting overview
- Why use power limiting (battery protection, safety, compliance)
- How it works (burst vs continuous limits, PI controller)
- Configuration settings table (current and power limits)
- Three practical example configurations
- Understanding burst mode with timeline example
- OSD elements for monitoring
- Calibration tips and best practices

The power limiting feature protects batteries and ESCs by smoothly
reducing throttle when current or power exceeds configured limits.
It uses a sophisticated burst reserve system that allows brief
high-power maneuvers while protecting during sustained flight.

Settings documented:
- limit_cont_current, limit_burst_current
- limit_burst_current_time, limit_burst_current_falldown_time
- limit_cont_power, limit_burst_power
- limit_burst_power_time, limit_burst_power_falldown_time
- limit_pi_p, limit_pi_i, limit_attn_filter_cutoff

This documentation helps users understand and configure a feature
that has existed for years but remained largely unknown due to lack
of user-facing documentation.
@qodo-code-review
Copy link
Contributor

qodo-code-review bot commented Dec 18, 2025

PR Compliance Guide 🔍

All compliance sections have been disabled in the configurations.

The power limiting initialization incorrectly treated burst limit of 0
as numerically less than continuous limit, and would automatically set
burst = continuous. However, 0 means 'disabled/unlimited' not 'zero
amps/watts allowed'.

This fix allows the valid configuration:
- limit_cont_current = 1000 (100A continuous limit)
- limit_burst_current = 0 (no burst limiting - unlimited bursts)

Changes:
- Only enforce burst >= continuous when burst is enabled (> 0)
- Applied to both current and power limit initialization
- Added comments explaining the 0 = disabled semantics
@sensei-hacker sensei-hacker changed the title Docs: Add Power and Current Limiting documentation to Battery.md Power and Current Limiting fix and documentation Dec 18, 2025
Changed divisor from 1000 to 100 to correctly convert from mAh to dA.

Example: 1500 mAh × 50C / 100 = 750 dA (75A) ✓
Previously: 1500 mAh × 50C / 1000 = 75 dA (7.5A) ✗

Thanks to Qodo code review for catching this.
@sensei-hacker sensei-hacker merged commit 8ff1820 into iNavFlight:maintenance-9.x Dec 21, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant