Expand Glitch operations hub, cabinet authoring, deployment, and RFID support
Operator hub - Introduce Escape Gallery branding and Glitch: the Dark Machine room views - Add cabinet illustrations, Pac-Man marquee/gameplay artwork, and waiting states - Add device feedback panels with RFID readings, input/output states, and stale status - Add logged operator hardware interventions with request deduplication Room and cabinet authoring - Add a visual custom-PCB connection editor with per-cabinet device inventory - Support device IDs, bindings, wiring notes, input polarity, and validation - Add physical-room label/dimension toggles and editable doorway annotations - Preserve doorway changes through undo, save, and revert - Expand cabinet profiles, room layout, and Glitch scenario resources Scenarios and gameplay - Add per-assignment game configuration and runtime feature validation - Add timed test wins and Frogger individual-home objectives - Add the three-cabinet timed/score/Frogger test scenario - Add Cabinet 1 Pac-Man RFID credits, credit sound, and CREDIT 0/1 display - Require physical Start after an accepted scan and prevent duplicate credits Pi hardware and deployment - Add GPIO feedback sampling and a separate multiplexed RFID helper - Validate reader pin ownership and input/output conflicts - Add SSH cabinet startup and Pi desktop-session service support - Add master packaging, site setup, SSH enrollment, and staged cabinet releases - Verify deployment manifests and support explicit activation/status/log commands Documentation and verification - Consolidate the root README around the current architecture and setup workflow - Add the complete master/Pi/RFID export and deployment walkthrough - Document network isolation, credentials, card identification, and rollback - Add PCB, room-editor, feedback, credit, deployment, and controller tests - Isolate protocol tests from designer-edited cabinet configurations Known limitations - RFID helper compilation and physical Pi commissioning remain unverified - Fleet provisioning does not yet configure RFID-only installations completely - Broader Pac-Man tests retain a ghost-capture assertion failure - Staged exports must be rebuilt and checked before deploying runtime 2.3
This commit is contained in:
1 parent
705ec31e0b
commit
c1b2195834
90 files changed
+4969
-456
No files matched your search
@@ -0,0 +1,98 @@
|
||||
extends SceneTree
|
||||
|
||||
var failures := 0
|
||||
|
||||
func check(condition: bool, message: String) -> void:
|
||||
if not condition:
|
||||
failures += 1
|
||||
push_error(message)
|
||||
|
||||
func _initialize() -> void:
|
||||
run.call_deferred()
|
||||
|
||||
func run() -> void:
|
||||
if "--preview" in OS.get_cmdline_user_args():
|
||||
root.gui_embed_subwindows = true
|
||||
root.size = Vector2i(1200, 850)
|
||||
var board := CabinetPCBConfig.new()
|
||||
check(board.ports().size() == 22, "All 22 connectors must be present")
|
||||
check(board.port("J15").bcm == 21 and board.port("J10").bcm == 5, "Three pin order")
|
||||
check(board.port("J22").bcm == 25 and board.port("J17").bcm == 16, "Two pin order")
|
||||
check(board.port("J2").label == "001" and board.port("J8").label == "111", "Reader selector order")
|
||||
var reader := PCBConnection.new()
|
||||
reader.port_id = "J1"
|
||||
reader.device_type = "rfid"
|
||||
reader.device_id = "reader_left"
|
||||
reader.display_name = "Left RFID reader"
|
||||
board.set_connection(reader)
|
||||
var reader2: PCBConnection = reader.duplicate(true)
|
||||
reader2.port_id = "J2"
|
||||
reader2.device_id = "reader_right"
|
||||
board.set_connection(reader2)
|
||||
check(board.issues().is_empty(), "Valid readers")
|
||||
var cabinet := CabinetProfile.new()
|
||||
cabinet.display_name = "PCB editor test"
|
||||
cabinet.pcb_config = board
|
||||
var copy: CabinetProfile = cabinet.duplicate(true)
|
||||
copy.pcb_config.connection("J1").display_name = "Other cabinet"
|
||||
check(board.connection("J1").display_name == "Left RFID reader", "Cabinet deep-copy isolation")
|
||||
var path := "user://pcb_test_roundtrip.tres"
|
||||
check(ResourceSaver.save(cabinet, path) == OK, "Save cabinet")
|
||||
var loaded := ResourceLoader.load(path, "", ResourceLoader.CACHE_MODE_IGNORE) as CabinetProfile
|
||||
check(loaded.pcb_config.connection("J2").device_id == "reader_right", "Save/reload connector data")
|
||||
DirAccess.remove_absolute(path)
|
||||
reader2.device_id = reader.device_id
|
||||
check(not board.issues().is_empty(), "Duplicate IDs reported")
|
||||
reader2.device_id = "reader_right"
|
||||
var hardware := HardwareConfig.new()
|
||||
var action := HardwareAction.new()
|
||||
action.action_id = &"lamp"
|
||||
action.gpio_pin = 17
|
||||
hardware.actions.append(action)
|
||||
check(not board.issues(hardware).is_empty(), "Reserved selector pin reported")
|
||||
var output := PCBConnection.new()
|
||||
output.port_id = "J22"
|
||||
output.device_type = "led"
|
||||
output.device_id = "lamp"
|
||||
output.binding_id = "lamp"
|
||||
board.set_connection(output)
|
||||
action.gpio_pin = 18
|
||||
check(not board.issues(hardware).is_empty(), "Output BCM mismatch reported")
|
||||
action.gpio_pin = 25
|
||||
check(board.issues(hardware).is_empty(), "Matching output action accepted")
|
||||
cabinet.hardware_config = hardware
|
||||
if not Engine.is_editor_hint():
|
||||
print("PCB resource tests: ", "PASS" if failures == 0 else "FAIL")
|
||||
quit(failures)
|
||||
return
|
||||
var property := preload("res://editor/hardware/pcb_editor_property.gd").new()
|
||||
root.add_child(property)
|
||||
property.set_object_and_property(cabinet, "pcb_config")
|
||||
property._update_property()
|
||||
property._open()
|
||||
property._select("J2")
|
||||
check(property.device_id.text == "reader_right", "Editor selects correct reader")
|
||||
property.device_name.text = "Pending edit"
|
||||
property._store()
|
||||
check(board.connection("J2").display_name != "Pending edit", "Draft cannot change source before Apply")
|
||||
property.dialog.hide()
|
||||
property._open()
|
||||
check(property.device_name.text != "Pending edit", "Cancel/reopen discards draft")
|
||||
property._select("J22")
|
||||
property.device_name.text = "Reward lamp"
|
||||
property._store()
|
||||
property.property_changed.connect(func(_key: StringName, value: Variant, _field: StringName, _changing: bool): cabinet.pcb_config = value)
|
||||
property._apply()
|
||||
check(cabinet.pcb_config.connection("J22").display_name == "Reward lamp", "Apply emits updated configuration")
|
||||
if "--preview" in OS.get_cmdline_user_args():
|
||||
root.size = Vector2i(1200, 850)
|
||||
property.dialog.popup_centered(Vector2i(1120, 760))
|
||||
await process_frame
|
||||
await process_frame
|
||||
await RenderingServer.frame_post_draw
|
||||
root.get_texture().get_image().save_png("user://pcb_editor_preview.png")
|
||||
print("Preview: ", OS.get_user_data_dir(), "/pcb_editor_preview.png")
|
||||
property.queue_free()
|
||||
await process_frame
|
||||
print("PCB tests: ", "PASS" if failures == 0 else "FAIL")
|
||||
quit(failures)
|
||||
@@ -0,0 +1 @@
|
||||
uid://cbtyukgnhlhts
|
||||
@@ -0,0 +1,42 @@
|
||||
extends SceneTree
|
||||
var failures := 0
|
||||
func check(ok: bool, message: String) -> void:
|
||||
if not ok:
|
||||
failures += 1
|
||||
push_error(message)
|
||||
func sample(id: String, uid := "1234ABCD", device := "cab1_rfid1", fresh := true, age := 0) -> Dictionary:
|
||||
return {"fresh": fresh, "events": [{"id": id, "device": device, "kind": "rfid", "value": uid, "error": ""}], "devices": [{"id": device, "value": uid, "age_ms": age, "error": ""}]}
|
||||
func _initialize() -> void:
|
||||
call_deferred("run")
|
||||
func run() -> void:
|
||||
var game = load("res://games/pacman/pacman.gd").new()
|
||||
root.add_child(game)
|
||||
game.configure({"rfid_credit_device": "cab1_rfid1", "rfid_allowed_uids": ["1234ABCD"]})
|
||||
check(not game.start_game(), "Start must require a credit")
|
||||
game.receive_device_feedback({})
|
||||
game.receive_device_feedback(sample("old"))
|
||||
check(game.credits == 0, "First fresh snapshot must baseline historical scans")
|
||||
game.receive_device_feedback(sample("wrong-reader", "1234ABCD", "other"))
|
||||
game.receive_device_feedback(sample("wrong-card", "99999999"))
|
||||
game.receive_device_feedback(sample("stale", "1234ABCD", "cab1_rfid1", true, 5000))
|
||||
game.receive_device_feedback(sample("offline", "1234ABCD", "cab1_rfid1", false))
|
||||
check(game.credits == 0, "Wrong reader/card, stale and offline samples must not credit")
|
||||
game.receive_device_feedback(sample("scan"))
|
||||
check(game.credits == 1 and game.view.credits == 1, "New accepted scan grants one visible credit")
|
||||
game.receive_device_feedback(sample("scan"))
|
||||
game.receive_device_feedback(sample("scan2"))
|
||||
check(game.credits == 1, "Duplicate and additional scans must not stack credits")
|
||||
check(game.start_game() and game.credits == 0, "Start consumes one credit")
|
||||
game.receive_device_feedback(sample("during-play"))
|
||||
check(game.credits == 0, "Playing scans must not bank credits")
|
||||
game.reset_game()
|
||||
game.receive_device_feedback(sample("scan"))
|
||||
check(game.credits == 0, "Reset must not replay a prior event")
|
||||
game.receive_device_feedback(sample("new-scan"))
|
||||
check(game.credits == 1, "New scan works after reset")
|
||||
game.configure({})
|
||||
check(game.start_game(), "Ordinary non-RFID Pac-Man remains free start")
|
||||
game.queue_free()
|
||||
await process_frame
|
||||
print("RFID credit tests: ", "PASS" if failures == 0 else "FAIL")
|
||||
quit(1 if failures else 0)
|
||||
Reference in new issue
Block a user