diff --git a/README.md b/README.md index bcda5e2..98d667f 100644 --- a/README.md +++ b/README.md @@ -102,10 +102,10 @@ sudo usermod -a -G dialout ## A note to developers of this lib -We use the visual-studio-code default python formatting conventions. So if you use that IDE you should be able to use "Format Document" and not generate unrelated diffs. If you use some other editor, please don't change formatting on lines you haven't changed. +We use the visual-studio-code default python formatting conventions (autopep8). So if you use that IDE you should be able to use "Format Document" and not generate unrelated diffs. If you use some other editor, please don't change formatting on lines you haven't changed. If you need to build a new release you'll need: ``` apt install pandoc -sudo pip3 install markdown pandoc webencodings pyparsing twine +sudo pip3 install markdown pandoc webencodings pyparsing twine autopep8 ``` \ No newline at end of file diff --git a/meshtastic/__init__.py b/meshtastic/__init__.py index 6c3e21f..2eeb632 100644 --- a/meshtastic/__init__.py +++ b/meshtastic/__init__.py @@ -68,6 +68,7 @@ import base64 import platform import socket from . import mesh_pb2, portnums_pb2, apponly_pb2, util +from .util import fixme, catchAndIgnore from pubsub import pub from dotmap import DotMap @@ -90,14 +91,6 @@ format is Mmmss (where M is 1+the numeric major number. i.e. 20120 means 1.1.20 OUR_APP_VERSION = 20200 -def catchAndIgnore(reason, closure): - """Call a closure but if it throws an excpetion print it and continue""" - try: - closure() - except BaseException as ex: - logging.error(f"Exception thrown in {reason}: {ex}") - - class MeshInterface: """Interface class for meshtastic devices @@ -379,8 +372,8 @@ class MeshInterface: """ Done with initial config messages, now send regular MeshPackets to ask for settings and channels """ - self._requestSettings() - self._requestChannels() + # self._requestSettings() + # self._requestChannels() # FIXME, the following should only be called after we have settings and channels self._connected() # Tell everone else we are ready to go diff --git a/meshtastic/util.py b/meshtastic/util.py index d384897..8a1465a 100644 --- a/meshtastic/util.py +++ b/meshtastic/util.py @@ -7,6 +7,17 @@ import serial.tools.list_ports blacklistVids = dict.fromkeys([0x1366]) +def fixme(message): + raise Exception(f"FIXME: {message}") + + +def catchAndIgnore(reason, closure): + """Call a closure but if it throws an excpetion print it and continue""" + try: + closure() + except BaseException as ex: + logging.error(f"Exception thrown in {reason}: {ex}") + def findPorts(): """Find all ports that might have meshtastic devices diff --git a/proto b/proto index f6ff4cc..6bb139c 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit f6ff4cc0c98b201342c32776eeeb9ace83b450dd +Subproject commit 6bb139c0a43825d868a5e78c07c443f8e9e80b55