Skip to content

Add USB OSD Parameter Editor for Screens 5 and 6 - #379

Open
Hwurzburg wants to merge 11 commits into
ArduPilot:mainfrom
Hwurzburg:add-osd-editor
Open

Hwurzburg wants to merge 11 commits into
ArduPilot:mainfrom
Hwurzburg:add-osd-editor

Conversation

@Hwurzburg

@Hwurzburg Hwurzburg commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

This PR adds a browser-based ArduPilot OSD Parameter Editor, developed by Atx_Heli.

The utility allows users to configure the nine adjustable parameter slots on OSD Screens 5 and 6.

OSDParamScreenEditor_screenshot

Features

  • Direct USB connectivity using the Web Serial API
  • MAVLink read/write of OSD parameter assignments
  • Searchable parameter dropdowns
  • Automatic Plane, Copter, and Rover metadata loading
  • Offline configuration with JSON import/export
  • Individual slot enable/disable controls
  • Editable Min, Max, and Increment values
  • CLEAR ALL function
  • Color-coded activity logging and operation progress indicators

The tool is also added to the main WebTools index page with an icon.

Compatibility

Works in desktop Chrome, Edge and Firefox using Web Serial, with no additional software installation required. Requires HTTPS or localhost. Safari is not supported (no Web Serial).

Testing

Tested extensively on PC in both Chrome and Firefox with an ArduPlane 4.8-dev flight controller, including USB connect, read, write and verification of OSD slots.

Author: Atx_Heli

🤖 Generated with Claude Code

Browser-based editor, developed by Atx_Heli, for the nine adjustable
parameter slots on OSD Screens 5 and 6, offline or over USB via Web
Serial and MAVLink. Adds the tool to the main index with an icon.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@IamPete1 IamPete1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should make use of existing modules. Everything needs un-minifying so it can be reivewed.

I would prefer than the style matched the other WebTools, but I don't care that much.

Comment thread OSDParamScreenEditor/mavlink.js Outdated
@@ -0,0 +1,58 @@
'use strict';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We already have a MAVLink implementation in modules/MAVLink. This new tool should use that so we only have to keep it upto date in one spot.

@@ -0,0 +1,8 @@
<!doctype html>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Its impossible to review minified code. Please re-format.

@@ -0,0 +1,90 @@
'use strict';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Per html please un minify to make it easier to review.

Comment thread OSDParamScreenEditor/style.css Outdated
@@ -0,0 +1,48 @@
:root{font:15px/1.5 system-ui,-apple-system,Segoe UI,sans-serif;color:#223247;background:#eef3f8}*{box-sizing:border-box}body{margin:0}.wrap{max-width:1320px;margin:auto;padding:24px}header{padding:20px 4px 16px}h1{font-size:clamp(28px,4vw,40px);line-height:1.1;color:#123a73;margin:5px 0}.eyebrow{font-size:12px;font-weight:800;letter-spacing:1.8px;color:#446991}.by{font-weight:700;color:#123a73;margin:8px 0}.notice{background:#fff6df;border:1px solid #e5c97c;border-left:5px solid #bd8525;padding:13px 16px;border-radius:8px;margin:12px 0 18px}.card{background:#fff;border:1px solid #d8e2ed;border-radius:12px;box-shadow:0 3px 18px #2442600a;margin:15px 0;padding:18px}.toolbar{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin:4px 0 12px}.toolbar:last-child{margin-bottom:0}button,.filebtn,select{font:inherit;border-radius:7px;border:1px solid #b6c8da;padding:8px 12px;background:#f8fbff;color:#163b68;cursor:pointer}button:hover,.filebtn:hover{background:#e5effb}button:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid #78aaf1;outline-offset:1px}label{font-weight:600}select{margin-left:6px}#fetchMeta,#saveJson{background:#123a73;color:white;border-color:#123a73}#fetchMeta:hover,#saveJson:hover{background:#22558f}.muted{color:#667789;font-weight:400}.tiny{font-size:12px}.tabs{display:flex;gap:8px;border-bottom:1px solid #d8e2ed;padding-bottom:10px;margin-bottom:14px}.tabs button.active{background:#123a73;color:#fff}.tablewrap{overflow-x:auto}table{border-collapse:collapse;width:100%;min-width:980px}th{background:#edf3f9;color:#304e6d;text-align:left;font-size:13px}th,td{border-bottom:1px solid #e6ecf2;padding:10px 8px;vertical-align:middle}th small{display:block;font-weight:400}td:first-child{font-weight:700;color:#123a73;text-align:center}input[type=text],input[type=number]{font:inherit;width:100%;padding:8px;border:1px solid #bdccda;border-radius:6px;background:#fff}input[type=text]:focus,input[type=number]:focus{border-color:#4174a8}td:nth-child(2){width:30%}td:nth-child(n+3):nth-child(-n+5){width:12%}.desc{font-size:12px;color:#65758a;max-width:280px;overflow-wrap:anywhere}.logtop{display:flex;justify-content:space-between;align-items:center}.logtop h2{font-size:18px;margin:0 0 10px}#log{min-height:100px;max-height:230px;overflow:auto;background:#f7f9fc;border:1px solid #dfe7ef;border-radius:7px;padding:10px;font:13px/1.6 ui-monospace,Consolas,monospace}.log-success{color:#16743b}.log-warning{color:#b3242d}.log-info{color:#334b63}footer{text-align:center;color:#6c7d90;padding:16px}@media(max-width:600px){.wrap{padding:12px}.card{padding:12px}.toolbar>*{flex-grow:1}}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

unminify

Address review feedback:
- Reformat index.html, app.js, style.css and usb.js so they can be
  reviewed (app.js formatting only, no code changes)
- Remove the bundled MAVLink codec and use modules/MAVLink/mavlink.js;
  usb.js keeps only the Web Serial transport
- Correct browser support notes: Firefox works on Windows, but snap
  builds of Firefox and Chromium on Linux cannot access serial ports
- README: serve from the repo root so the shared module loads

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Hwurzburg

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Pushed d666196:

  • Un-minified: index.html, app.js, style.css and usb.js are now properly formatted. The app.js change is formatting only (the parsed code is identical).
  • Shared MAVLink module: removed the tool's own mavlink.js; it now loads modules/MAVLink/mavlink.js and uses MAVLink20Processor / mavlink20.messages.*. usb.js keeps only a small Web Serial transport.

Tested against a real flight controller over USB, and lint passes.

I've left matching the styling of the other WebTools for a follow-up, since you said it wasn't essential. Happy to do it in this PR if you'd prefer.

@Hwurzburg

Hwurzburg commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor Author

here is screenshot of re-styled to your style sheet, if you insist...of course I like mine better
Screenshot from 2026-11-19 17-44-33

@Hwurzburg
Hwurzburg requested a review from IamPete1 November 20, 2026 13:22

@IamPete1 IamPete1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Left a few more comments.

Comment thread OSDParamScreenEditor/app.js Outdated
Comment on lines +3 to +5
Plane: 'https://autotest.ardupilot.org/Parameters/ArduPlane/apm.pdef.xml',
Copter: 'https://autotest.ardupilot.org/Parameters/ArduCopter/apm.pdef.xml',
Rover: 'https://autotest.ardupilot.org/Parameters/Rover/apm.pdef.xml',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The other tools just include the json files directly. Removing the need to mess about running a fetch and allowing the tool to run offline.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in f861095. Each vehicle now has a bundled <Vehicle>_params.json (Plane, Copter, Rover), loaded the same way as the other tools, so there is no runtime fetch and it works offline. They are full parameter lists, because any writable parameter can go in a slot, trimmed to just display name, range and increment (~450 KB each). Read-only parameters are left out. update_params.py regenerates them from the published apm.pdef.json.

Comment thread OSDParamScreenEditor/app.js Outdated
for (const screen of [5, 6]) for (let slot = 1; slot <= 9; slot++) state.slots[`${screen}:${slot}`] = emptySlot();
// Show an in-progress label until the action settles, including failures.
// Allow one paint frame so synchronous operations visibly update their button.
async function withProgress(id, label, action) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this is equivalent to our pre-existing loading overlay helper. Search for init_loading_overlay and loading_call

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed, switched to Libraries/LoadingOverlay.js and removed withProgress. The overlay is only used for the slow FC read and write. The other buttons (save, clear, fill, etc.) are instant, so they now just run directly.

Comment thread OSDParamScreenEditor/app.js Outdated
await downloadMetadata();
}),
);
$('xmlFile').addEventListener('change', event => loadFile(event, text => applyMetadata(text, 'local XML')));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does anyone actually ever need to do this? If they do then you would be better off getting them to load the json param def.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No, it was only a fallback for when the autotest fetch was blocked. Now that the metadata is bundled it is not needed, so it has been removed, along with the Download metadata button.

Comment thread OSDParamScreenEditor/app.js Outdated
Comment on lines +466 to +468
$('jsonFile').addEventListener('change', event => loadFile(event, loadJson));
$('paramFile').addEventListener('change', event => loadFile(event, parseParam));
$('saveJson').addEventListener('click', () => withProgress('saveJson', 'SAVING…', saveJson));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Its not clear to me how the json that can be saved and loaded is different from a param file. Does it include any more information?

@Hwurzburg Hwurzburg Nov 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, it holds the part a .param file can't: the parameter assigned to each slot. In a .param file the slot assignment is stored as OSDn_PARAMm_KEY/IDX/GRP, which are internal AP_Param key/index/group numbers. They aren't readable and can't be turned back into a parameter name without the firmware, which is why the .param import only brings in MIN/MAX/INCR/EN. The JSON saves each slot by name (e.g. RLL_RATE_P) plus its ranges and enable state, so a layout can be saved, shared and applied to another FC. That matters for usability, so I'd like to keep it. I've added this explanation to the README.

Comment on lines +24 to +42
<div class="toolbar">
<label
>USB baud
<select id="baud" title="USB serial speed; 115200 is typical">
<option>115200</option>
<option>57600</option>
<option>921600</option>
<option>460800</option>
</select></label
><button id="usbConnect" title="Choose a USB serial device using the browser permission dialog">
Connect USB</button
><button id="usbDisconnect" title="Close USB connection">Disconnect</button
><button
id="readFC"
title="Read FC parameters and OSD slots; replaces the editor's current slot assignments"
>
Read from FC</button
><button id="writeFC" title="Write changed OSD slots and verify them">Write to FC</button
><span id="usbStatus" class="muted" aria-live="polite">Disconnected</span>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does supporting MAVLink and USB add enough value compared to just downloading a param param file and then loading it with your favorite GCS. All the other WebTools just give you a param file.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I guess one enhancement would be to allow loading a log and then extract the params from it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For this tool I think it's the core of it, for the same reason as the JSON. Assigning a parameter to a slot by name only works through OSD_PARAM_CONFIG / OSD_PARAM_SHOW_CONFIG, where the FC resolves the name to key/idx/grp itself. A param-file-only tool could set the ranges but couldn't show what's in each slot or change it, and that's the main thing users struggle with. Mission Planner has an equivalent screen, but QGC and MAVProxy users don't.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nice idea, but a log has the same problem: it records the slot as KEY/IDX/GRP numbers, not names, and I don't know of a way to map those back to a parameter name without the firmware. So I'll leave log loading out for now.

Comment thread OSDParamScreenEditor/index.html Outdated
<div class="toolbar">
<label
>Vehicle
<select id="vehicle" title="Select a vehicle type to load its published parameter catalog">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If you did load from a log then you could get the vehicle type along with the params. If you keep the MAVLink stuff you should also be able to get (guess) the vehicle type from the heartbeat.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done. When connected, the vehicle is now set from the heartbeat MAV_TYPE, including all multirotor, heli and VTOL types. The manual selector stays for offline editing.

Comment thread OSDParamScreenEditor/index.html Outdated
><button id="saveJson" title="Save both OSD screens as a desktop-compatible JSON project">
Save JSON</button
><label class="filebtn" title="Import numeric OSD fields from a Mission Planner .param file"
>Load .param<input id="paramFile" type="file" accept=".param,.txt,text/plain" hidden /></label

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should also add .parm which I think is what MAVProxy give you.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added .parm in f861095.

- Bundle per-vehicle parameter metadata (<Vehicle>_params.json) instead of
  fetching apm.pdef.xml at runtime; add update_params.py to regenerate it
  from the published apm.pdef.json, keeping only writable params with
  display name, range and increment
- Remove Download metadata and Load metadata XML
- Use the shared LoadingOverlay for FC read/write instead of a custom
  button progress helper
- Set vehicle from heartbeat for all copter, heli and VTOL MAV_TYPEs
- Accept .parm files
- README: explain why JSON is needed to keep slot assignments

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@AP-Review

AP-Review commented Nov 22, 2026 •

Copy link
Copy Markdown

Deprecated — see below for the updated review.

Previous review (2026-11-22)

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: REQUEST CHANGES

Reviewed at head f8610950ce.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/webtools/379/1.html#prWebTools-379

The new OSD Parameter Editor works for the common read/edit/write path, and the earlier maintainer points (shared MAVLink module, un-minified code, bundled metadata, shared loading overlay, .parm, vehicle from heartbeat) are addressed. One write-path bug needs fixing before merge.

Blocking

  1. OSDParamScreenEditor/app.js:129: changing a slot's parameter keeps the old config_type read from the FC. When you replace a typed stock slot (e.g. Copter screen 6 slot 7 RC7_OPTION, AUX_FUNCTION) with ATC_RAT_RLL_P, the firmware ignores the ranges you entered and applies 0..105 step 1. The readback only checks the name, so the tool still says "verified successfully". Reset config_type to 0 when the name changes (also the typed-name path at line 170), and check the returned type and ranges on readback.

Should fix

  • OSDParamScreenEditor/usb.js:437: a slot the FC reports as invalid (result 2, a dangling KEY/IDX/GRP) is left out of baseline, so edits to it are dropped with "No changes since the last FC read". OSD_PARAM_CONFIG can repair such a slot. Treat result 2 as an unassigned slot that can be written, separately from timeouts.
  • OSDParamScreenEditor/app.js:373: exporting .param writes EN,0 for every enabled slot without a name. After a .param import, which can't recover names, an unchanged export disables those slots. Emit EN from slot.enabled, or warn.
  • OSDParamScreenEditor/usb.js:520: write verification compares only the name, then copies the editor state into baseline. Check type/min/max/increment from showSlot() with sameNumber() and store the FC's values.
  • OSDParamScreenEditor/usb.js:69: a Web Serial read error calls onDisconnect twice and never calls disconnect(). The port stays open with its locks held, pending requests wait for their timeouts, and link is dropped, so the port can't be closed or reopened without a reload. Route read-loop exit through disconnect().

Low

  • OSDParamScreenEditor/app.js:169: clearing the name by typing leaves the slot enabled, so Write aborts with "enabled but has no parameter name". The README and the page text say clearing the name disables the slot.
Minor (3)
  • OSDParamScreenEditor/usb.js:169: picking the vehicle from MAV_TYPE is ambiguous. A QuadPlane with Q_MAV_TYPE=2 selects Copter, and a Copter tailsitter (VTOL_DUOROTOR) selects Plane. Only the picker and range suggestions are affected.
  • OSDParamScreenEditor/index.html:21: "Disabled slots now display…" and the "WebTools v12" footer at line 109 look like development notes. Optional.
  • Firmware note (outside this PR): on SITL Rover at the submodule pin, OSD_PARAM_SHOW_CONFIG on a slot never set via OSD_PARAM_CONFIG segfaulted in AP_OSD_ParamSetting::update(). That is an ArduPilot/ardupilot issue, but it limits SITL testing of this tool.

- Reset a slot's config_type when its parameter changes, so the ranges
  entered are applied instead of the old type's fixed ranges
- Verify type and ranges on write readback, and store the FC's values
- Treat OSD_PARAM_INVALID_PARAMETER_INDEX replies as empty, writable slots
- Close the port properly when the serial read loop fails
- Export .param enable flags from the Enable checkbox
- Disable a slot when its name is cleared by typing
- Confirm the vehicle type from the FC parameter list
- Remove development notes from the page

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Hwurzburg

Copy link
Copy Markdown
Contributor Author

Addressed the automated review in 6c656bc (checked against AP_OSD_ParamSetting::set_by_name / AP_OSD_ParamScreen::handle_read_msg):

Blocking

  • Changing a slot's parameter (picked or typed) now resets config_type to 0, so the entered ranges apply. If the name is changed back to the one read from the FC, its original type is restored.

Should fix

  • Write readback now checks type and ranges as well as the name (sameNumber()), and stores the FC's values in the baseline and editor. If a typed slot gets the FC's fixed ranges, a warning is logged.
  • OSD_PARAM_INVALID_PARAMETER_INDEX (result 2) replies are treated as empty, disabled, writable slots, so they can be repaired with OSD_PARAM_CONFIG. Timeouts are still handled separately.
  • .param export writes EN from the slot's Enable checkbox.
  • Serial read-loop errors now go through disconnect(), which runs once, releases the locks and closes the port, so it can be reopened without a reload.

Low / minor

  • Clearing the name by typing disables the slot once the field is left (or Enter is pressed).
  • The vehicle is now confirmed from the parameter list after Read from FC (Q_ENABLE → Plane, MODE1 without FLTMODE1 → Rover, PILOT_SPEED_UP → Copter), which fixes the QuadPlane / tailsitter MAV_TYPE mix-ups.
  • Removed the development notes from the page text and footer.
  • README updated.

The SITL segfault is a firmware issue, outside this PR.

@Hwurzburg
Hwurzburg requested review from IamPete1 and removed request for IamPete1 November 22, 2026 16:18
@AP-Review

AP-Review commented Nov 22, 2026 •

Copy link
Copy Markdown

Deprecated — see below for the updated review.

Previous review (2026-11-22)

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: COMMENT

Reviewed at head 2c80cf7501.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/webtools/379/2.html#prWebTools-379

No blocking issues remain at this head. A few smaller lifecycle and UI points are left. Since the last review, 6c656bc fixed the config_type blocker and all four should-fix items: result-2 slots, .param EN export, full readback checks and read-error cleanup. It also fixed the cleared-name and QuadPlane detection points.

Should fix

  • OSDParamScreenEditor/usb.js:364: if USB drops partway through Read from FC, the remaining slot reads fail on the null link, but a partial baseline is still published. connectUsb() keeps it, so after reconnecting, Write is enabled against the previous read (possibly of another FC). Clear baseline at read start and on connect, and drop the read result if link changed during it.

Low

  • OSDParamScreenEditor/usb.js:233: vehicle detection (still open, narrowed). PILOT_SPEED_UP was renamed to PILOT_SPD_UP in Copter 4.7, so Copter is never detected from the parameter list and a Copter tailsitter stays on Plane. Test PILOT_SPD_UP too.
  • OSDParamScreenEditor/app.js:186: after typing a different parameter name and leaving the field, the Current value cell still shows the old parameter's value and tooltip. Refresh that cell when the name changes.
Minor (3)
  • OSDParamScreenEditor/style.css:165: the new Current value column moved Min/Max/Increment to columns 4–6, but this width rule and the disabled-slot rule at line 245 still use the old positions, so a disabled slot's Increment box stays white. Shift the ranges or use classes.
  • OSDParamScreenEditor/usb.js:248: Connect stays clickable while port.open() is pending, so a second click can open another port that Disconnect never closes. Disable the button or set a connecting flag before the first await.
  • OSDParamScreenEditor/usb.js:122: when send() fails, request() rejects waiting and rethrows without handling it, which gives an unhandledrejection in the console. Add waiting.catch(() => {}) before rethrowing.

The earlier SITL segfault note is firmware-side and is not carried forward.

- Clear the read baseline on connect and at read start, and abort a read
  whose USB link dropped or changed, so Write can't be enabled from a
  partial or stale read
- Detect Copter from PILOT_SPD_UP (Copter 4.7+) as well as PILOT_SPEED_UP
- Refresh the Current value cell when the parameter name is edited
- Shift Min/Max/Increment CSS column ranges for the new Current value column
- Block repeat Connect clicks while the port is opening
- Swallow the orphaned wait rejection when send() fails in request()

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@AP-Review

AP-Review commented Nov 22, 2026 •

Copy link
Copy Markdown

Deprecated — see below for the updated review.

Previous review (2026-11-22)

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: COMMENT

Reviewed at head 0ca3766071.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/webtools/379/3.html#prWebTools-379

No blocking issues at this head; three small points remain. Since the last review, 0ca3766 fixed the stale-baseline should-fix item and all five lower-severity items: Copter detection from PILOT_SPD_UP, Current value refresh on typing, CSS column ranges, the Connect re-entry guard and the unhandled send rejection.

Low

  • OSDParamScreenEditor/usb.js:250: the Current value column keeps the previous FC's values and the "Current FC value of X" tooltip after Disconnect and after connecting to another FC, because only Read from FC resets fcParams. This is display-only, since Write still needs a fresh read. Reset fcParams next to baseline on connect (and on disconnect), then render().
  • OSDParamScreenEditor/usb.js:354: if the parameter stream ends early and a slot's OSDn_PARAMm_EN was missed, that slot is treated as enabled. Editing only its range then enables it on the FC, because OSD_PARAM_CONFIG always sets EN, and setEnable() skips the unknown flag. Fetch missing EN values with PARAM_REQUEST_READ, or leave those slots out of the writable baseline.
Minor (1)
  • OSDParamScreenEditor/usb.js:221: onDisconnect clears the global link without checking which connection closed. If Read from FC aborts on a serial error while the old port.close() is still pending, a new connection made in that window loses link. It then drops on its next heartbeat with a "Cannot read properties of null" warning. Ignore callbacks from an instance that is no longer link.

- Clear FC parameter values on connect and disconnect so the Current
  value column doesn't show a previous FC's values
- Fetch a slot's OSDn_PARAMm_EN with PARAM_REQUEST_READ if the parameter
  list missed it; if still unknown, leave the slot out of the writable
  baseline so a range edit can't silently enable it
- Ignore disconnect callbacks from a connection that is no longer current

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@AP-Review

AP-Review commented Nov 22, 2026 •

Copy link
Copy Markdown

Deprecated — see below for the updated review.

Previous review (2026-11-22)

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: COMMENT

Reviewed at head 8748b1354f.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/webtools/379/4.html#prWebTools-379

No blocking issues at this head; two small points remain. Since the last review, 8748b13 fixed all three earlier items: the stale Current value column, slots with an unknown enable flag being writable, and a late disconnect callback dropping a new connection.

Low

  • OSDParamScreenEditor/usb.js:522: changes holds the live slot objects, so a name edited while Write is running is sent (R563) with the earlier ranges, wasn't in the confirmation, and still verifies against the edited state (R597). Snapshot name, config_type and ranges when building changes, then send and verify against that snapshot.
Minor (1)
  • OSDParamScreenEditor/usb.js:450: sameNumber()'s absolute 1e-5 floor treats an increment change such as 0.000001 to 0.00001 (BCN_LATITUDE) as no change, so Write reports nothing to do. Compare at float32 precision without the absolute floor.

- Snapshot each changed slot when Write starts, so edits made while it
  runs can't change what is sent or what the readback is checked against.
- Compare ranges at float32 precision with no absolute floor, so small
  increment changes (e.g. 1e-6 -> 1e-5) are detected.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Hwurzburg

Copy link
Copy Markdown
Contributor Author

Addressed the latest automated review in cfac013:

Low

  • Write now copies each changed slot (name, config_type, ranges, enable state) when it builds the change list. It sends and verifies against that copy, so an edit made while Write is running can't change what is sent or what the readback is checked against.

Minor

  • sameNumber() now compares at float32 precision (1-ulp relative tolerance) with no absolute floor, so small increment changes such as 0.000001 → 0.00001 (BCN_LATITUDE) are detected. Values that differ only by float32 rounding on readback still match.

@AP-Review

AP-Review commented Nov 23, 2026 •

Copy link
Copy Markdown

Deprecated — see below for the updated review.

Previous review (2026-11-23)

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: COMMENT

Reviewed at head cfac013b4f.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/webtools/379/5.html#prWebTools-379

No blocking issues at this head; one small regression remains. Since the last review, cfac013 fixed both earlier items: Write now sends and verifies a snapshot of each slot, and small increment changes such as 0.000001 to 0.00001 are now detected.

Low

  • OSDParamScreenEditor/usb.js:449: the new 1-ulp sameNumber() is stricter than showSlot()'s 7-digit readback (R314). Some values with more than 7 significant digits, such as max 12345.678 (read back as 12345.68), therefore fail the check at R603 with 'readback range mismatch', and baseline is cleared, even though the FC stored what was sent. Compare against the raw decoded float32 values, or round wanted the same way, without bringing back the absolute floor.

Round the sent range values the same way as the FC readback (float32,
7 significant digits) before comparing, so values with more than 7
significant digits no longer fail verification.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Hwurzburg

Copy link
Copy Markdown
Contributor Author

Addressed the latest automated review in 77e22c0:

Low

  • The readback check now rounds the sent min/max/increment the same way as the values read from the FC (float32, then 7 significant digits, via a shared fcText() helper) before comparing. Values with more than 7 significant digits, such as 12345.678, no longer fail with "readback range mismatch". There is still no absolute floor, so small changes such as 0.000001 → 0.00001 are still detected.

@AP-Review

AP-Review commented Nov 23, 2026 •

Copy link
Copy Markdown

Deprecated — see below for the updated review.

Previous review (2026-11-23)

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: COMMENT

Reviewed at head 77e22c00a8.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/webtools/379/6.html#prWebTools-379

No blocking issues at this head; two small float-precision points remain. Since the last review, 77e22c0 fixed the false readback mismatch for values such as 12345.678, and small increment changes are still detected.

Low

  • OSDParamScreenEditor/usb.js:609: some exact float32 tie values, such as max 6593937.25 or 16777225, still give a false 'readback range mismatch' and clear baseline. jspack rounds the tie up when sending, while fcText() rounds it to even with Math.fround, and the two land on different 7-digit strings. Compare the raw decoded float with Number(sent) using sameNumber().
  • OSDParamScreenEditor/usb.js:315: the slot stores the 7-digit text, and Write re-sends all three ranges when any of them changes. An untouched range is therefore rewritten, for example ADSB_ICAO_ID max 16777215 becomes 16777220 after an increment-only edit. Keep the decoded float (or use 9 significant digits, which round-trips float32) for sending and verifying.

- Store ranges read from the FC as the shortest decimal that converts back
  to the same float32 (instead of 7 significant digits), so an untouched
  range is re-sent unchanged, e.g. ADSB_ICAO_ID max 16777215
- Verify readback against the values sent with the 1-ulp sameNumber(),
  so float32 ties that jspack rounds up (6593937.25, 16777225) no longer
  give a false readback range mismatch

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Hwurzburg

Copy link
Copy Markdown
Contributor Author

Addressed the latest automated review in cc1eae7:

Low

  • Ranges read from the FC are now stored as the shortest decimal that converts back to exactly the same float32, instead of 7 significant digits. An untouched range is re-sent unchanged, so ADSB_ICAO_ID max 16777215 no longer becomes 16777220 after an increment-only edit. Ordinary values still display normally (0.1, 12345.678).
  • The readback check compares the FC's value with what was sent using the 1-ulp sameNumber(), so float32 ties that jspack rounds up (6593937.25, 16777225) no longer give a false "readback range mismatch". Small changes such as 0.000001 → 0.00001 are still detected.

@AP-Review

AP-Review commented Nov 24, 2026 •

Copy link
Copy Markdown

Deprecated — see below for the updated review.

Previous review (2026-11-24)

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: COMMENT

Reviewed at head cc1eae7872.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/webtools/379/7.html#prWebTools-379

No blocking issues at this head; three small points remain. Since the last review, cc1eae7 fixed both float-precision items: untouched ranges such as ADSB_ICAO_ID max 16777215 are now re-sent unchanged, and tie values such as 6593937.25 no longer give a false readback mismatch.

Low

  • OSDParamScreenEditor/app.js:38: the bundled metadata has the mixed-case key FOLLP_LkAHD (an upstream @Param typo in plane_follow.lua), but the FC parameter is FOLLP_LKAHD. Choosing it from the picker makes Write fail with "not in the FC parameter list". Uppercase the names in parseMetadata().
Minor (2)
  • OSDParamScreenEditor/usb.js:113: request() awaits send() before it handles waiting. If writer.write() stalls past the timeout, the timeout becomes an unhandled rejection and Read/Write stay busy until the write finishes. Attach the rejection handler up front, for example by racing send() against waiting.
  • OSDParamScreenEditor/usb.js:446: the comment says "within a quarter ulp", but < |f| * 2 ** -25 accepts anything up to just under half an ulp. Say "strictly less than half an ulp".

- Upper-case parameter names when loading bundled metadata, so the
  upstream mixed-case FOLLP_LkAHD matches the FC's FOLLP_LKAHD.
- Race send() against the response wait in request(), so a stalled
  serial write still times out instead of leaving Read/Write busy.
- Correct the fcText() comment: the tolerance is strictly under half
  an ulp, not a quarter.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Hwurzburg

Copy link
Copy Markdown
Contributor Author

Addressed the latest automated review in 5edde30:

  • Bundled metadata names are upper-cased on load, so the upstream mixed-case FOLLP_LkAHD matches the FC's FOLLP_LKAHD and Write no longer fails for it.
  • request() races send() against the response wait, so a stalled serial write times out instead of leaving Read/Write busy.
  • fcText() comment corrected to "strictly less than half an ulp".

@AP-Review

Copy link
Copy Markdown

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: COMMENT

Reviewed at head 5edde30dab.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/webtools/379/8.html#prWebTools-379

No blocking issues at this head; two small, rarely hit points remain. Since the last review, 5edde30 fixed all three earlier points: FOLLP_LkAHD now matches the FC's FOLLP_LKAHD, request() times out a stalled write cleanly, and the fcText() comment is corrected.

Minor (2)
  • OSDParamScreenEditor/usb.js:347: readFC() still does a bare await link.send(param_request_list), the one send() outside request(). If that write stalls, Read/Write/Connect stay disabled and the overlay stays up. Race it against a timeout too, e.g. with a small helper shared with request().
  • OSDParamScreenEditor/usb.js:147: fromTarget() checks only srcSystem, so PARAM_VALUE from another component of the same system can overwrite fcParams entries or satisfy a pending read. Also match srcComponent against link.targetComponent, as SimpleGCS does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants