mirror of
https://github.com/meshtastic/python.git
synced 2025-12-30 19:37:52 -05:00
slight logic rework
This commit is contained in:
@@ -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