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,78 @@
|
||||
import unittest
|
||||
import test_fleet
|
||||
|
||||
class ObjectiveTests(unittest.TestCase):
|
||||
setUp = test_fleet.FleetTests.setUp
|
||||
tearDown = test_fleet.FleetTests.tearDown
|
||||
def poll(self, cabinet, reports=None, features=True):
|
||||
return self.fleet.poll(dict(cabinet=cabinet,protocol=2,boot=cabinet,reports=reports or [],features=['assignment_config_v1'] if features else []))
|
||||
|
||||
def test_config_reaches_prepare_and_manual_clears_it(self):
|
||||
self.fleet.operator('prepare_scenario',{'scenario':'three_cabinet_objective_test'})
|
||||
command=self.poll('cabinet_01')['commands'][0]
|
||||
self.assertEqual(command['game_config']['test_auto_win_seconds'],5)
|
||||
self.poll('cabinet_01',[dict(kind='ack',id=command['id'],session=command['session'],ok=True)])
|
||||
self.fleet.operator('reset',{'cabinet':'cabinet_01'})
|
||||
command=self.poll('cabinet_01')['commands'][0]
|
||||
self.poll('cabinet_01',[dict(kind='ack',id=command['id'],session=command['session'],ok=True)])
|
||||
self.fleet.operator('prepare',{'cabinet':'cabinet_01','game':'pacman'})
|
||||
self.assertEqual(self.poll('cabinet_01')['commands'][0]['game_config'],{})
|
||||
|
||||
def test_old_export_rejected_before_dispatch(self):
|
||||
self.poll('cabinet_03', features=False)
|
||||
with self.assertRaisesRegex(ValueError,'Update the game export on cabinet_03'):
|
||||
self.fleet.operator('prepare_scenario',{'scenario':'three_cabinet_objective_test'})
|
||||
self.assertFalse(self.poll('cabinet_01')['commands'])
|
||||
|
||||
def test_invalid_objective_rejected(self):
|
||||
assignment=self.catalog['scenarios']['three_cabinet_objective_test']['assignments'][2]
|
||||
for config in [{'homes_to_win':6},{'homes_to_win':True},{'homes_to_win':.5},{'unknown':1},{'test_auto_win_seconds':float('nan')}]:
|
||||
assignment['game_config']=config
|
||||
with self.assertRaises(ValueError):
|
||||
self.fleet.operator('prepare_scenario',{'scenario':'three_cabinet_objective_test'})
|
||||
self.assertFalse(self.poll('cabinet_01')['commands'])
|
||||
|
||||
def test_never_connected_cabinet_reports_offline_not_old_export(self):
|
||||
room=self.fleet.rooms['cabinet_03']
|
||||
room.last_seen=0
|
||||
room.features=[]
|
||||
with self.assertRaisesRegex(ValueError,'cabinet_03 is offline'):
|
||||
self.fleet.operator('prepare_scenario',{'scenario':'three_cabinet_objective_test'})
|
||||
self.assertFalse(self.poll('cabinet_01')['commands'])
|
||||
|
||||
def test_rfid_credit_validation_and_start_gate(self):
|
||||
room=self.fleet.rooms['cabinet_01']
|
||||
room.features=['assignment_config_v1','rfid_credit_v1']
|
||||
room.gpio='real'
|
||||
self.catalog['cabinets']['cabinet_01']['devices']=[dict(id='reader',kind='rfid')]
|
||||
item=dict(cabinet='cabinet_01',game='pacman',game_config=dict(rfid_credit_device='reader',rfid_allowed_uids=[]))
|
||||
self.fleet.validate_assignment(item)
|
||||
for changes in [dict(rfid_credit_device='missing'),dict(rfid_allowed_uids=['bad']),dict(rfid_allowed_uids=True)]:
|
||||
invalid=dict(item,game_config=dict(item['game_config'],**changes))
|
||||
with self.assertRaises(ValueError): self.fleet.validate_assignment(invalid)
|
||||
room.features=['assignment_config_v1']
|
||||
with self.assertRaisesRegex(ValueError,'2.3'): self.fleet.validate_assignment(item)
|
||||
room.features.append('rfid_credit_v1')
|
||||
room.gpio='simulation'
|
||||
with self.assertRaisesRegex(ValueError,'real GPIO'): self.fleet.validate_assignment(item)
|
||||
room.state.update(phase='ready',game_config=item['game_config'],commands=[])
|
||||
with self.assertRaisesRegex(ValueError,'press Start'): self.fleet.operator('start',dict(cabinet='cabinet_01'))
|
||||
|
||||
def test_shipped_rfid_scenario_prepares_without_outputs(self):
|
||||
# Exercise the actual exported scenario as well as the protocol fixture.
|
||||
self.tearDown()
|
||||
self.catalog=test_fleet.json.loads((test_fleet.ROOT/'tools/room_controller/catalog.json').read_text(encoding='utf-8'))
|
||||
self.fleet=test_fleet.server.Fleet(':memory:',self.catalog,lambda:self.now)
|
||||
self.poll('cabinet_01')
|
||||
room=self.fleet.rooms['cabinet_01']
|
||||
room.features=['assignment_config_v1','rfid_credit_v1']
|
||||
room.gpio='real'
|
||||
self.fleet.operator('prepare_scenario', {'scenario':'pacman_rfid_credit_test'})
|
||||
command=self.poll('cabinet_01')['commands'][0]
|
||||
self.assertEqual(command['game_config']['rfid_credit_device'],'cab1_rfid1')
|
||||
self.assertEqual(command['type'],'prepare')
|
||||
self.poll('cabinet_01',[dict(kind='ack',id=command['id'],session=command['session'],ok=True)])
|
||||
self.assertEqual(room.state['phase'],'ready')
|
||||
self.assertFalse(any(c['type'] in ('output','reward','start') for c in room.state['commands']))
|
||||
self.poll('cabinet_01',[dict(kind='event',id='physical-start',session=command['session'],event='started')])
|
||||
self.assertEqual(room.state['phase'],'playing')
|
||||
Reference in new issue
Block a user