Repository navigation
Conversation
Add support for the Mass Zero thermal camera. The driver speaks the camera's serial protocol on a dedicated serial function. Configuration lives in a new parameter group. Camera state reaches the configurator over MSP and the CLI. A new OSD element reports camera status. Zoom and palette are exposed as in-flight adjustments. A mode switch triggers the camera's calibration routine. USE_MZTC stays off 512 KB targets to preserve flash space. SITL builds the feature regardless, since SITL has no flash constraint. This replaces the history of PR iNavFlight#11837. That branch carried two merges of maintenance-10.x and no longer applied to the current base. The work is squashed onto next-10.1 at d02085d. The generated MSP docs were rebuilt with src/utils/gen_msp_docs.sh. That rebuild also picks up upstream enums the committed docs had not yet captured, including srxl2CalPhase_e, gyroDataReady_e, navFwWpTurnMode_e and BOXTHRUSTREVERSE. docs/Settings.md was rebuilt with src/utils/update_cli_docs.py. Ray Morris did the review fixes and the earlier conflict resolution against maintenance-10.x that this commit carries forward.
|
ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing |
PR Summary by QodoIntegrate MassZero thermal camera control into INAV
AI Description
Diagram
High-Level Assessment
Files changed (32)
|
Code Review by Qodo
1.
|
Three findings were fatal to the feature as shipped. The scheduler never enabled TASK_MZTC_CAMERA. The UART therefore never opened on hardware or on SITL. The CLI dispatcher takes the first prefix match whose next character is not alphanumeric. An underscore is not alphanumeric. The mztc status entry therefore swallowed every mztc_* command. The driver also initialized after the box list was built. The THERMAL CALIBRATE mode was never offered. The task is now enabled at init. The mztc entry sits after the mztc_* entries with a comment explaining why. The driver initializes before mspFcInit(). The driver now keeps a snapshot of the configuration it last sent. A generic "set mztc_*" write is detected against that snapshot and transmitted. A hand change to a preset-owned field moves the selection to CUSTOM. The documentation always promised that behaviour. MSP2_SET_MZTC_CONFIG goes through a new mztcApplyConfig(). The apply queues the transmission and stores the preset byte as a label. It never expands the preset over the explicit values in the same payload. A preset stored while the link is down survives the link reset and is applied. Factory reset also restores the preset and the correction interval. The connection quality window is a bitmask of the last eight probe outcomes. The old arithmetic could not expire the oldest outcome. It pinned quality at 87 percent through a dead link. A rejected manual shutter command, or no reply at all within five seconds, returns the status from calibrating to ready and raises the calibration error flag. The update loop also notices when the Ports tab moves or removes the camera's UART and drops the stale handle. The OSD element gets a CMS entry. A pilot without a configurator can now enable and place it. The bench bridge script takes its serial port and endpoint from the command line, retries partial socket writes, and shares one shutdown signal between both workers. The debug variant is folded into it behind --verbose. The box bitmask crossing 64 entries grows MSP2_INAV_STATUS and MSP_ACTIVEBOXES by 4 bytes on camera builds. The configurator reads both by length. The growth and the blackbox stance are documented in docs/MassZero_Thermal_Camera.md. The rebase onto next-10.1 had reset msp_messages.json to the upstream copy. That file is a hand-maintained input to gen_msp_md.py. No generator recreates its entries. The reset therefore lost the ten MZTC messages. They are restored. README.md is regenerated from the result.
|
All sixteen review findings are addressed in f7c0c3c. Three were fatal to the feature as shipped. The scheduler never enabled the camera task. The The driver now keeps a snapshot of the configuration it last transmitted. Generic The box bitmask crosses 64 entries on camera builds. The Configurator already reads Nine unit tests cover the fixes. The suite passes 673 of 673 and SITL builds clean under |
Adds support for the Mass Zero thermal camera (MZTC).
This supersedes #11837. That PR superseded #11005. Both of those branches have
fallen behind
next-10.1and no longer apply. #11837 is currently the onlyopen PR against
next-10.1that GitHub reports as conflicting. I opened a freshPR because the head of #11837 lives on a fork I cannot push to.
What it adds
The driver speaks the camera's serial protocol over a dedicated serial function.
Configuration lives in a new parameter group. Camera state reaches the
configurator over MSP and the CLI. A new OSD element reports camera status. Zoom
and palette are exposed as in-flight adjustments. A mode switch triggers the
camera's calibration routine.
USE_MZTCstays off 512 KB targets to preserve flash space. Targets above thatcompile it in. SITL builds it regardless, since SITL has no flash constraint.
Nothing changes on a target that compiles the camera out.
Rebase notes
The work is squashed onto
next-10.1at d02085d. Two places needed attention.src/main/target/common.hcarried the only real code conflict. Upstream addedRP2350to theUSE_TELEMETRY_SBUS2gate in the same hunk as theUSE_MZTCblock. Both changes are kept.
The generated MSP docs were reset to their
next-10.1content and rebuilt withsrc/utils/gen_msp_docs.sh, since the previous branch predated both the docregeneration and the move of those generators into
src/utils. That rebuild alsopicks up upstream enums the committed docs had not yet captured. The new entries
cover
srxl2CalPhase_e,gyroDataReady_e,navFwWpTurnMode_eandBOXTHRUSTREVERSE. Those are unrelated to this feature. They are the generatorcatching up.
docs/Settings.mdwas rebuilt withsrc/utils/update_cli_docs.py.Every identifier this PR claims was checked against the current base. Serial
function bit 28 was already reserved upstream for this camera by name.
PG_MZTC_CAMERA_CONFIGtakes 1048, above the previous highest allocation.The MSP2 codes occupy 0x2240 through 0x2249, clear of upstream's highest INAV
code at 0x2234.
BOXMZTCCALIBRATEsits at 64, aboveBOXTHRUSTREVERSE.Testing
ninja checkpasses 664 of 664 tests, including 44 cases covering this driver.The SITL build is clean under
-DWARNINGS_AS_ERRORS=ONwith no warnings.This has not been flight tested against the current base. The hardware testing
behind the earlier revisions is described in #11005 and #11837.
Ray Morris did the review fixes and the earlier conflict resolution against
maintenance-10.xthat this branch carries forward.