-
-
Notifications
You must be signed in to change notification settings - Fork 156
Update MAG_HARDWARE #861
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update MAG_HARDWARE #861
Conversation
WalkthroughMakes ACC_HARDWARE_COMPLETE a local constant and introduces a local MAG_HARDWARE_COMPLETE while changing Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant App
participant adjustFieldDefsList
participant Firmware as FirmwareVersion
participant Arrays as "ACC/MAG arrays"
App->>adjustFieldDefsList: call with firmware context
adjustFieldDefsList->>Firmware: check beta flag and version thresholds
alt Beta firmware
adjustFieldDefsList->>Arrays: ACC_HARDWARE = ACC_HARDWARE_COMPLETE.slice(0)
adjustFieldDefsList->>Arrays: MAG_HARDWARE = MAG_HARDWARE_COMPLETE.slice(0)
end
alt Version >= 4.5.0
adjustFieldDefsList->>Arrays: MAG_HARDWARE.splice(indexOf("LIS3MDL"),0,"LIS2MDL")
adjustFieldDefsList->>Arrays: MAG_HARDWARE.push("IST8310")
end
alt Version >= 2025.12.0
adjustFieldDefsList->>Arrays: MAG_HARDWARE.push("QMC5883P")
end
adjustFieldDefsList->>Arrays: wrap ACC_HARDWARE and MAG_HARDWARE with makeReadOnly(...)
adjustFieldDefsList-->>App: return updated field defs
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (1)📚 Learning: 2025-09-24T23:23:01.244ZApplied to files:
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/flightlog_fielddefs.js (1)
536-539: Guard against missing LIS3MDL indexIf LIS3MDL is ever absent, splice(-1, …) inserts at the wrong position. Add a guard and fallback to push.
Apply:
- MAG_HARDWARE.splice(MAG_HARDWARE.indexOf("LIS3MDL"), 0, "LIS2MDL"); + { + const i = MAG_HARDWARE.indexOf("LIS3MDL"); + if (i !== -1) { + MAG_HARDWARE.splice(i, 0, "LIS2MDL"); + } else { + MAG_HARDWARE.push("LIS2MDL"); + } + } MAG_HARDWARE.push("IST8310");
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/flightlog_fielddefs.js(6 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-24T23:23:01.244Z
Learnt from: haslinghuis
PR: betaflight/blackbox-log-viewer#859
File: src/flightlog_fields_presenter.js:1315-1325
Timestamp: 2025-09-24T23:23:01.244Z
Learning: In the blackbox-log-viewer codebase, firmware version pre-release identifiers (like "-rc1", "-rc2") are stripped from the `firmwareVersion` property, so Betaflight 4.5.0-RC1 would be exposed as just "4.5.0" for version comparison purposes.
Applied to files:
src/flightlog_fielddefs.js
🔇 Additional comments (5)
src/flightlog_fielddefs.js (5)
420-432: Public MAG lists: good API shapeExporting MAG_HARDWARE as mutable (then frozen per firmware) and adding MAG_HARDWARE_COMPLETE aligns with the ACC pattern and enables version-specific tailoring.
510-515: Init symmetry for MAG_HARDWAREInitializing MAG_HARDWARE alongside ACC_HARDWARE for BF >= 3.3.0 is correct. Comment rename is fine.
571-572: Freezing MAG_HARDWARE post-adjustment is correctPrevents accidental mutation after construction, while keeping the binding reassignable for subsequent adjust calls.
382-406: ACC_HARDWARE_COMPLETE isn’t referenced outside this file; no export is needed.
550-551: Verify firmware support for QMC5883P
No other UI strings or parser references were found—only this fielddef. Confirm that firmware’s MAG_HARDWARE enum (e.g., in flight_log.h) actually includes QMC5883P by version 2025.12.0.
bc9c74d
|
|
Preview URL: https://pr861.betaflight-blackbox.pages.dev |



Summary by CodeRabbit
New Features
Improvements