Skip to content

Conversation

@sensei-hacker
Copy link
Member

@sensei-hacker sensei-hacker commented Oct 12, 2025

User description

The code intended to mark satellite slots with no signal as unused.
Due to a missing array index, it instead marked the FIRST satellite as unused, leaving the ones with no signal marked valid.

This change adds the array index so it sets the proper satellites as no signal.

@mmosca Can you please confirm this is what was intended.


PR Type

Bug fix


Description

  • Fixed array indexing bug in satellite signal handling

  • Corrected marking of satellites with no signal as unused

  • Previously marked first satellite instead of proper indices


Diagram Walkthrough

flowchart LR
  A["Iterate satellites"] --> B["Mark unused satellites"]
  B --> C["Fixed: Use index [i]"]
  C --> D["Correctly set gnssId/svId to 0xFF"]
Loading

File Walkthrough

Relevant files
Bug fix
gps_ublox.c
Fix satellite array indexing for unused slots                       

src/main/io/gps_ublox.c

  • Added array index [i] to satelites pointer in loop
  • Fixed bug where first satellite was incorrectly marked instead of
    satellites with no signal
  • Corrected assignment of gnssId and svId to 0xFF for unused satellite
    slots
+2/-2     

@qodo-code-review
Copy link
Contributor

qodo-code-review bot commented Oct 12, 2025

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
No custom compliance provided

Follow the guide to enable custom compliance check.

  • Update
Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@qodo-code-review
Copy link
Contributor

qodo-code-review bot commented Oct 12, 2025

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Use dot operator for struct
Suggestion Impact:The commit changed satelites[i]->gnssId and svId to satelites[i].gnssId and satelites[i].svId, implementing the suggested fix.

code diff:

-                satelites[i]->gnssId = 0xFF;
-                satelites[i]->svId = 0xFF;
+                satelites[i].gnssId = 0xFF;
+                satelites[i].svId = 0xFF;

Replace the incorrect pointer member access operator -> with the direct member
access operator . when accessing fields of satelites[i], as it is a struct, not
a pointer.

src/main/io/gps_ublox.c [748-751]

 for(int i =_buffer.svinfo.numSvs; i < UBLOX_MAX_SIGNALS; ++i) {
-    satelites[i]->gnssId = 0xFF;
-    satelites[i]->svId = 0xFF;
+    satelites[i].gnssId = 0xFF;
+    satelites[i].svId = 0xFF;
 }

[Suggestion processed]

Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies a bug in the PR where the -> operator is used on a struct instance (satelites[i]) instead of a pointer, which would cause a compilation error.

High
  • Update

@sensei-hacker sensei-hacker requested a review from mmosca October 12, 2025 17:17
@sensei-hacker sensei-hacker merged commit 400f8f9 into iNavFlight:master Oct 13, 2025
21 checks passed
@MrD-RC MrD-RC added this to the 9.0 milestone Oct 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants