Skip to content

Commit af58d2b

Browse files
Merge pull request #11205 from iNavFlight/maintenance-9.x
Merge maintenance-9.x to master
2 parents 2747993 + c4bee56 commit af58d2b

32 files changed

Lines changed: 887 additions & 242 deletions

.github/workflows/ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,15 @@ jobs:
256256
for f in ./build_SITL/*_SITL.exe; do
257257
mv $f $(echo $f | sed -e 's/_[0-9]\+\.[0-9]\+\.[0-9]\+//')
258258
done
259+
- name: Copy cygwin1.dll
260+
run: cp /bin/cygwin1.dll ./build_SITL/
259261
- name: Upload artifacts
260262
uses: actions/upload-artifact@v4
261263
with:
262264
name: ${{ env.BUILD_NAME }}_SITL-WIN
263-
path: ./build_SITL/*.exe
265+
path: |
266+
./build_SITL/*.exe
267+
./build_SITL/cygwin1.dll
264268
265269
test:
266270
#needs: [build]

docs/Battery.md

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,155 @@ current_meter_scale = (reported_draw_mAh / charging_data_mAh) * old_current_mete
169169
= 435
170170
```
171171

172+
## Power and Current Limiting
173+
174+
INAV includes an advanced power and current limiting system to protect your battery and ESCs from excessive discharge rates. This feature automatically reduces throttle output when current or power draw exceeds configured limits.
175+
176+
### Why Use Power Limiting?
177+
178+
Power and current limiting helps:
179+
- **Protect batteries** from exceeding their C-rating and getting damaged
180+
- **Prevent voltage sag** and brown-outs during high-throttle maneuvers
181+
- **Extend battery lifespan** by avoiding excessive discharge rates
182+
- **Improve safety** by preventing ESC or battery overheating
183+
- **Comply with regulations** that may limit power output
184+
185+
### How It Works
186+
187+
The power limiter uses a PI (Proportional-Integral) controller to smoothly reduce throttle when current or power exceeds limits. It supports two operating modes:
188+
189+
1. **Continuous Limit**: The sustained current/power that can be drawn indefinitely
190+
2. **Burst Limit**: A higher current/power allowed for a short duration before falling back to the continuous limit
191+
192+
This burst mode allows brief high-power maneuvers (like punch-outs or quick climbs) while protecting the battery during sustained high-throttle flight.
193+
194+
### Configuration
195+
196+
Power limiting requires a current sensor (`CURRENT_METER` feature). Power-based limiting additionally requires voltage measurement (`VBAT` feature).
197+
198+
#### Basic Settings (per battery profile)
199+
200+
| Setting | Description | Unit | Range |
201+
|---------|-------------|------|-------|
202+
| `limit_cont_current` | Continuous current limit | dA (deci-amps) | 0-2000 (0-200A) |
203+
| `limit_burst_current` | Burst current limit | dA | 0-2000 (0-200A) |
204+
| `limit_burst_current_time` | Duration burst is allowed | ds (deci-seconds) | 0-600 (0-60s) |
205+
| `limit_burst_current_falldown_time` | Ramp-down duration from burst to continuous | ds | 0-600 (0-60s) |
206+
| `limit_cont_power` | Continuous power limit | dW (deci-watts) | 0-20000 (0-2000W) |
207+
| `limit_burst_power` | Burst power limit | dW | 0-20000 (0-2000W) |
208+
| `limit_burst_power_time` | Duration burst power is allowed | ds | 0-600 (0-60s) |
209+
| `limit_burst_power_falldown_time` | Ramp-down duration for power | ds | 0-600 (0-60s) |
210+
211+
**Note**: Set any limit to `0` to disable that specific limiter.
212+
213+
#### Advanced Tuning Settings
214+
215+
| Setting | Description | Default | Range |
216+
|---------|-------------|---------|-------|
217+
| `limit_pi_p` | Proportional gain for PI controller | 100 | 10-500 |
218+
| `limit_pi_i` | Integral gain for PI controller | 15 | 10-200 |
219+
| `limit_attn_filter_cutoff` | Low-pass filter cutoff frequency | 50 Hz | 10-200 |
220+
221+
### Example Configurations
222+
223+
#### Example 1: Simple Current Limiting (50A continuous)
224+
225+
Protect a 1500mAh 4S 50C battery (75A max burst, 50A continuous safe):
226+
227+
```
228+
battery_profile 1
229+
230+
set limit_cont_current = 500 # 50A continuous
231+
set limit_burst_current = 750 # 75A burst
232+
set limit_burst_current_time = 100 # 10 seconds
233+
set limit_burst_current_falldown_time = 20 # 2 second ramp-down
234+
```
235+
236+
#### Example 2: Power Limiting for Racing (500W limit)
237+
238+
Limit total system power for racing class restrictions:
239+
240+
```
241+
battery_profile 1
242+
243+
set limit_cont_power = 4500 # 450W continuous
244+
set limit_burst_power = 5000 # 500W burst
245+
set limit_burst_power_time = 50 # 5 seconds
246+
set limit_burst_power_falldown_time = 10 # 1 second ramp-down
247+
```
248+
249+
#### Example 3: Combined Current and Power Limiting
250+
251+
Protect both battery (current) and ESCs (power):
252+
253+
```
254+
battery_profile 1
255+
256+
# Current limits (battery protection)
257+
set limit_cont_current = 600 # 60A continuous
258+
set limit_burst_current = 800 # 80A burst
259+
set limit_burst_current_time = 100 # 10 seconds
260+
261+
# Power limits (ESC protection)
262+
set limit_cont_power = 8000 # 800W continuous
263+
set limit_burst_power = 10000 # 1000W burst
264+
set limit_burst_power_time = 100 # 10 seconds
265+
```
266+
267+
### Understanding Burst Mode
268+
269+
When you exceed the continuous limit, the system uses "burst reserve" (like a capacitor):
270+
- **Burst reserve** starts full and depletes when current/power exceeds the continuous limit
271+
- When reserve is empty, the limit drops to the continuous value
272+
- The `falldown_time` setting creates a smooth ramp-down instead of an abrupt drop
273+
- Reserve recharges when current/power drops below the continuous limit
274+
275+
**Example timeline** (60A continuous, 80A burst, 10s burst time, 2s falldown):
276+
```
277+
Time Limit Reason
278+
---- ----- ------
279+
0s 80A Full burst reserve
280+
5s 80A Still have reserve (using 5s of 10s)
281+
10s 80A Reserve depleted
282+
10-12s 80→60A Ramping down over 2 seconds
283+
12s+ 60A Continuous limit active
284+
```
285+
286+
### OSD Elements
287+
288+
Three OSD elements display power limiting status:
289+
290+
- **`OSD_PLIMIT_REMAINING_BURST_TIME`**: Shows remaining burst time in seconds
291+
- **`OSD_PLIMIT_ACTIVE_CURRENT_LIMIT`**: Shows current limit being enforced (blinks when limiting)
292+
- **`OSD_PLIMIT_ACTIVE_POWER_LIMIT`**: Shows power limit being enforced (blinks when limiting)
293+
294+
Enable these in the OSD tab to monitor limiting during flight.
295+
296+
### Calibration Tips
297+
298+
1. **Find your battery's limits**: Check manufacturer specifications for continuous and burst C-ratings
299+
- Continuous limit = `battery_capacity_mAh × continuous_C_rating / 100` (in dA)
300+
- Burst limit = `battery_capacity_mAh × burst_C_rating / 100` (in dA)
301+
302+
2. **Test incrementally**: Start with conservative limits and increase gradually
303+
304+
3. **Monitor in flight**: Use OSD elements to see when limiting activates
305+
306+
4. **Calibrate current sensor**: Accurate current readings are critical - see "Current Monitoring" section above
307+
308+
5. **Tune PI controller**: If limiting feels abrupt or causes oscillation, adjust `limit_pi_p` and `limit_pi_i`:
309+
- Increase P for faster response (may cause oscillation)
310+
- Increase I for better steady-state accuracy
311+
- Decrease if throttle oscillates during limiting
312+
313+
### Notes
314+
315+
- Power limiting is part of the battery profile system - each profile can have different limits
316+
- Both current and power limiting can be active simultaneously - the most restrictive applies
317+
- Limiting is applied smoothly via PI controller to avoid abrupt throttle cuts
318+
- The system uses instantaneous current/power readings for responsive limiting
319+
- Set limits to `0` to disable a specific limiter while keeping others active
320+
172321
## Battery capacity monitoring
173322

174323
For the capacity monitoring to work you need a current sensor (`CURRENT_METER` feature). For monitoring energy in milliWatt hour you also need voltage measurement (`VBAT` feature). For best results the current and voltage readings have to be calibrated.

docs/Blackbox.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ These chips are also supported:
120120
* Winbond W25Q64 - 64 Mbit / 8 MByte
121121
* Micron N25Q0128 - 128 Mbit / 16 MByte
122122
* Winbond W25Q128 - 128 Mbit / 16 MByte
123+
* Puya PY25Q128HA - 128 Mbit / 16 MByte
123124
* Winbond W25N01 - 1 Gbit / 128 MByte
124125
* Winbond W25N02 - 2 Gbit / 256 MByte
125126

docs/OSD.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ Here are the OSD Elements provided by INAV.
200200
| 165 | OSD_V_DIST_TO_FENCE | 8.0.0 | |
201201
| 166 | OSD_NAV_FW_ALT_CONTROL_RESPONSE | 8.0.0 | |
202202
| 167 | OSD_NAV_MIN_GROUND_SPEED | 9.0.0 | |
203+
| 168 | OSD_THROTTLE_GAUGE | 9.0.0 | |
203204

204205
# Pilot Logos
205206

docs/development/Development.md

Lines changed: 103 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,13 @@ The main flow for a contributing is as follows:
107107
7. `git add <files that have changed>`
108108
8. `git commit`
109109
9. `git push origin my-new-code`
110-
10. Create pull request using github UI to merge your changes from your new branch into `inav/master`
110+
10. Create pull request using github UI to merge your changes from your new branch into the appropriate target branch (see "Branching and release workflow" below)
111111
11. Repeat from step 4 for new other changes.
112112

113113
The primary thing to remember is that separate pull requests should be created for separate branches. Never create a pull request from your `master` branch.
114114

115+
**Important:** Most contributions should target a maintenance branch, not `master`. See the branching section below for guidance on choosing the correct target branch.
116+
115117
Later, you can get the changes from the INAV repo into your `master` branch by adding INAV as a git remote and merging from it as follows:
116118

117119
1. `git remote add upstream https://github.com/iNavFlight/inav.git`
@@ -125,10 +127,105 @@ You can also perform the git commands using the git client inside Eclipse. Refe
125127

126128
## Branching and release workflow
127129

128-
Normally, all development occurs on the `master` branch. Every release will have it's own branch named `release_x.y.z`.
130+
INAV uses maintenance branches for active development and releases. The `master` branch receives merges from maintenance branches.
131+
132+
### Branch Types
133+
134+
#### Maintenance Branches (Current and Next Major Version)
135+
136+
**Current version branch** (e.g., `maintenance-9.x`):
137+
- Used for backward-compatible changes
138+
- Bug fixes, new features, and improvements that don't break compatibility
139+
- Changes here will be included in the next release of the current major version (e.g., 9.1, 9.2)
140+
- Does not create compatibility issues between firmware and configurator within the same major version
141+
142+
**Next major version branch** (e.g., `maintenance-10.x`):
143+
- Used for changes that introduce compatibility requirements
144+
- Breaking changes that would cause issues between different major versions
145+
- New features that require coordinated firmware and configurator updates
146+
- Changes here will be included in the next major version release (e.g., 10.0)
147+
148+
#### Master Branch
149+
150+
The `master` branch receives periodic merges from maintenance branches.
151+
152+
### Choosing the Right Target Branch
153+
154+
When creating a pull request, target the appropriate branch:
155+
156+
**Target the current version branch** (e.g., `maintenance-9.x`) if your change:
157+
- Fixes a bug
158+
- Adds a new feature that is backward-compatible
159+
- Updates documentation
160+
- Adds or updates hardware targets
161+
- Makes improvements that work with existing releases
162+
163+
**Target the next major version branch** (e.g., `maintenance-10.x`) if your change:
164+
- Breaks compatibility with the current major version
165+
- Requires coordinated firmware and configurator updates
166+
- Changes MSP protocol in an incompatible way
167+
- Modifies data structures in a breaking way
168+
169+
### Release Workflow
170+
171+
1. Development occurs on the current version maintenance branch (e.g., `maintenance-9.x`)
172+
2. When ready for release, a release candidate is tagged from the maintenance branch
173+
3. Bug fixes during the RC period continue on the maintenance branch
174+
4. After final release, the maintenance branch is periodically merged into `master`
175+
5. The cycle continues with the maintenance branch receiving new changes for the next release
176+
177+
### Propagating Changes Between Maintenance Branches
178+
179+
Changes committed to the current version branch should be merged forward to the next major version branch to prevent regressions.
129180

130-
During release candidate cycle we will follow the process outlined below:
181+
**Maintainer workflow:**
182+
- Changes merged to `maintenance-9.x` should be regularly merged into `maintenance-10.x`
183+
- This ensures fixes and features aren't lost when the next major version is released
184+
- Prevents users from experiencing bugs in v10.0 that were already fixed in v9.x
131185

132-
1. Create a release branch `release_x.y.z`
133-
2. All bug fixes found in the release candidates will be merged into `release_x.y.z` branch and not into the `master`.
134-
3. After final release is made, the branch `release_x.y.z` is locked, and merged into `master` bringing all of the bug fixes into the development branch. Merge conflicts that may arise at this stage are resolved manually.
186+
**Example:**
187+
```bash
188+
# Merge changes from current to next major version
189+
git checkout maintenance-10.x
190+
git merge maintenance-9.x
191+
git push upstream maintenance-10.x
192+
```
193+
194+
### Example Timeline
195+
196+
Current state (example):
197+
- `maintenance-9.x` - Active development for INAV 9.1, 9.2, etc.
198+
- `maintenance-10.x` - Breaking changes for future INAV 10.0
199+
- `master` - Receives periodic merges from maintenance branches
200+
201+
After INAV 10.0 is released:
202+
- `maintenance-10.x` - Active development for INAV 10.1, 10.2, etc.
203+
- `maintenance-11.x` - Breaking changes for future INAV 11.0
204+
- `master` - Continues receiving merges
205+
206+
### Working with Maintenance Branches
207+
208+
To branch from the current maintenance branch instead of master:
209+
210+
```bash
211+
# Fetch latest changes
212+
git fetch upstream
213+
214+
# Create your feature branch from the maintenance branch
215+
git checkout -b my-new-feature upstream/maintenance-9.x
216+
217+
# Make changes, commit, and push
218+
git push origin my-new-feature
219+
220+
# Create PR targeting maintenance-9.x (not master)
221+
```
222+
223+
When updating your fork:
224+
225+
```bash
226+
# Get the latest maintenance branch changes
227+
git fetch upstream
228+
229+
# Push directly from upstream to your fork (no local checkout needed)
230+
git push origin upstream/maintenance-9.x:maintenance-9.x
231+
```

docs/javascript_programming/GENERATE_CONSTANTS_README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ const FLIGHT_PARAM = {
8787
};
8888

8989
// ... exports
90+
9091
```
9192

9293
## Build Integration
@@ -109,21 +110,23 @@ This ensures constants are regenerated before each build.
109110
Currently, API definitions have hardcoded values:
110111

111112
```javascript
112-
// flight.js - WRONG (hardcoded)
113+
// inav.flight.js - WRONG (hardcoded)
113114
yaw: {
114115
inavOperand: { type: 2, value: 17 } // Wrong value!
115116
}
117+
116118
```
117119

118120
Change to reference constants:
119121

120122
```javascript
121-
// flight.js - CORRECT (references constants)
123+
// inav.flight.js - CORRECT (references constants)
122124
const { OPERAND_TYPE, FLIGHT_PARAM } = require('../../transpiler/inav_constants.js');
123125

124126
yaw: {
125127
inavOperand: { type: OPERAND_TYPE.FLIGHT, value: FLIGHT_PARAM.ATTITUDE_YAW }
126128
}
129+
127130
```
128131

129132
Benefits:

0 commit comments

Comments
 (0)