Files
room_glitch/tests/pcb/check_pacman_power.gd
T
Jeff Luke 41ef12f954 Add Pac-Man power-on flow and document Odin integration
- Add a four-second arcade-style boot sequence followed by the
  Character / Nickname introduction.
- Separate cabinet power-on from RFID credit and player Start.
- Add operator Power on control and cabinet power-state reporting.
- Prevent repeated power commands from restarting boot or gameplay.
- Ignore RFID scans received before the cabinet is ready.
- Add power-state, RFID, controller, and GPIO feedback regression tests.

- Expand the master walkthrough with export, packaging, file transfer,
  fresh-Pi setup, RFID compilation, and end-to-end testing instructions.
- Correct tester hardware documentation: BCM23/J20 drives an LED;
  physical buttons connect through a separate I2C1 input board.
- Document operator-triggered power-on as the current test workflow
  and retain the temporary 2.4 configuration compatibility notes.
- Record successful physical testing of power-on, RFID credit,
  and player Start.

- Add an Odin integration README describing the proposed Rust/NATS
  bridge, shared messages, Flutter GM interface, autopilot sequencing,
  hardware ownership, and Starfish SSH-management role.
- Define migration milestones and information needed from the
  framework owner; link the integration guide from the root README.

Validation: 69 controller tests, 10 GPIO tests, Pac-Man power/RFID
checks, managed-cabinet lifecycle checks, and visual screen inspection.
2026-10-17 18:47:26 -07:00

41 lines
2.5 KiB
GDScript

extends SceneTree
var failures := 0
func check(ok: bool, message: String) -> void:
if not ok:
failures += 1
push_error(message)
func packet(id: String, kind := "input", device := "cab1_btn_ylw", value: Variant = true, age := 0) -> Dictionary:
return {"fresh": true, "events": [{"id": id, "kind": kind, "device": device, "value": value, "age_ms": age}], "devices": [{"id": device, "kind": kind, "value": false if kind == "input" else value, "age_ms": 0}]}
func _initialize() -> void: call_deferred("run")
func run() -> void:
var game = load("res://games/pacman/pacman.gd").new()
root.add_child(game)
game.set_physics_process(false)
game.configure({"power_on_device": "cab1_btn_ylw", "rfid_credit_device": "cab1_rfid1"})
check(game.power_state == "off" and not game.start_game(), "Prepared cabinet waits for power")
game.receive_device_feedback(packet("old"))
game.receive_device_feedback(packet("stale", "input", "cab1_btn_ylw", true, 5000))
game.receive_device_feedback(packet("wrong", "input", "other"))
game.receive_device_feedback(packet("early-card", "rfid", "cab1_rfid1", "12345678"))
check(game.power_state == "off" and game.credits == 0, "Historical/stale/wrong inputs and early cards are ignored")
game.receive_device_feedback(packet("tap"))
check(game.power_state == "booting", "A quick press released before polling still powers on")
check(not game.power_on() and not game.start_game(), "Boot cannot be restarted or skipped")
game._physics_process(3.99)
game.receive_device_feedback(packet("boot-card", "rfid", "cab1_rfid1", "12345678"))
check(game.power_state == "booting" and game.credits == 0, "Full four-second boot gates RFID")
game._physics_process(0.02)
check(game.power_state == "ready" and game.model.state == "idle", "Boot enters character intro, not gameplay")
game.receive_device_feedback(packet("boot-card", "rfid", "cab1_rfid1", "12345678"))
check(game.credits == 0, "First post-boot snapshot discards buffered scans")
game.receive_device_feedback(packet("new-card", "rfid", "cab1_rfid1", "12345678"))
check(game.credits == 1 and game.start_game(), "New scan then Start begins play")
game.receive_device_feedback(packet("playing-press"))
check(game.is_running and game.power_state == "ready", "Button during play cannot restart the cabinet")
game.power_off()
check(not game.is_running and game.credits == 0 and not game.start_game(), "Power off clears gameplay and credits")
game.queue_free()
await process_frame
print("PACMAN POWER: ", "PASS" if failures == 0 else "FAIL")
quit(1 if failures else 0)