mirror of
https://github.com/meshcore-dev/meshcore-cli.git
synced 2026-04-20 22:13:48 +00:00
support for path_hash_mode with get/set
This commit is contained in:
parent
d3b8c72aaa
commit
5c06617d7a
1 changed files with 29 additions and 0 deletions
|
|
@ -641,6 +641,7 @@ def make_completion_dict(contacts, pending={}, to=None, channels=None):
|
||||||
"max_attempts" : None,
|
"max_attempts" : None,
|
||||||
"max_flood_attempts" : None,
|
"max_flood_attempts" : None,
|
||||||
"flood_after" : None,
|
"flood_after" : None,
|
||||||
|
"path_hash_mode": None,
|
||||||
},
|
},
|
||||||
"get" : {"name":None,
|
"get" : {"name":None,
|
||||||
"bat":None,
|
"bat":None,
|
||||||
|
|
@ -681,6 +682,7 @@ def make_completion_dict(contacts, pending={}, to=None, channels=None):
|
||||||
"stats_radio":None,
|
"stats_radio":None,
|
||||||
"stats_packets":None,
|
"stats_packets":None,
|
||||||
"allowed_repeat_freq":None,
|
"allowed_repeat_freq":None,
|
||||||
|
"path_hash_mode":None,
|
||||||
},
|
},
|
||||||
"?get":None,
|
"?get":None,
|
||||||
"?set":None,
|
"?set":None,
|
||||||
|
|
@ -740,6 +742,7 @@ def make_completion_dict(contacts, pending={}, to=None, channels=None):
|
||||||
"time" : None,
|
"time" : None,
|
||||||
"clock" : {"sync" : None},
|
"clock" : {"sync" : None},
|
||||||
"reboot" : None,
|
"reboot" : None,
|
||||||
|
"clkreboot":None,
|
||||||
"start ota" : None,
|
"start ota" : None,
|
||||||
"password" : None,
|
"password" : None,
|
||||||
"neighbors" : None,
|
"neighbors" : None,
|
||||||
|
|
@ -2093,6 +2096,18 @@ async def next_cmd(mc, cmds, json_output=False):
|
||||||
print(json.dumps(res.payload, indent=4))
|
print(json.dumps(res.payload, indent=4))
|
||||||
else:
|
else:
|
||||||
print("ok")
|
print("ok")
|
||||||
|
case "path_hash_mode":
|
||||||
|
mode = int(cmds[2])
|
||||||
|
if mode >= 3:
|
||||||
|
logger.error(f"Can't set value to {mode}")
|
||||||
|
else:
|
||||||
|
res = await mc.commands.set_path_hash_mode(mode)
|
||||||
|
if res.type == EventType.ERROR:
|
||||||
|
print(f"Error: {res}")
|
||||||
|
elif json_output:
|
||||||
|
print(json.dumps(res.payload, indent=4))
|
||||||
|
else:
|
||||||
|
print("ok")
|
||||||
case "name":
|
case "name":
|
||||||
res = await mc.commands.set_name(cmds[2])
|
res = await mc.commands.set_name(cmds[2])
|
||||||
logger.debug(res)
|
logger.debug(res)
|
||||||
|
|
@ -2406,6 +2421,18 @@ async def next_cmd(mc, cmds, json_output=False):
|
||||||
print(f"Repeat: {'on' if res.payload['repeat'] else 'off'}")
|
print(f"Repeat: {'on' if res.payload['repeat'] else 'off'}")
|
||||||
else:
|
else:
|
||||||
print("Can't repeat")
|
print("Can't repeat")
|
||||||
|
case "path_hash_mode":
|
||||||
|
res = await mc.commands.send_device_query()
|
||||||
|
logger.debug(res)
|
||||||
|
if res.type == EventType.ERROR :
|
||||||
|
print(f"ERROR: {res}")
|
||||||
|
elif json_output :
|
||||||
|
print(json.dumps(res.payload, indent=4))
|
||||||
|
else :
|
||||||
|
if "path_hash_mode" in res.payload :
|
||||||
|
print(f"{res.payload['path_hash_mode']}")
|
||||||
|
else:
|
||||||
|
print("Not available")
|
||||||
case "bat" :
|
case "bat" :
|
||||||
res = await mc.commands.get_bat()
|
res = await mc.commands.get_bat()
|
||||||
logger.debug(res)
|
logger.debug(res)
|
||||||
|
|
@ -3748,6 +3775,7 @@ def get_help_for (cmdname, context="line") :
|
||||||
stats_radio : radio stats (noise/rssi/snr/tx_air/rx_air)
|
stats_radio : radio stats (noise/rssi/snr/tx_air/rx_air)
|
||||||
stats_packets : packets stats (recv/sent/flood/direct)
|
stats_packets : packets stats (recv/sent/flood/direct)
|
||||||
allowed_repeat_freq: possible frequency ranges for repeater mode
|
allowed_repeat_freq: possible frequency ranges for repeater mode
|
||||||
|
path_hash_mode
|
||||||
""")
|
""")
|
||||||
|
|
||||||
elif cmdname == "set" :
|
elif cmdname == "set" :
|
||||||
|
|
@ -3772,6 +3800,7 @@ def get_help_for (cmdname, context="line") :
|
||||||
- when on contacts must be added manually using add_pending
|
- when on contacts must be added manually using add_pending
|
||||||
(pending contacts list is built by meshcli from adverts while connected)
|
(pending contacts list is built by meshcli from adverts while connected)
|
||||||
autoadd_config : set autoadd_config flags (see ?autoadd)
|
autoadd_config : set autoadd_config flags (see ?autoadd)
|
||||||
|
path_hash_mode <value>
|
||||||
display:
|
display:
|
||||||
print_timestamp <on/off/fmt>: toggle printing of timestamp, can be strftime format
|
print_timestamp <on/off/fmt>: toggle printing of timestamp, can be strftime format
|
||||||
print_snr <on/off> : toggle snr display in messages
|
print_snr <on/off> : toggle snr display in messages
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue