Compare commits

1 Commits

Author SHA1 Message Date
580fd11aca fix(cli): skip redundant settings uploads when unchanged
Only upload settings when edited values differ from current device settings to avoid unnecessary resets.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-04 22:48:54 +12:00

18
cli.py
View File

@@ -753,10 +753,18 @@ Examples:
if not edits and args.preset is None: if not edits and args.preset is None:
return return
# 2. Edit: apply edits to downloaded settings # 2. Edit: only apply/upload settings when values actually change
if edits: changed_edits: Dict[str, Any] = {}
print(f"Applying {len(edits)} edit(s)...", file=sys.stderr) for key, value in edits.items():
settings.update(edits) if settings.get(key) != value:
changed_edits[key] = value
if edits and not changed_edits:
print("No settings changes detected; skipping settings upload.", file=sys.stderr)
if changed_edits:
print(f"Applying {len(changed_edits)} setting change(s)...", file=sys.stderr)
settings.update(changed_edits)
print_settings(settings) print_settings(settings)
@@ -787,7 +795,7 @@ Examples:
sys.exit(1) sys.exit(1)
# 3b. Settings upload (resets device) # 3b. Settings upload (resets device)
if edits: if changed_edits:
try: try:
print(f"\nUploading settings to {args.port}...", file=sys.stderr) print(f"\nUploading settings to {args.port}...", file=sys.stderr)
upload_settings(args.port, settings) upload_settings(args.port, settings)