Rebranded to console tester.

This commit is contained in:
2025-12-23 11:21:02 -05:00
parent a0403eef57
commit 7d8c835fee
7 changed files with 309 additions and 207 deletions

View File

@@ -5,7 +5,7 @@ import requests
import uuid
import socket
class HeadUnit:
class PortTester:
def __init__(self, server_url="http://localhost:3000", config_path="firmware/config/device.json"):
self.server_url = server_url
self.config_path = config_path
@@ -109,42 +109,39 @@ class HeadUnit:
self.save_config()
print(f"[*] Switched to Slot {self.active_slot}.")
def generate_mock_hdmi_test():
def generate_console_port_test():
"""Generates mock spectral data for a console HDMI port."""
pins = ["DDC_SCL", "DDC_SDA", "CEC", "HPD", "TMDS_CLK+", "TMDS_CLK-"]
results = {pin: round(0.400 + (random.random() * 0.2), 3) for pin in pins}
return {
"type": "HDMI_OFFLINE",
"type": "PORT_DIAGNOSTIC",
"status": "PASS",
"hdmi5v": False,
"summary": "Offline diode check completed. All lines within tolerance.",
"diodeResults": {
"DDC_SCL": 0.542,
"DDC_SDA": 0.544,
"CEC": 0.612,
"HPD": 0.589,
"TMDS_CLK+": 0.498,
"TMDS_CLK-": 0.497
}
"hdmi5v": True,
"summary": "Port handshake confirmed. Pin continuity within spec.",
"diodeResults": results
}
if __name__ == "__main__":
hu = HeadUnit()
hu = PortTester()
def print_menu():
print("\n" + "="*45)
print(f" HDMI TESTER - HARDWARE SIMULATOR (v1.2.0)")
print(f" HDMI PORT DIAGNOSTICS - HARDWARE SIMULATOR")
print("="*45)
print(f" Status: [{hu.status}]")
print(f" Mode: [{hu.mode}]")
print(f" Active: [Slot {hu.active_slot}]")
print(f" Serial: [{hu.serial_number}]")
print(f" Node: [{hu.serial_number}]")
print("-" * 45)
print(" 1. Register / Sync Device")
print(" 2. Report Mock HDMI Test")
print(" 1. Register / Sync Port Diagnostics")
print(" 2. Run Console Port Sweep")
print(" 3. Switch to DEV Mode")
print(" 4. Switch to PROD Mode")
print(" 5. Swap Active Slot (A/B)")
print(" 6. Start Automated Loop")
print(" 7. Request Re-enlistment")
print(" 0. Exit Orchestrator")
print(" 0. Power Down Node")
print("-" * 45)
while True:
@@ -154,7 +151,7 @@ if __name__ == "__main__":
if choice == "1":
hu.register()
elif choice == "2":
hu.report_test(generate_mock_hdmi_test())
hu.report_test(generate_console_port_test())
elif choice == "3":
hu.switch_mode("DEV")
elif choice == "4":
@@ -171,7 +168,7 @@ if __name__ == "__main__":
break
if hu.status == "ENROLLED":
hu.report_test(generate_mock_hdmi_test())
hu.report_test(generate_console_port_test())
time.sleep(5)
if hu.status == "OFFLINE":