forked from M-Labs/artiq
1
0
Fork 0

artiq_dashboard: fix handling of moninj comment

This commit is contained in:
Sebastien Bourdeauducq 2022-03-19 22:33:31 +08:00
parent 6d92e539b1
commit 207717c740
1 changed files with 26 additions and 27 deletions

View File

@ -207,35 +207,34 @@ def setup_from_ddb(ddb):
description = set() description = set()
for k, v in ddb.items(): for k, v in ddb.items():
comment = None
if "comment" in v:
comment = v["comment"]
try: try:
if isinstance(v, dict) and v["type"] == "local": if isinstance(v, dict):
if k == "core": comment = v.get("comment")
core_addr = v["arguments"]["host"] if v["type"] == "local":
elif v["module"] == "artiq.coredevice.ttl": if k == "core":
channel = v["arguments"]["channel"] core_addr = v["arguments"]["host"]
force_out = v["class"] == "TTLOut" elif v["module"] == "artiq.coredevice.ttl":
widget = _WidgetDesc(k, comment, _TTLWidget, (channel, force_out, k)) channel = v["arguments"]["channel"]
description.add(widget) force_out = v["class"] == "TTLOut"
elif (v["module"] == "artiq.coredevice.ad9914" widget = _WidgetDesc(k, comment, _TTLWidget, (channel, force_out, k))
and v["class"] == "AD9914"):
bus_channel = v["arguments"]["bus_channel"]
channel = v["arguments"]["channel"]
dds_sysclk = v["arguments"]["sysclk"]
widget = _WidgetDesc(k, comment, _DDSWidget, (bus_channel, channel, k))
description.add(widget)
elif ( (v["module"] == "artiq.coredevice.ad53xx" and v["class"] == "AD53xx")
or (v["module"] == "artiq.coredevice.zotino" and v["class"] == "Zotino")):
spi_device = v["arguments"]["spi_device"]
spi_device = ddb[spi_device]
while isinstance(spi_device, str):
spi_device = ddb[spi_device]
spi_channel = spi_device["arguments"]["channel"]
for channel in range(32):
widget = _WidgetDesc((k, channel), comment, _DACWidget, (spi_channel, channel, k))
description.add(widget) description.add(widget)
elif (v["module"] == "artiq.coredevice.ad9914"
and v["class"] == "AD9914"):
bus_channel = v["arguments"]["bus_channel"]
channel = v["arguments"]["channel"]
dds_sysclk = v["arguments"]["sysclk"]
widget = _WidgetDesc(k, comment, _DDSWidget, (bus_channel, channel, k))
description.add(widget)
elif ( (v["module"] == "artiq.coredevice.ad53xx" and v["class"] == "AD53xx")
or (v["module"] == "artiq.coredevice.zotino" and v["class"] == "Zotino")):
spi_device = v["arguments"]["spi_device"]
spi_device = ddb[spi_device]
while isinstance(spi_device, str):
spi_device = ddb[spi_device]
spi_channel = spi_device["arguments"]["channel"]
for channel in range(32):
widget = _WidgetDesc((k, channel), comment, _DACWidget, (spi_channel, channel, k))
description.add(widget)
except KeyError: except KeyError:
pass pass
return core_addr, dds_sysclk, description return core_addr, dds_sysclk, description