Skip to content

Initial CRSF data delay - to allow cell voltage to stabilise and fuel be calculated correctly. #206

Open
Cobalt6700 wants to merge 8 commits intoiNavFlight:masterfrom
Cobalt6700:dev
Open

Initial CRSF data delay - to allow cell voltage to stabilise and fuel be calculated correctly. #206
Cobalt6700 wants to merge 8 commits intoiNavFlight:masterfrom
Cobalt6700:dev

Conversation

@Cobalt6700
Copy link
Copy Markdown

This is a fix for issue #174 and discussions held on Discord. See https://discord.com/channels/791437907478577172/1493986783313133740/1497692570384601108 for further info.

Adds a configurable delay to CRSF data when the FC is first booted. This is to allow the voltage reading from the FC to stabilise and report the correct pack voltage.

Tested on cold starting with fully charged and partially charged packs, and resetting between packs with use of the timer 3 reset mechanic.

Default value of 5. If set to 0 in config, the delay is ignored.

This is to prevent the first battery voltage reading being used to calculate fuel. When booting the value reported by INAV can lower than the actual pack voltage due to the inrush current.

Adding a small delay (at around 50hz, so the delay is between 100ms and 250 ms) allows the values to settle and the pack voltage and fuel value to be calculated correctly.
This gives the option to fine tune the crsf data delay, including setting to 0 which removes the delay.
@Cobalt6700 Cobalt6700 marked this pull request as draft April 27, 2026 19:00
@Cobalt6700
Copy link
Copy Markdown
Author

Marked as draft - whilst this worked yesterday, today it is not calculating the correct amount of fuel.

Further tinkering required.

This performs consistently compared to the previous version.
We now use a time delay and watch for a voltage increase. This is consistent with an FC seeing inrush current on startup with a slight voltage sag. Once the voltage has been stable for the time delay, the pack voltage is then used to calculate the fuel.
Fuel reading to the user is shown as -1% whilst this delay is active to give obvious feedback that the fuel is not yet calculated.
Debug options left in for testing, will be removed before merge.
Debug prints and loop counter removed.
@Cobalt6700 Cobalt6700 marked this pull request as ready for review May 5, 2026 13:35
@Cobalt6700
Copy link
Copy Markdown
Author

Flown 11 flights with the updated code for fuel estimation. Measured pack voltages before and after, fuel shown as 100% before take off, landed around 30% fuel remaining - consistent with voltage readings and used mAh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant