AP_Scripting: Added VSPeak Modell flow meter driver #28627
Merged
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 PR as support for the VSPeak Modell flow meter, in the form of a Lua script.
Hardware
The manufacturer has sent me a sensor with developmental software, able to speak a plain binary packet that the script can easily receive and interpret.

It is unknown to me currently if this software is already in general production or only our partner who asked for it has the correct binary. FWIW The manufacturer does advertise compatibility with ArduPilot, thanks to this here script.
Implementation
I have used a scripting battery backend sensor to fill in only the battery current and potentially the current consumed.
I make the convention that "current" stands of liters of fuel per hour.
See the attached instructions.
Known issues
I have employed a hack in the parser to get out of a buggy situation.
Upon boot, the sensor reports
254,0,0,0,0,0,254
: Start byte, zero data, checksum.But if the data aligns wrong in the buffer, it gets the following content:
254, 254, 0, 0, 0, 0, 0
, which is also a valid packet, but means that there's 15.xx lt/hr flow.I couldn't find another solution for now but reject two consecutive 254 bytes.
In general I'd like to find a better, more generic way of parsing serial binary data of a fixed frame size.