From b74a456a9b69560a605a8be83946c2f093958623 Mon Sep 17 00:00:00 2001 From: George Hotz Date: Wed, 15 Jan 2020 08:40:13 -0800 Subject: [PATCH] don't hardcode the lists --- messaging/__init__.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/messaging/__init__.py b/messaging/__init__.py index 7a0d4936b3e653..9ca883911c04c4 100644 --- a/messaging/__init__.py +++ b/messaging/__init__.py @@ -1,6 +1,7 @@ # must be build with scons from .messaging_pyx import Context, Poller, SubSocket, PubSocket # pylint: disable=no-name-in-module, import-error from .messaging_pyx import MultiplePublishersError, MessagingError # pylint: disable=no-name-in-module, import-error +import capnp assert MultiplePublishersError assert MessagingError @@ -147,12 +148,12 @@ def __init__(self, services, ignore_alive=None, addr="127.0.0.1"): self.freq[s] = service_list[s].frequency data = new_message() - if s in ['can', 'sensorEvents', 'liveTracks', 'sendCan', - 'ethernetData', 'cellInfo', 'wifiScan', - 'trafficEvents', 'orbObservation', 'carEvents']: - data.init(s, 0) - else: + try: data.init(s) + except capnp.lib.capnp.KjException: + # lists + data.init(s, 0) + self.data[s] = getattr(data, s) self.logMonoTime[s] = 0 self.valid[s] = data.valid