From 5636505578d803b48b538ab32ab3a46d18fef767 Mon Sep 17 00:00:00 2001 From: Florent Date: Sat, 7 Mar 2026 20:34:24 -0400 Subject: [PATCH] issue with errors in advert_path --- pyproject.toml | 2 +- src/meshcore_cli/meshcore_cli.py | 31 ++++++++++++++++++------------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 679d5b7..e8fe86b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "meshcore-cli" -version = "1.4.10" +version = "1.4.11" authors = [ { name="Florent de Lamotte", email="florent@frizoncorrea.fr" }, ] diff --git a/src/meshcore_cli/meshcore_cli.py b/src/meshcore_cli/meshcore_cli.py index b96e0a9..42b9ca6 100644 --- a/src/meshcore_cli/meshcore_cli.py +++ b/src/meshcore_cli/meshcore_cli.py @@ -35,7 +35,7 @@ import re from meshcore import MeshCore, EventType, logger # Version -VERSION = "v1.4.10" +VERSION = "v1.4.11" # default ble address is stored in a config file @@ -3339,19 +3339,24 @@ async def next_cmd(mc, cmds, json_output=False): logger.debug(res) if res is None: logger.error("couldn't send cmd") + elif res.type == EventType.ERROR: + print(res) else: - path_len = res.payload['path_len'] - if (path_len == 0) : - print("0 hop") - elif (path_len == -1) : - print("Flood") - else: - phs = res.payload['path_hash_mode']+1 - path = res.payload['path'] - path_str = path[:2*phs] - for i in range(1,path_len): - path_str = path_str + "," + path[i*phs*2:(i+1)*2*phs] - print(path_str) + if json_output: + print(json.dumps(res.payload)) + else : + path_len = res.payload['path_len'] + if (path_len == 0) : + print("0 hop") + elif (path_len == -1) : + print("Flood") + else: + phs = res.payload['path_hash_mode']+1 + path = res.payload['path'] + path_str = path[:2*phs] + for i in range(1,path_len): + path_str = path_str + "," + path[i*phs*2:(i+1)*2*phs] + print(path_str) case "share_contact" | "sc": argnum = 1