mirror of
https://github.com/meshtastic/python.git
synced 2026-09-14 14:28:24 -04:00
slight logic rework
This commit is contained in:
1 parent
b522abf33e
commit
d0023df8ca
1 file changed
+7
-3
@@ -470,9 +470,13 @@ class MeshInterface: # pylint: disable=R0902
|
||||
"""
|
||||
|
||||
# issue 464: allow for 0x prefix in destinationId for hex values
|
||||
if type(destinationId) == str:
|
||||
destinationId = destinationId.replace('0x', '!')
|
||||
logging.debug(f'destinationId: {destinationId}')
|
||||
# destination ids can either be integers or strings with a !prefix
|
||||
try:
|
||||
int(destinationId)
|
||||
except ValueError:
|
||||
# only take the last 8 characters of the destinationId and force a ! prefix
|
||||
destinationId = f'!{destinationId[-8:]}'
|
||||
logging.info(f"Formatted destinationId: {destinationId}")
|
||||
|
||||
if getattr(data, "SerializeToString", None):
|
||||
logging.debug(f"Serializing protobuf as data: {stripnl(data)}")
|
||||
|
||||
Reference in new issue
Block a user