update test-mk.py

This commit is contained in:
oberon 2026-02-11 19:52:30 +01:00
parent 5b64bef1bc
commit 60e8d760cf

View File

@ -1,13 +1,49 @@
# test-mk.py # test-mk.py (erweiterte Version)
from mkconnect.mouldking.MouldKing import MouldKing from mkconnect.mouldking.MouldKing import MouldKing
from mkconnect.tracer.TracerConsole import TracerConsole
from mkconnect.advertiser.AdvertiserBTSocket import AdvertiserBTSocket
print("=== Initialisierung ===")
tracer = TracerConsole()
advertiser = AdvertiserBTSocket()
print("MouldKing erstellen...") print("MouldKing erstellen...")
hub = MouldKing() # ← sollte jetzt gehen mk = MouldKing()
print("\nVerfügbare Methoden:") print("\nMethoden von MouldKing:")
print([m for m in dir(hub) if not m.startswith('_')]) print([m for m in dir(mk) if not m.startswith('_')])
# Teste ein paar typische Aufrufe (auskommentieren was Sinn macht) print("\nAdvertiser setzen...")
# hub.connect() mk.SetAdvertiser(advertiser)
# hub.set_motor('A', 0.5)
# hub.stop_all() print("Tracer setzen (falls nötig)...")
try:
mk.SetTracer(tracer)
print("→ Tracer gesetzt")
except Exception as e:
print("SetTracer fehlgeschlagen:", e)
print("\n=== Test Module6_0 ===")
try:
mod6 = mk.Module6_0(0) # ← mit hub_id=0
print("Module6_0(0) erstellt")
print("Methoden von Module6_0:")
print([m for m in dir(mod6) if not m.startswith('_')])
except Exception as e:
print("Fehler bei Module6_0:", e)
print("\n=== Test Module4_0 ===")
try:
mod4 = mk.Module4_0(0)
print("Module4_0(0) erstellt")
print("Methoden von Module4_0:")
print([m for m in dir(mod4) if not m.startswith('_')])
except Exception as e:
print("Fehler bei Module4_0:", e)
print("\n=== Test ohne Argument ===")
try:
mod = mk.Module6_0() # ← ohne Argument
print("Module6_0() ohne Argument funktioniert")
except Exception as e:
print("Module6_0() ohne Argument:", e)