Skip to content

Completed qodo-code actoin required changes - #2703

Open
GenCodeInc wants to merge 19 commits into
iNavFlight:maintenance-10.xfrom
GenCodeInc:pr-2698-head
Open

Completed qodo-code actoin required changes#2703
GenCodeInc wants to merge 19 commits into
iNavFlight:maintenance-10.xfrom
GenCodeInc:pr-2698-head

Conversation

@GenCodeInc

Copy link
Copy Markdown

Resolves issues found in code review
Completed qodo-code actoin required changes

GenCodeInc and others added 18 commits March 15, 2026 15:50
Add a lawnmower/grid survey pattern generator that allows users to
define a polygon area on the map and automatically generate survey
waypoints within it.

Features:
- Grid survey button in Action Menu with polygon drawing interaction
- Sidebar settings card with line spacing, altitude, speed, sweep angle,
  overshoot, and End with RTH checkbox
- Live auto-preview: polygon outline, dashed survey path, and numbered
  waypoint dots update as parameters change
- Lawnmower pattern algorithm with configurable sweep angle and overshoot
- RTH waypoint automatically appended when End with RTH is checked
- Waypoint count display with remaining capacity
- Ctrl+G keyboard shortcut to activate grid draw mode
- Full i18n support for all UI strings
- Arrow keys (Left/Right) navigate between waypoints with card transition
- Delete key removes selected waypoint with confirmation dialog
- Auto-select previous waypoint after deletion
- Auto-select WP1 after grid survey generation
- Show 'Add WP' tooltip with crosshair when hovering flight path lines
- Green RTH marker at last waypoint position for all missions
- Ctrl+G keyboard shortcut for grid polygon draw
- SET_HEAD waypoints show black circle with white arrow pointing in heading direction
- Heading degree label displayed below the marker
- Heading marker and RTH marker render above flight path lines (zIndex: 99)
- SET_HEAD shows black circle with white directional dot (pure geometry, no text rotation)
- RTH and heading markers aligned with WP pin center via MARKER_ICON_OFFSET_X/Y
- Both marker circles same size (radius 10)
- Offset constants adjustable: MARKER_ICON_OFFSET_Y=12, MARKER_ICON_OFFSET_X=-2
…ht#2593

# Conflicts:
#	locale/en/messages.json
#	tabs/mission_control.js
@qodo-code-review

Copy link
Copy Markdown
Contributor

ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Add grid survey generator and keyboard UX improvements to Mission Control

✨ Enhancement 🐞 Bug fix 🕐 40+ Minutes

Grey Divider

AI Description

• Add polygon-based grid survey waypoint generator with live preview and optional ending RTH.
• Improve Mission Control UX: Ctrl+G, arrow-key navigation, Delete-to-remove, and “Add WP” hover
 tooltip.
• Add accessible labels/i18n strings and map marker overlays for heading and RTH visualization.
Diagram

graph TD
  A["Mission Control UI"] --> B["mission_control.js"] --> C(["OpenLayers Map"])
  B --> D[("Mission Model")]
  B --> E["Grid Generator"]
  E --> D
  A --> F["i18n"] --> G["messages.json"]
  A --> H["mission_planner.css"]

  subgraph Legend
    direction LR
    _ui["UI/View"] ~~~ _logic["Logic"] ~~~ _map(["Map/OL"]) ~~~ _data[("Data")]
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Extract grid generator into a standalone module + unit tests
  • ➕ Improves readability of mission_control.js (currently very large, multiple concerns).
  • ➕ Enables deterministic tests for polygon edge cases (concave polygons, narrow areas, overshoot).
  • ➕ Easier future reuse (e.g., other survey patterns).
  • ➖ Requires refactoring/re-wiring imports/build setup.
  • ➖ Adds up-front maintenance overhead for a feature still evolving.
2. Use a geometry library (e.g., Turf.js) for offsets/intersections
  • ➕ More robust geospatial operations and fewer custom edge cases.
  • ➕ Potentially better accuracy across latitudes and larger polygons.
  • ➖ Adds a significant dependency footprint (bundle size/security review).
  • ➖ Integration complexity with existing OpenLayers coordinate transforms.
3. Use OpenLayers-native measurement/projection utilities end-to-end
  • ➕ Leverages map projection math already in the stack.
  • ➕ Reduces risk of local meter-per-degree approximations.
  • ➖ Requires deeper OpenLayers projection configuration; may be non-trivial.
  • ➖ Could be overkill if typical polygons are small and approximation is acceptable.

Recommendation: The PR’s approach is reasonable for a UI-driven, small-area survey planner: it keeps dependencies minimal and integrates cleanly with OpenLayers drawing/overlay flows. The main follow-up worth considering is extracting the grid algorithm + preview construction into a separate module (and adding tests) to reduce risk and keep mission_control.js maintainable as more mission features accumulate.

Files changed (4) +869 / -94

Enhancement (4) +869 / -94
messages.jsonAdd i18n strings for grid survey UI and delete confirmation +48/-0

Add i18n strings for grid survey UI and delete confirmation

• Introduces new English messages for the grid survey generator (title, draw instructions, settings fields, capacity/error text). Adds screen-reader-only labels for Mission Control buttons and a new confirmation message for deleting a selected waypoint.

locale/en/messages.json

mission_planer.cssAdd Mission Control grid action icon styling +4/-0

Add Mission Control grid action icon styling

• Defines a new '.ic_grid' icon for the Mission Control action menu using an SVG asset, enabling the grid survey button to render consistently with existing icons.

src/css/tabs/mission_planer.css

mission_control.htmlAdd grid survey action button and settings sidebar card +51/-2

Add grid survey action button and settings sidebar card

• Adds a new Grid Survey action button next to search/center controls and introduces a hidden settings card containing spacing/altitude/speed/angle/overshoot and End-with-RTH inputs. Improves accessibility by adding 'aria-label' and 'sr-only' i18n-backed text for key map actions.

tabs/mission_control.html

mission_control.jsImplement grid waypoint generation, preview overlays, and keyboard UX +766/-92

Implement grid waypoint generation, preview overlays, and keyboard UX

• Implements a lawnmower/grid survey algorithm (rotation, scanline intersections, overshoot) and a polygon draw flow using OpenLayers 'Draw', rendering live previews (polygon, dashed path, numbered dots) and generating mission waypoints with optional appended RTH. Adds keyboard shortcuts (Ctrl+G, arrow navigation, Delete with confirmation), hover “Add WP” tooltip on flight path lines, and new heading/RTH overlay markers with selection routing to their parent waypoint. Includes several interaction safety fixes (ignore grid preview layers for drag/select) and refactors for clearer event handling.

tabs/mission_control.js

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Aug 9, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Invalid marker coordinate guard ✓ Resolved 🐞 Bug ≡ Correctness
Description
repaintLine4Waypoints() may construct RTH/heading marker geometries from oldPos even when oldPos is
the string 'undefined', causing OpenLayers Point/Feature construction to fail and break map
rendering for affected missions.
Code

tabs/mission_control.js[R1956-1959]

+                if (element.getAction() == MWNP.WPTYPE.RTH && oldPos !== undefined) {
+                    // RTH marker
+                    // RTH marker as SVG
+                    const markerOpacity = 0.85;
Evidence
Within repaintLine4Waypoints(), oldPos is explicitly set to the string 'undefined' when an
element has endMission == 0xA5, but the new RTH/heading marker code only checks `oldPos !==
undefined before passing it to new Point(oldPos). Because a string value passes that check, new
Point(oldPos) can receive an invalid coordinate. WaypointCollection.update() shows RTH` and
SET_HEAD are handled as attached actions, so these marker branches are reachable during mission
iteration.

tabs/mission_control.js[1944-1952]
tabs/mission_control.js[1956-1965]
tabs/mission_control.js[1992-2010]
js/waypointCollection.js[178-189]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`repaintLine4Waypoints()` now creates additional OpenLayers `Point` features for attached `RTH` and `SET_HEAD` actions. The new code checks `oldPos !== undefined`, but in the same function `oldPos` is sometimes assigned the literal string `'undefined'` when an element has `endMission == 0xA5`. Since `'undefined' !== undefined` is true, the guard is ineffective and the code can call `new Point(oldPos)` with a non-coordinate value, which can throw and interrupt mission rendering.
## Issue Context
- `oldPos` is used as the last waypoint coordinate for drawing and markers.
- The function explicitly assigns `oldPos = 'undefined'` in some cases.
- Attached actions include `RTH` and `SET_HEAD`, so the new marker paths are reachable.
## Fix Focus Areas
- tabs/mission_control.js[1944-1966]
- tabs/mission_control.js[1992-2010]
## Suggested fix
- Replace the current guards with strict coordinate validation, e.g.:
- `if (Array.isArray(oldPos) && oldPos.length === 2 && Number.isFinite(oldPos[0]) && Number.isFinite(oldPos[1])) { ... }`
- (Optional but recommended) stop using the string sentinel `'undefined'` and use `undefined`/`null` consistently, updating any dependent checks accordingly.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. Grid capacity text mismatch 🐞 Bug ≡ Correctness
Description
updateGridPreview() interpolates missionGridWaypointCount with mission.getMaxWaypoints() as
“remaining capacity”, so the displayed value does not match what the message string claims it
represents.
Code

tabs/mission_control.js[R4371-4374]

+            const maxWp = mission.getMaxWaypoints();
+            const totalCount = waypoints.length + ($('#gridEndRTH').is(':checked') ? 1 : 0);
+            const countText = i18n.getMessage('missionGridWaypointCount', [totalCount, maxWp]);
+            $('#gridWaypointCount').text(countText).css('color', totalCount > maxWp ? 'red' : '#666');
Evidence
The string for missionGridWaypointCount explicitly describes $2 as “remaining capacity”, but
updateGridPreview() passes maxWp = mission.getMaxWaypoints() as $2. getMaxWaypoints() is
defined to return the configured maximum waypoint count, not a remaining value.

locale/en/messages.json[6825-6827]
tabs/mission_control.js[4371-4374]
js/waypointCollection.js[21-27]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new English i18n string `missionGridWaypointCount` says `$2` is “remaining capacity”, but the preview code passes `mission.getMaxWaypoints()` (the maximum allowed waypoints) as `$2`. This yields misleading UI like “remaining capacity: 120” when it’s actually the limit, not remaining after the proposed grid.
## Issue Context
- `mission.getMaxWaypoints()` returns the configured maximum (not remaining slots).
- The preview computes `totalCount` already, so remaining can be computed if that’s what the UI intends.
## Fix Focus Areas
- tabs/mission_control.js[4371-4374]
- locale/en/messages.json[6825-6827]
- js/waypointCollection.js[21-27]
## Suggested fix (pick one)
1) If `$2` should be remaining after generating this grid: pass `maxWp - totalCount` (clamped at >= 0).
2) If `$2` should be the absolute limit: change the message text to “maximum capacity” / “limit” instead of “remaining capacity”.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Qodo Logo

Comment thread tabs/mission_control.js Outdated
Comment thread tabs/mission_control.js
Comment on lines +4371 to +4374
const maxWp = mission.getMaxWaypoints();
const totalCount = waypoints.length + ($('#gridEndRTH').is(':checked') ? 1 : 0);
const countText = i18n.getMessage('missionGridWaypointCount', [totalCount, maxWp]);
$('#gridWaypointCount').text(countText).css('color', totalCount > maxWp ? 'red' : '#666');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

2. Grid capacity text mismatch 🐞 Bug ≡ Correctness

updateGridPreview() interpolates missionGridWaypointCount with mission.getMaxWaypoints() as
“remaining capacity”, so the displayed value does not match what the message string claims it
represents.
Agent Prompt
## Issue description
The new English i18n string `missionGridWaypointCount` says `$2` is “remaining capacity”, but the preview code passes `mission.getMaxWaypoints()` (the maximum allowed waypoints) as `$2`. This yields misleading UI like “remaining capacity: 120” when it’s actually the limit, not remaining after the proposed grid.

## Issue Context
- `mission.getMaxWaypoints()` returns the configured maximum (not remaining slots).
- The preview computes `totalCount` already, so remaining can be computed if that’s what the UI intends.

## Fix Focus Areas
- tabs/mission_control.js[4371-4374]
- locale/en/messages.json[6825-6827]
- js/waypointCollection.js[21-27]

## Suggested fix (pick one)
1) If `$2` should be remaining after generating this grid: pass `maxWp - totalCount` (clamped at >= 0).
2) If `$2` should be the absolute limit: change the message text to “maximum capacity” / “limit” instead of “remaining capacity”.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@sonarqubecloud

sonarqubecloud Bot commented Aug 9, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

Configurator test build ready — commit 4c07fd1

Download build artifacts for PR #2703

Available platforms (scroll to the Artifacts section at the bottom of the run page):

  • Windows x64 (ZIP, MSI) and x32 (ZIP, MSI)
  • macOS arm64 (ZIP, DMG) and x64 (ZIP, DMG)
  • Linux x64 (DEB, RPM, ZIP) and aarch64 (DEB, RPM, ZIP)

A GitHub login is required to download artifacts. Build is for testing only.

@sensei-hacker

Copy link
Copy Markdown
Member

Just an FYI for contributors: The tentative schedule for INAV 10 is to have a full release in mid December. That means RC2 needs to be in early to mid November, which places INAV 10.0RC1 at September 1. Please plan to have any new features for INAV 10.0 ready for RC1 no later than September 1. After that, 10.1 will follow about six to seven months later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants