mirror of
https://github.com/meshcore-dev/meshcore-cli.git
synced 2026-04-20 22:13:48 +00:00
add clock sync to repeater serial
This commit is contained in:
parent
92af5f7479
commit
246a84ee05
2 changed files with 9 additions and 2 deletions
|
|
@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "meshcore-cli"
|
name = "meshcore-cli"
|
||||||
version = "1.3.15"
|
version = "1.3.16"
|
||||||
authors = [
|
authors = [
|
||||||
{ name="Florent de Lamotte", email="florent@frizoncorrea.fr" },
|
{ name="Florent de Lamotte", email="florent@frizoncorrea.fr" },
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ import re
|
||||||
from meshcore import MeshCore, EventType, logger
|
from meshcore import MeshCore, EventType, logger
|
||||||
|
|
||||||
# Version
|
# Version
|
||||||
VERSION = "v1.3.15"
|
VERSION = "v1.3.16"
|
||||||
|
|
||||||
# default ble address is stored in a config file
|
# default ble address is stored in a config file
|
||||||
MCCLI_CONFIG_DIR = str(Path.home()) + "/.config/meshcore/"
|
MCCLI_CONFIG_DIR = str(Path.home()) + "/.config/meshcore/"
|
||||||
|
|
@ -3829,6 +3829,13 @@ async def repeater_loop(port, baudrate):
|
||||||
print(REPEATER_HELP)
|
print(REPEATER_HELP)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if cmd.lower() == "clock sync" or cmd.lower() == "st" or cmd.lower() == "sync_time":
|
||||||
|
cur_time = int(time.time())
|
||||||
|
print(f'{ANSI_GREEN}Syncing clock to'
|
||||||
|
f' {datetime.datetime.fromtimestamp(cur_time).strftime("%Y-%m-%d %H:%M:%S")}'
|
||||||
|
f' ({cur_time}){ANSI_END}')
|
||||||
|
cmd = f"time {cur_time}"
|
||||||
|
|
||||||
# Send command with CR terminator
|
# Send command with CR terminator
|
||||||
ser.write(f"{cmd}\r".encode())
|
ser.write(f"{cmd}\r".encode())
|
||||||
await asyncio.sleep(0.3)
|
await asyncio.sleep(0.3)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue