Skip to content

fix(calibration): add explicit "Save port" button so ports can be updated without recalibrating (#53)#59

Open
pgsharma wants to merge 1 commit into
huggingface:mainfrom
pgsharma:fix/save-port-without-recalibration
Open

fix(calibration): add explicit "Save port" button so ports can be updated without recalibrating (#53)#59
pgsharma wants to merge 1 commit into
huggingface:mainfrom
pgsharma:fix/save-port-without-recalibration

Conversation

@pgsharma

@pgsharma pgsharma commented Jul 2, 2026

Copy link
Copy Markdown

Problem

Fixes #53.

The SO-101 uses serial, so its port (/dev/tty.usbmodem…, COM…) changes when the arm is unplugged/reconnected. As the issue reports, the only visible way to update a robot's saved port was to redo the entire calibration.

Root cause

The port already does autosave: persistPort() in Calibration.tsx writes the port to the robot record on input blur and on port-detection (added in 027575b, ~2 weeks before this issue was filed). But it's silent — no button, no confirmation — so users don't realize the change was saved and reasonably assume recalibration is the only path. Hence "Missing save button during calibration."

Fix (frontend only)

  • Add a visible Save button next to the Port field that persists the port to the robot record and shows a confirmation toast (Saved <port> for the leader/follower — no recalibration needed).
  • Add a one-line hint under the field noting ports change on reconnect.
  • persistPort() now returns "saved" | "unchanged" | "skipped" | "error" (and checks res.ok) so the button can report success/failure. The existing silent onBlur / on-detect autosave is unchanged.

No backend change — POST /robots/{name} already does partial (port-only) merges via save_robot_record.

Testing

  • npm run build ✓ and eslint src/pages/Calibration.tsx ✓ (clean).
  • Manual: open Calibration for a robot → change Port → Save → toast confirms, record updates, no recalibration needed; teleop/record then use the new port.

frontend/dist/ intentionally not committed — CI (build_frontend.yml) rebuilds it on merge.

🤖 Generated with Claude Code

SO-101 serial ports change on reconnect, and the only *visible* way to
update a robot's port was to redo the entire calibration. The port
already autosaves on blur (027575b), but with no button or confirmation
users don't realize it — hence issue huggingface#53 ("Missing save button during
calibration").

Add a visible "Save" button next to the port field that persists the
port to the robot record and shows a confirmation toast, plus a hint
line noting ports can change on reconnect. persistPort() now returns a
result so the button can report success/failure. No backend change —
POST /robots/{name} already supports partial (port-only) updates.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@nicolas-rabault nicolas-rabault self-requested a review July 6, 2026 09:44

@nicolas-rabault nicolas-rabault 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.

Thanks for digging into this. The root-cause analysis is spot on. But I think it points to a lighter fix than the button.

As you note, persistPort() already autosaves the port on blur and on re-detection (handlePortDetected), keyed by the robot config name. So the port already updates independently of calibration; #53's "only way is to recalibrate" was stale by the time it was written. The reporter just didn't get any feedback that the save happened.

Given that, the real gap is visibility, not a missing action — and a Save button duplicates the onBlur autosave that already fires. I'd rather not add a manual save step for something that already saves on its own.

Proposal, minus the button:

  • Move the confirmation toast into persistPort() itself, fired only when the value actually changed (it already early-returns on unchanged). Then editing or re-detecting the port shows "Saved <port> for the leader/follower, no recalibration needed" with zero extra clicks.
  • Keep the one-line hint under the field. That's the part that actually closes the discoverability gap.
  • Drop the Save button and the handleSavePort handler.

Keeping persistPort's "saved" | "unchanged" | "skipped" | "error" return is still useful for the toast logic. Net result is the same UX #53 asked for (visible confirmation, no recalibration) with less surface area.
WDYT?

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.

Missing save button during calibration

3 participants