Skip to content

Fix ADSB vechiles on map in GPS TAB#2554

Merged
sensei-hacker merged 1 commit intoiNavFlight:maintenance-9.xfrom
error414:error414/fix/adsb_vechicle_on_map
Feb 8, 2026
Merged

Fix ADSB vechiles on map in GPS TAB#2554
sensei-hacker merged 1 commit intoiNavFlight:maintenance-9.xfrom
error414:error414/fix/adsb_vechicle_on_map

Conversation

@error414
Copy link
Contributor

@error414 error414 commented Feb 8, 2026

There was JS error

ol_layer_Vector__js.js?v=c9f9de37:628 Uncaught TypeError: fillStyle.getColor is not a function
    at CanvasTextBuilder.fillStyleToState (ol_layer_Vector__js.js?v=c9f9de37:628:40)
    at CanvasTextBuilder.drawText (ol_layer_Vector__js.…?v=c9f9de37:1661:78)
    at renderPointGeometry (ol_layer_Vector__js.…?v=c9f9de37:4731:16)
    at renderFeatureInternal (ol_layer_Vector__js.js?v=c9f9de37:4620:5)
    at renderFeature (ol_layer_Vector__js.js?v=c9f9de37:4595:3)
    at CanvasVectorLayerRenderer.renderFeature (ol_layer_Vector__js.…?v=c9f9de37:5294:19)
    at render (ol_layer_Vector__js.…?v=c9f9de37:5230:30)
    at CanvasVectorLayerRenderer.prepareFrame (ol_layer_Vector__js.js?v=c9f9de37:5249:7)
    at VectorLayer.render (chunk-BJC6XOTJ.js?v=44f6a0de:587:23)
    at CompositeMapRenderer.renderFrame (chunk-7B5DBLNC.js?v=44f6a0de:1830:29)
    ```
    
    after fix
    
    
<img width="1337" height="658" alt="image" src="https://github.com/user-attachments/assets/a5977133-df18-40c9-8a7f-d41548dd525d" />

@github-actions
Copy link

github-actions bot commented Feb 8, 2026

Branch Targeting Suggestion

You've targeted the master branch with this PR. Please consider if a version branch might be more appropriate:

  • maintenance-9.x - If your change is backward-compatible and won't create compatibility issues between INAV firmware and Configurator 9.x versions. This will allow your PR to be included in the next 9.x release.

  • maintenance-10.x - If your change introduces compatibility requirements between firmware and configurator that would break 9.x compatibility. This is for PRs which will be included in INAV 10.x

If master is the correct target for this change, no action is needed.


This is an automated suggestion to help route contributions to the appropriate branch.

@qodo-code-review
Copy link
Contributor

Review Summary by Qodo

Fix ADSB vehicle map rendering and optimize fixed-wing defaults

🐞 Bug fix ✨ Enhancement

Grey Divider

Walkthroughs

Description
• Fix JavaScript error in ADSB vehicle rendering on GPS map
  - Changed backgroundFill from string to Fill object with color property
• Add looptime=1000ms default for fixed-wing aircraft
  - Reduces CPU load and SD card wear on F4 boards
• Correct configuration key syntax in defaults
  - Remove "set" prefix from nav_fw_alt_control_response key
Diagram
flowchart LR
  A["ADSB Vehicle Rendering"] -->|Fix backgroundFill type| B["Use Fill object instead of string"]
  C["Fixed-Wing Defaults"] -->|Add looptime| D["1000ms loop time"]
  E["Configuration Keys"] -->|Remove prefix| F["nav_fw_alt_control_response"]
  B --> G["Resolve TypeError in canvas rendering"]
  D --> H["Reduce CPU and SD load"]
Loading

Grey Divider

File Changes

1. js/defaults_dialog_entries.js ⚙️ Configuration changes +14/-2

Add looptime defaults and fix config keys

• Add looptime: 1000 default setting to three fixed-wing aircraft profiles (Airplane, Flying Wing,
 Multirotor)
• Fix configuration key syntax by removing "set" prefix from nav_fw_alt_control_response in two
 profiles
• Maintain consistency across all fixed-wing default configurations

js/defaults_dialog_entries.js


2. tabs/gps.js 🐞 Bug fix +1/-1

Fix ADSB vehicle background fill rendering

• Fix ADSB vehicle text rendering by converting backgroundFill from string to Fill object
• Resolves TypeError where fillStyle.getColor() was called on invalid type
• Ensures proper canvas rendering of vehicle callsigns on map

tabs/gps.js


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Contributor

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Looptime preset may be ignored 🐞 Bug ✓ Correctness
Description
• Presets now include a looptime key, but preset application uses
  mspHelper.setSetting(key,value) for each entry; if the FC doesn’t expose looptime via MSPV2
  setting APIs, it will be rejected and skipped.
• This codebase already models looptime separately (FC.FC_CONFIG.loopTime) and serializes it via
  dedicated MSP messages (MSP_LOOP_TIME/MSP_SET_LOOP_TIME), suggesting looptime is not a typical
  “setting” in this app.
• When a setting is invalid, mspHelper.setSetting only logs to console and still calls the
  callback, so the chain continues and applied_defaults can still be set—preventing the defaults
  dialog from showing again even though looptime wasn’t applied.
Code

js/defaults_dialog_entries.js[R393-396]

+            {
+                key: "looptime",
+                value: 1000
+            },
Evidence
The preset system applies keys exclusively through mspHelper.setSetting. Looptime in this repo is
handled via FC.FC_CONFIG.loopTime and MSP_SET_LOOP_TIME, not through the MSPV2 setting
mechanism. If looptime isn’t available as a MSPV2 setting, encodeSetting throws, setSetting
catches/logs and continues, and applied_defaults being set will suppress future prompts.

js/defaults_dialog_entries.js[380-399]
js/defaults_dialog.js[194-223]
js/msp/MSPHelper.js[3409-3467]
js/fc.js[309-312]
js/msp/MSPHelper.js[321-323]
js/msp/MSPHelper.js[1825-1828]
js/defaults_dialog.js[337-341]

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

## Issue description
Default presets now contain `key: &quot;looptime&quot;`, but preset application uses `mspHelper.setSetting()` for all keys. In this repo, looptime is represented as `FC.FC_CONFIG.loopTime` and serialized via `MSP_SET_LOOP_TIME`, not via the generic MSPV2 setting mechanism. If the FC doesn’t expose a `looptime` MSPV2 setting, the configurator will silently skip it (console-only log) while still setting `applied_defaults`, potentially leaving the user with partially-applied defaults and no re-prompt.

## Issue Context
- Presets are applied in `defaults_dialog.js` by iterating `selectedDefaultPreset.settings` and calling `mspHelper.setSetting(input.key, input.value, callback)`.
- `mspHelper.setSetting` catches invalid settings and continues the chain.
- Looptime has explicit MSP codes and uses `FC.FC_CONFIG.loopTime` in message encoding.

## Fix Focus Areas
- js/defaults_dialog.js[194-244]
- js/msp/MSPHelper.js[3015-3140]
- js/msp/MSPHelper.js[3409-3467]
- js/defaults_dialog_entries.js[380-399]

### Suggested approach
1. In `defaults_dialog.js`, special-case `input.key === &#x27;looptime&#x27;`:
  - Set `FC.FC_CONFIG.loopTime = input.value`.
  - Send `MSP.send_message(MSPCodes.MSP_SET_LOOP_TIME, mspHelper.crunch(MSPCodes.MSP_SET_LOOP_TIME), false, callback)`.
  - (Optionally) only do this if the target supports it; otherwise show a user-visible warning.
2. Alternatively (or additionally), pre-validate all preset keys:
  - For each key, call `mspHelper._getSetting(key)`; if null and not a known-special key, surface a UI warning and consider not setting `applied_defaults`.
3. Consider moving `applied_defaults` to be set last (or only after all steps succeed) to avoid suppressing the defaults dialog when important keys were skipped.

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


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@error414 error414 changed the base branch from master to maintenance-9.x February 8, 2026 12:20
@sensei-hacker sensei-hacker added this to the 9.0.1 milestone Feb 8, 2026
@sensei-hacker sensei-hacker merged commit f059925 into iNavFlight:maintenance-9.x Feb 8, 2026
7 checks passed
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