MSP protocol JSON definition file + derived documentation generation#11088
Conversation
PR Compliance Guide 🔍(Compliance updated until commit 56bb389)Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label Previous compliance checksCompliance check up to commit 10a7416 |
||||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||||
|
Thanks for your work on this. It looks like this PR doesn't change any functional files, only adds documentation-related files, so it should be safe. I see a lot of stuff in docs/development/msp/.gitignore . Is that intended / needed? |
You're very welcome. And no, that .gitignore is just an auto-created vscode artifact of some sort, it's safe to get rid of |
User description
This PR adds a master INAV-MSP definition file from which documentation, headers, APIs and more can be auto-generated.
Since INAV does not have foundational headers for MSP, i had to painstakingly parse the AIGen MSP reference wiki page and source code until all but a tiny handful of messages were correctly parsed along with their used enums and structs and a valid usable JSON file was generated. See https://github.com/xznhj8129/msp_documentation
The JSON file is meant as a base truth reference from which everything else can be derived so corrections can be made in one single location and propagated everywhere else.
Caveats:
Again, once an error is corrected here, it corrects everywhere.
This will immensely simplify development of software that uses the MultiWii Serial Protocol and interfacing with INAV. This could allow to generate one-time a C header of message structs that can be validated, verified, included in the main source code and then used as main ground truth reference from which to generate JSON, C or Python code; simplifying development immensely.
PR Type
Enhancement, Documentation
Description
This description is generated by an AI tool. It may have inaccuracies
Adds comprehensive MSP protocol documentation generation system with JSON-based message definitions
gen_msp_md.py: Generates Markdown documentation from MSP message definitions with strict code validationgen_enum_md.py: Extracts and documents C enums from INAV source with preprocessor condition trackingget_all_inav_enums_h.py: Consolidates all enums from INAV source directories into single headermanual_docs_fix.py: Provides manual documentation for complex variable-payload messagesIncludes master MSP definition JSON file (
msp_messages.json) as single source of truth for protocolGenerates auto-indexed Markdown reference (
msp_ref.md) with request/reply payload tables and enum linksImplements strict validation to ensure consistency between JSON definitions and MSPCodes enum
Diagram Walkthrough
File Walkthrough
8 files
MSP message documentation generator with strict validationC enum parser and Markdown documentation generatorManual documentation overrides for complex messagesConsolidates INAV source enums into single headerOrchestration script for documentation generation pipelineHeader template for generated MSP reference documentationGenerated MSP protocol reference with indexed messagesGenerated enumeration reference with condition tracking1 files
Master MSP protocol message definitions in JSON format