Skip to content

foxeer m10q-250 model fix#2604

Open
RomanLut wants to merge 4 commits intoiNavFlight:masterfrom
RomanLut:submit-foxeer-m10q-model-fix
Open

foxeer m10q-250 model fix#2604
RomanLut wants to merge 4 commits intoiNavFlight:masterfrom
RomanLut:submit-foxeer-m10q-model-fix

Conversation

@RomanLut
Copy link
Copy Markdown
Contributor

@github-actions
Copy link
Copy Markdown

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
Copy Markdown
Contributor

Review Summary by Qodo

Fix Foxeer M10Q-250 model alignment and add GLB utilities

🐞 Bug fix ✨ Enhancement

Grey Divider

Walkthroughs

Description
• Fixes Foxeer M10Q-250 magnetometer model alignment issue
• Adds GLB roughness utility for material adjustment
• Updates CI workflow to support manual trigger
• Modifies 3D model file for correct alignment
Diagram
flowchart LR
  A["Foxeer M10Q-250<br/>Model Issue"] -->|"Apply Fix"| B["Updated GLB Model"]
  C["GLB Roughness<br/>Utility"] -->|"Patch Materials"| B
  D["CI Workflow"] -->|"Add Manual Trigger"| E["Enhanced Pipeline"]
Loading

Grey Divider

File Changes

1. support/glb_set_roughtness_1.js ✨ Enhancement +107/-0

GLB roughness patching utility script

• New utility script for patching GLB 2.0 files in place
• Finds and replaces all roughnessFactor values with 1
• Removes glossy highlights by modifying JSON chunk directly
• Preserves file structure without full GLB rebuild

support/glb_set_roughtness_1.js


2. .github/workflows/ci.yml ⚙️ Configuration changes +2/-0

Add manual workflow trigger capability

• Adds workflow_dispatch trigger for manual CI execution
• Allows developers to run build workflow on demand

.github/workflows/ci.yml


3. resources/models/model_foxeer_m10q_250.glb 🐞 Bug fix +0/-0

Fix magnetometer model alignment

• Updates 3D model file with corrected alignment
• Fixes magnetometer model representation issue

resources/models/model_foxeer_m10q_250.glb


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown
Contributor

qodo-code-review Bot commented Apr 12, 2026

Code Review by Qodo

🐞 Bugs (2)   📘 Rule violations (1)   📎 Requirement gaps (0)   🖥 UI issues (0)   🎨 UX Issues (0)
🐞\ ☼ Reliability (1) ⚙ Maintainability (1)
📘\ ☼ Reliability (1)

Grey Divider


Action required

1. BOM breaks hashbang 🐞
Description
support/glb_set_roughtness_1.js begins with a UTF-8 BOM before the shebang, which prevents direct
execution (e.g., chmod +x && ./glb_set_roughtness_1.js) because the OS won’t recognize the
interpreter directive.
Code

support/glb_set_roughtness_1.js[1]

+#!/usr/bin/env node
Evidence
The file’s first character is a BOM (shown as an extra character before #!), so the first two bytes
are not '#!' and Unix shebang parsing fails.

support/glb_set_roughtness_1.js[1-2]

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 script has a UTF-8 BOM before the shebang, preventing direct execution via hashbang on Unix-like systems.

### Issue Context
The file currently starts with an invisible BOM character (U+FEFF) before `#!/usr/bin/env node`.

### Fix Focus Areas
- support/glb_set_roughtness_1.js[1-2]

### Suggested change
- Remove the BOM so the very first bytes of the file are `#!`.
- (Optional) Ensure the file ends with a newline.

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



Remediation recommended

2. readUInt32LE lacks length guard 📘
Description
The new GLB patching utility reads header fields via buffer.readUInt32LE(...) without first
validating buffer.length, which can throw a RangeError on truncated/invalid files. This violates
the requirement to guard against unexpected data shapes before access.
Code

support/glb_set_roughtness_1.js[R51-66]

+const buffer = fs.readFileSync(input);
+
+// --- validate header ---
+if (buffer.readUInt32LE(0) !== GLB_MAGIC) fail('Not GLB');
+if (buffer.readUInt32LE(4) !== GLB_VERSION) fail('Unsupported GLB version');
+
+const jsonLength = buffer.readUInt32LE(12);
+const jsonType = buffer.readUInt32LE(16);
+
+if (jsonType !== CHUNK_TYPE_JSON) fail('No JSON chunk');
+
+const jsonStart = 20;
+const jsonEnd = jsonStart + jsonLength;
+
+function isNum(ch) {
+  return (
Evidence
PR Compliance ID 6 requires validating expected shapes before property/method access; here the code
reads 32-bit words at fixed offsets (0/4/12/16) without checking the buffer is at least 20 bytes
long, so malformed input can crash the script.

support/glb_set_roughtness_1.js[51-66]
Best Practice: Learned patterns

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 script reads fixed GLB header offsets using `buffer.readUInt32LE(...)` without checking that the file is large enough, which can throw on truncated/corrupt inputs.

## Issue Context
This is a CLI utility intended to fail gracefully on invalid GLB inputs; add an explicit buffer length guard before reading offsets 0/4/12/16.

## Fix Focus Areas
- support/glb_set_roughtness_1.js[51-66]

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



Advisory comments

3. Incorrect usage comment 🐞
Description
The header comment instructs running 'node glb-force-roughness.js ...' but the actual file name is
glb_set_roughtness_1.js, which will cause copy/paste failures.
Code

support/glb_set_roughtness_1.js[R17-21]

+ * Usage
+ * -----
+ *   node glb-force-roughness.js input.glb output.glb
+ *
+ * If output file is omitted, the input file is modified in place.
Evidence
The top-of-file comment shows a different script name than both the actual filename and the runtime
usage error message.

support/glb_set_roughtness_1.js[17-21]
support/glb_set_roughtness_1.js[43-49]

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 usage example in the comment block references a different filename than the actual script.

### Issue Context
Comment says `glb-force-roughness.js` while the file is `glb_set_roughtness_1.js` and the runtime usage string matches the latter.

### Fix Focus Areas
- support/glb_set_roughtness_1.js[17-21]

### Suggested change
- Update the comment usage line to `node glb_set_roughtness_1.js input.glb [output.glb]`.
- (Optional) Consider renaming the file to fix the spelling (`roughness`) and update references accordingly if you want it to be a long-lived utility.

ⓘ 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

@@ -0,0 +1,107 @@
#!/usr/bin/env node
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Action required

1. Bom breaks hashbang 🐞 Bug ☼ Reliability

support/glb_set_roughtness_1.js begins with a UTF-8 BOM before the shebang, which prevents direct
execution (e.g., chmod +x && ./glb_set_roughtness_1.js) because the OS won’t recognize the
interpreter directive.
Agent Prompt
### Issue description
The script has a UTF-8 BOM before the shebang, preventing direct execution via hashbang on Unix-like systems.

### Issue Context
The file currently starts with an invisible BOM character (U+FEFF) before `#!/usr/bin/env node`.

### Fix Focus Areas
- support/glb_set_roughtness_1.js[1-2]

### Suggested change
- Remove the BOM so the very first bytes of the file are `#!`.
- (Optional) Ensure the file ends with a newline.

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

Removed workflow_dispatch trigger from CI configuration.
@sonarqubecloud
Copy link
Copy Markdown

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.

Alignment Tool - Foxeer M10Q-250 Magnetometer Model has wrong alignment

1 participant