Skip to content

Conversation

@demvlad
Copy link
Contributor

@demvlad demvlad commented Sep 28, 2025

Resolved missing DEBUG modes:
"DEBUG_AUTOPILOT",
"CHIRP",
"FLASH_TEST_PRBS"

Summary by CodeRabbit

  • New Features

    • Added debug modes: Autopilot, Chirp, and Flash Test PRBS.
    • Introduced new debug categories: Autopilot Altitude/Position, Optical Flow, FFT Frequency, and TPA.
    • Added Attitude and Servo to available enable options.
  • Changes

    • Migrated dual-gyro debug categories to multi-gyro equivalents.
    • Removed legacy GPS Rescue Throttle PID and Gyro Scaled categories.
    • Expanded FFT frequency labels and adjusted ordering to place Attitude after Gyro.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 28, 2025

Walkthrough

The PR updates src/js/debug.js by adding new debug modes and corresponding field name mappings, renaming/removing several existing mappings (including DUAL_GYRO_* to MULTI_GYRO_* and GPS_RESCUE_THROTTLE_PID), introducing new FFT/autopilot/optical flow/TPA entries, removing GYRO_SCALED, and extending the public enableFields list with Attitude and Servo.

Changes

Cohort / File(s) Summary of changes
Debug modes
src/js/debug.js
Added modes: DEBUG_AUTOPILOT, CHIRP, FLASH_TEST_PRBS.
FieldNames: autopilot/position/flow/TPA/FFT
src/js/debug.js
Added fieldNames blocks: AUTOPILOT_ALTITUDE, AUTOPILOT_POSITION, OPTICALFLOW, TPA, FFT_FREQ (with Notch Center Freq labels), CHIRP, FLASH_TEST_PRBS.
FieldNames: renames/removals
src/js/debug.js
Replaced/removed GPS_RESCUE_THROTTLE_PID with AUTOPILOT_ALTITUDE; removed GYRO_SCALED.
FieldNames: gyro aliasing
src/js/debug.js
Added MULTI_GYRO_RAW/Diff/Scaled aliases mapping to DUAL_*; removed DUAL_GYRO_RAW/DIFF/SCALED definitions.
Enable fields
src/js/debug.js
Appended "Attitude" (after "Gyro") and "Servo" to DEBUG.enableFields.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

RN: IMPROVEMENT

Suggested reviewers

  • nerdCopter
  • VitroidFPV
  • blckmn

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description only lists the names of the newly added DEBUG modes and does not follow the repository’s PR template guidelines, omitting essential context such as a summary of changes, rationale, related issue references, branch and CI/test information. Please expand the description to conform to the repository’s template by removing placeholder text, adding a structured summary of changes, the rationale for these updates, any related issue numbers (e.g., “Fixes #…”), confirmation of CI/test results, and branch details.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title accurately summarizes the primary change by stating that missing DEBUG modes have been resolved, directly reflecting the core update of adding the three new modes and guiding reviewers to the main purpose of the pull request.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@haslinghuis
Copy link
Member

@demvlad this was done in #4606

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/js/debug.js (1)

756-760: Bug: malformed key "debug[all" in SPA

Missing closing bracket breaks the “all” label.

Apply this diff:

-        SPA: {
-            "debug[all": "SPA",
+        SPA: {
+            "debug[all]": "SPA",
🧹 Nitpick comments (1)
src/js/debug.js (1)

851-854: Avoid duplicating CHIRP/FLASH_TEST_PRBS in modes

These entries are already present in the base modes array; adding them again risks duplicates if addArrayElement isn’t de-duping.

Apply this diff to remove the redundant additions:

-        addArrayElement(DEBUG.modes, "CHIRP");
-        addArrayElement(DEBUG.modes, "FLASH_TEST_PRBS");

If you prefer keeping them gated by API 1.47+, instead remove their base entries (Lines 104–106) and keep these two lines.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ac661b6 and 1060be5.

📒 Files selected for processing (1)
  • src/js/debug.js (2 hunks)
🔇 Additional comments (8)
src/js/debug.js (8)

861-868: Good: safe DUAL→MULTI aliasing order

You map MULTI_* first, then delete DUAL_*, preserving references. LGTM.

Does firmware still expose DUAL_GYRO_COMBINED? If renamed, consider providing MULTI_GYRO_COMBINED alias too.


869-879: FFT_FREQ indices changed—confirm against firmware

Indices now place “Gyro Pre Dyn Notch” at [0] and add Notch 1–7 at [1]–[7]. Verify ordering matches API 1.47 telemetry to avoid mislabeled plots.


881-891: AUTOPILOT_ALTITUDE labels look consistent

Clear P/I/D/F and altitude fields; nice replacement for GPS_RESCUE_THROTTLE_PID.


893-901: TPA: expanded labels OK

Overriding older single-field TPA with richer 1.47 mapping is fine.


903-911: OPTICALFLOW mapping added

Looks good; consider clarifying units for “Delta time”.


913-923: AUTOPILOT_POSITION mapping added

Labels are clear and aligned with PID semantics.


925-927: enableFields additions: scope and idempotency

  • “Attitude” is added only for 1.47+, but ATTITUDE labels are defined for 1.46+; confirm this split is intentional.
  • Ensure addArrayElementAfter/addArrayElement are de-duplicating to prevent repeated entries across multiple update() calls.

794-800: FLASH_TEST_PRBS gaps in indices

You define [0], [1], [6], [7] only. If the UI expects contiguous indices for plotting, this may hide series [2]–[5]. Confirm firmware doesn’t output those, or add placeholders.

Comment on lines +104 to 107
"DEBUG_AUTOPILOT",
"CHIRP",
"FLASH_TEST_PRBS",
],
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

New modes added: missing labels for DEBUG_AUTOPILOT

DEBUG_AUTOPILOT has no fieldNames mapping, so the UI will show generic labels or break grouping.

Add a mapping (place alongside other 1.47+ mappings):

// e.g., after AUTOPILOT_POSITION in the 1.47 block
DEBUG.fieldNames.DEBUG_AUTOPILOT = {
  "debug[all]": "Autopilot",
  "debug[0]": "State",
  "debug[1]": "Error",
  "debug[2]": "P",
  "debug[3]": "I",
  "debug[4]": "D",
  "debug[5]": "F",
  "debug[6]": "Setpoint",
  "debug[7]": "Measurement",
};

Run to confirm coverage for the new modes:


🏁 Script executed:

#!/bin/bash
# Verify fieldNames exist for new modes
rg -n 'DEBUG_AUTOPILOT|CHIRP|FLASH_TEST_PRBS' src/js/debug.js
rg -n 'fieldNames\.(DEBUG_AUTOPILOT|CHIRP|FLASH_TEST_PRBS)|fieldNames\["(DEBUG_AUTOPILOT|CHIRP|FLASH_TEST_PRBS)"\]' src/js/debug.js

Length of output: 246


Add missing DEBUG_AUTOPILOT fieldNames mapping

DEBUG_AUTOPILOT is listed under DEBUG.modes but has no corresponding DEBUG.fieldNames.DEBUG_AUTOPILOT block, so UI labels will fall back to generic values. Add it alongside the other 1.47+ mappings, for example:

// after AUTOPILOT_POSITION in the 1.47 block
DEBUG.fieldNames.DEBUG_AUTOPILOT = {
  "debug[all]":           "Autopilot",
  "debug[0]":             "State",
  "debug[1]":             "Error",
  "debug[2]":             "P",
  "debug[3]":             "I",
  "debug[4]":             "D",
  "debug[5]":             "F",
  "debug[6]":             "Setpoint",
  "debug[7]":             "Measurement",
};
🤖 Prompt for AI Agents
In src/js/debug.js around lines 104 to 107, DEBUG.modes includes
"DEBUG_AUTOPILOT" but there is no corresponding DEBUG.fieldNames.DEBUG_AUTOPILOT
mapping, so UI labels fall back to generic values; add a new
DEBUG.fieldNames.DEBUG_AUTOPILOT block in the 1.47+ mappings (place it after
AUTOPILOT_POSITION) with keys "debug[all]", "debug[0]" through "debug[7]" and
values "Autopilot", "State", "Error", "P", "I", "D", "F", "Setpoint", and
"Measurement" respectively to match other mode mappings.

@demvlad
Copy link
Contributor Author

demvlad commented Sep 28, 2025

@demvlad this was done in #4606

Ok.
Yes, really:)
Seems i've made git pull master before, but had some mistake probably.. Therefore last update was missed..

@demvlad demvlad closed this Sep 28, 2025
@demvlad demvlad deleted the debug_modes branch September 28, 2025 14:12
@demvlad demvlad restored the debug_modes branch September 28, 2025 20:47
@demvlad
Copy link
Contributor Author

demvlad commented Sep 28, 2025

@haslinghuis
Sorry, but i am seeing this in master now:
const DEBUG = {
modes: [
"NONE",
"CYCLETIME",
"BATTERY",
"GYRO_FILTERED",
....
....
"TASK",
"GIMBAL",
"WING_SETPOINT",
]

@demvlad demvlad reopened this Sep 28, 2025
@sonarqubecloud
Copy link

@github-actions
Copy link
Contributor

Preview URL: https://pr4636.betaflight-app.pages.dev

@haslinghuis
Copy link
Member

haslinghuis commented Sep 28, 2025

image image image

@demvlad
Copy link
Contributor Author

demvlad commented Sep 28, 2025

@haslinghuis Sorry, but i am seeing this in master now: const DEBUG = { modes: [ "NONE", "CYCLETIME", "BATTERY", "GYRO_FILTERED", .... .... "TASK", "GIMBAL", "WING_SETPOINT", ]

:) Yes, this is very interested!
Is it working witout this enum definition?

@haslinghuis
Copy link
Member

@demvlad check the update function. There you can sniff the values more reliable.

@demvlad
Copy link
Contributor Author

demvlad commented Sep 28, 2025

@demvlad check the update function. There you can sniff the values more reliable.

Sorry, i've forgot. For the new versions only:)
I make a local version for MAVLink til.

@demvlad demvlad closed this Sep 28, 2025
@demvlad demvlad deleted the debug_modes branch September 28, 2025 21:47
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