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
Open
Initial CRSF data delay - to allow cell voltage to stabilise and fuel be calculated correctly. #206Cobalt6700 wants to merge 8 commits intoiNavFlight:masterfrom
Cobalt6700 wants to merge 8 commits intoiNavFlight:masterfrom
Conversation
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.
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.
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. |
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.
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.