forked from M-Labs/artiq
1
0
Fork 0

gui/moninj: suppress spurious core device address warnings

This commit is contained in:
Sebastien Bourdeauducq 2015-11-11 12:43:25 +08:00
parent c3f99eda8f
commit 77330c7c68
1 changed files with 9 additions and 1 deletions

View File

@ -238,7 +238,7 @@ class MonInj(TaskObject):
self.dds_dock = _MonInjDock("DDS") self.dds_dock = _MonInjDock("DDS")
self.subscriber = Subscriber("devices", self.init_devices) self.subscriber = Subscriber("devices", self.init_devices)
self.dm = _DeviceManager(self.send_to_device, dict()) self.dm = None
self.transport = None self.transport = None
async def start(self, server, port): async def start(self, server, port):
@ -267,6 +267,10 @@ class MonInj(TaskObject):
self.transport = transport self.transport = transport
def datagram_received(self, data, addr): def datagram_received(self, data, addr):
if self.dm is None:
logger.debug("received datagram, but device manager "
"is not present yet")
return
try: try:
ttl_levels, ttl_oes, ttl_overrides = \ ttl_levels, ttl_oes, ttl_overrides = \
struct.unpack(">QQQ", data[:8*3]) struct.unpack(">QQQ", data[:8*3])
@ -295,7 +299,11 @@ class MonInj(TaskObject):
self.transport = None self.transport = None
def send_to_device(self, data): def send_to_device(self, data):
if self.dm is None:
logger.debug("cannot sent to device yet, no device manager")
return
ca = self.dm.get_core_addr() ca = self.dm.get_core_addr()
logger.debug("core device address: %s", ca)
if ca is None: if ca is None:
logger.warning("could not find core device address") logger.warning("could not find core device address")
elif self.transport is None: elif self.transport is None: