Skip to content

feat(psp): USB relay actuator control + closed-loop demo video#101

Merged
AndrewAltimit merged 4 commits intomainfrom
feat/psp-actuator-control
Mar 30, 2026
Merged

feat(psp): USB relay actuator control + closed-loop demo video#101
AndrewAltimit merged 4 commits intomainfrom
feat/psp-actuator-control

Conversation

@AndrewAltimit
Copy link
Copy Markdown
Owner

Summary

  • Add scripts/psp_actuator.py -- interactive USB relay controller for PSP power slider (extend/retract with 1/4 step precision)
  • Add scripts/psp_demo.py -- one-command closed-loop demo: connects to PSP over WiFi, launches TV Guide, tunes a channel, windows the app, then power-cycles via actuator
  • Embed closed-loop automation demo video in README and journal entry 08

Test plan

  • Relay serial communication verified (4 clicks test)
  • Actuator extend/retract cycles verified
  • 3/4 extension confirmed sufficient for PSP power slider
  • Full demo script tested end-to-end (TV Guide launch, window, actuator reboot)
  • Video recorded and uploaded as GitHub asset

Generated with Claude Code (https://claude.com/claude-code)

AI Agent Bot and others added 3 commits March 30, 2026 09:19
Add PSP power control scripts (psp_actuator.py for interactive relay control,
psp_demo.py for full closed-loop demo: WiFi → TV Guide → window → actuator
reboot) and add demo video placeholders in the journal and README.

Video file must be uploaded as a GitHub asset (10MB, exceeds repo limit).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Updated the URL for closed-loop automation assets in README.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

Gemini AI Code Review

Issues (if any)

  • [BUG] scripts/psp_actuator.py:99 - power_on_psp only performs a hard shutdown

    • Holding the PSP power slider for 30 seconds (HOLD_SECONDS) forces a hard power off but doesn't turn the device back on.
    • How to fix: Follow the pattern in psp_demo.py, which performs a long hold to power off, followed by a short tap to power on.
  • [WARNING] scripts/psp_actuator.py:124 - Case-sensitive check for Extend and Retract commands

    • cmd in ("E", "extend") uses the unmodified cmd string. If a user types "Extend" or "EXTEND", it will fail to match, even though cmd_lower was computed for exactly this reason.
    • How to fix: Use cmd == "E" or cmd_lower == "extend" (and similarly for retract).

Previous Issues (for incremental reviews)

(none)

Suggestions (if any)

  • scripts/psp_demo.py:48 - s.connect((PSP_IP, PSP_PORT)) can throw ConnectionRefusedError or TimeoutError which aren't caught by the try...except socket.timeout block (which only wraps the recv() call). Adding a try/except around the connection would make the script fail more gracefully if the PSP isn't reachable yet.

Notes

  • The closed-loop automation looks awesome!
  • The markdown video embed in the README is perfectly formatted for GitHub to automatically convert it to a video player.

Reaction


Generated by Gemini AI (gemini-3.1-pro-preview). Supplementary to human reviews.

Automated fix by Claude in response to Gemini/Codex review.

Iteration: 1/5

Co-Authored-By: AI Review Agent <noreply@anthropic.com>
@AndrewAltimit
Copy link
Copy Markdown
Owner Author

Review Response Agent (Iteration 1)

Status: Changes committed, pushing...

Commit: 842f21d

Fixed Issues

  • BUG: power_on_psp only performed hard shutdown (scripts/psp_actuator.py:99): The function held the power slider for 30s (power off) but never tapped it again to power on. Added Phase 2: a short tap (extend → 1s hold → retract) after a 3s pause, matching the pattern in psp_demo.py.
  • WARNING: Case-sensitive command matching (scripts/psp_actuator.py:124,129): Changed cmd in ("E", "extend") to cmd == "E" or cmd_lower == "extend" (and similarly for retract) so that "Extend", "EXTEND", "Retract", "RETRACT" all work as expected.

Ignored Issues

  • SUGGESTION: Connection error handling in psp_demo.py: Nice-to-have improvement for s.connect() error handling. This is a demo script and the default Python traceback is informative enough. Not worth adding complexity.

Deferred to Human

  • (none)

Notes

  • Both fixes are in scripts/psp_actuator.py only. No Rust code was affected.

Automated summary of agent fixes.

@github-actions
Copy link
Copy Markdown

Gemini AI Incremental Review

This is an incremental review focusing on changes since the last review.

Previous Issues (for incremental reviews)

  • [RESOLVED] scripts/psp_actuator.py:99 - power_on_psp only performs a hard shutdown
  • [RESOLVED] scripts/psp_actuator.py:124 - Case-sensitive check for Extend and Retract commands

Issues (if any)

(none)

Suggestions (if any)

  • scripts/psp_actuator.py:38 - Consider adding a try/except ValueError around int(input(...)) to handle non-numeric input when multiple relay ports are found.

Notes

  • Both previous issues resolved: complete power-on sequence and case-insensitive command matching are correctly implemented.
  • The closed-loop automation video embed in the README and journal entry looks great.

Reaction


Generated by Gemini AI (gemini-3.1-pro-preview). Supplementary to human reviews.

@AndrewAltimit
Copy link
Copy Markdown
Owner Author

Review Response Agent (Iteration 2)

Status: No changes needed

Warning: The agent's summary below claims fixes were applied, but no files were actually modified. These claimed fixes were NOT committed.

Fixed Issues

  • (none — all fixes from iteration 1 are already present in commit 842f21d)

Ignored Issues

  • SUGGESTION: try/except ValueError for int(input(...)) in psp_actuator.py:43: This is a developer utility script where a Python traceback on invalid input is sufficient. Adding input validation adds complexity without meaningful benefit for this use case.

Deferred to Human

  • (none)

Notes

  • Verified that both iteration 1 fixes are present in the current code: power_on_psp has the two-phase sequence (lines 99-119) and command matching uses cmd_lower (lines 135, 139). The incremental Gemini review confirmed both previous issues are resolved. No new bugs found — only a minor robustness suggestion for a utility script, which was intentionally skipped.

The agent reviewed feedback but no file modifications were detected.

@AndrewAltimit AndrewAltimit merged commit 8ec4131 into main Mar 30, 2026
7 checks passed
@AndrewAltimit AndrewAltimit deleted the feat/psp-actuator-control branch March 30, 2026 14:50
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.

1 participant