Repository navigation
Conversation
|
ⓘ 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.
|
|
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 |
|
RAM / Flash usage vs. base commit
See RAM/flash optimization guide for techniques to reduce usage. |
|
Test firmware build ready — commit Download firmware for PR #12172 251 targets built. Find your board's
|
|
@wdunn001 I assume the way to interface this with an RC system is using a mode switch. Can I have a few more details on how this is done? I could not find any information about it in the .md. Are the configurator side changes already part of the INAV 10 release candidate. Or is there another configurator build available for testing? |
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.
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.
The msp-consistency CI check reads the command catalogue from the four msp_protocol*.h headers and compares it against msp_messages.json. The MZTC command IDs lived in msp_mztc.h. The check therefore reported them as documented but undefined. The ten IDs now sit in msp_protocol_v2_inav.h with the rest of the INAV MSP2 catalogue. msp_mztc.h keeps the payload layouts and includes the catalogue header. Every existing includer still sees the IDs. src/utils/check_msp.py passes locally.
The error-reply handler wrote camera error codes straight into the shared debug[] array with no debugMode guard. Any camera error would corrupt the slot for whatever debug mode the pilot had selected. No DEBUG_MZTC mode exists. The values were therefore unreachable anyway. The writes are gone, along with the two error-code defines and the debug.h include that only they used. PG_MZTC_CAMERA_CONFIG now registers at version 0. The group has never shipped. No stored record exists at any earlier version. The comment narrating the unreleased layout history is gone. That history lives in the pull request. mztcLastUpdateTime was written twice and never read. Removed. An empty ifdef pair left behind at the end of the CLI command table is also gone. The license header in config/mztc_camera.h read "FITNESS FOR ANY PARTICULAR PURPOSE" where the GPL boilerplate says "A PARTICULAR PURPOSE". test_thermal_camera.py now takes its port and baud rate from the command line like thermal_bridge.py. It names the protocol constants, exits nonzero when the port cannot be opened and carries no trailing whitespace.
f7c0c3c to
721c73e
Compare
|
@Sibre3 Good questions. The RC interface is three separate things, all documented in docs/MassZero_Thermal_Camera.md under "Switches and in-flight adjustment". The section has been in the PR since the first commit. It is easy to miss because the file is long. Mode switch. Zoom and palette. These are not box modes. They are standard in-flight adjustments, function 61 ( There is no OSD selection menu for the camera. The only OSD piece is a status element named Commit history. The branch is a squash of the earlier PRs. It carries one feature commit plus one commit acting on the first review round. I have just rebased it onto the current Configurator. The configurator side merged in iNavFlight/inav-configurator#2726 on 2026-09-04 into |
|
@wdunn001 Thank you for the extra details. EDIT: I apologize. I only loaded the build of |
The in-flight zoom and palette adjustments gave no feedback except the image itself. The status element now carries the commanded zoom and palette while the link is up, as in "IR OK 2X WHT". The values are the ones the driver last sent, the same state the adjustments step through. The pilot sees each step land. The element hides both fields while the state is INI, ERR or OFF. A camera that is not listening has no current zoom or palette to report. The output is always exactly 13 characters, space padded. A state change can therefore never leave characters of the previous state on screen. MZTC_OSD_ELEMENT_LENGTH grows to 14 and finally has a consumer: the formatter pads to it. The unit test now compiles the formatter and pins the exact output for link up, link down, the widest state and out of range values, plus the constant width across every state.
|
@Sibre3 You found a real gap. Your build was fine for most of it. Two separate things were going on. The Adjustments tab is missing the functions in 10.0.0-rc1. The configurator's Adjustments tab carries a hardcoded function list that stops at 60. The thermal camera zoom and palette are functions 61 and 62. The rc1 configurator therefore cannot offer them. The original MZTC configurator PR missed them. iNavFlight/inav-configurator#2848 adds them to the Misc group. On rc1 you can still assign them over the CLI today, for example zoom stepped by AUX1 while AUX1 sits mid-range: The mode switch needs a save and reboot to appear. The box list is built once at boot. I reproduced both on SITL built from this branch to be sure. The box list has no On your earlier zoom usability point. The OSD status element now reports the commanded zoom and palette while the link is up, as in Builds. The workflow runs on this PR wait for maintainer approval after every push. That is why the recent commits have no artifacts yet. The same CI runs on my fork with every target's hex attached: https://github.com/wdunn001/inav/actions/workflows/ci.yml?query=branch%3Amztc-next-10.1 |
|
I have approved the latest workflow. |
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.