From 06b5b8fa83f22d46885b0891b46ff8fbb8a6b7f9 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 29 Jun 2022 20:01:48 -0500 Subject: [PATCH] It works, I think --- .vscode/launch.json | 16 ++++++++++++++++ meshtastic/__main__.py | 10 +++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 025d4ef..3250260 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -52,6 +52,14 @@ "justMyCode": true, "args": ["--debug", "--get", "power.is_power_saving"] }, + { + "name": "meshtastic debug getPref telemetry", + "type": "python", + "request": "launch", + "module": "meshtastic", + "justMyCode": true, + "args": ["--debug", "--get", "telemetry.environment_update_interval"] + }, { "name": "meshtastic debug info", "type": "python", @@ -68,6 +76,14 @@ "justMyCode": true, "args": ["--debug", "--set", "power.is_power_saving", "1"] }, + { + "name": "meshtastic debug setPref telemetry", + "type": "python", + "request": "launch", + "module": "meshtastic", + "justMyCode": true, + "args": ["--debug", "--set", "telemetry.environment_update_interval", "120"] + }, { "name": "meshtastic debug setPref telemetry", "type": "python", diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index f97f976..2f62419 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -332,15 +332,15 @@ def onConnected(interface): if not found: found = setPref(node.moduleConfig, pref[0], pref[1]) - if not found: + if found: + print("Writing modified preferences to device") + interface.getNode(args.dest).writeConfig() + else: if Globals.getInstance().get_camel_case(): - print(f"{localConfig.__class__.__name__} and {moduleConfig.__class__.__name__} do not have an attribute {pref[0]}.") + print(f"{localConfig.__class__.__name__} and {moduleConfig.__class__.__name__} do not have an attribute {pref[0]}.") else: print(f"{localConfig.__class__.__name__} and {moduleConfig.__class__.__name__} do not have attribute {pref[0]}.") - print("Writing modified preferences to device") - interface.getNode(args.dest).writeConfig() - if args.configure: with open(args.configure[0], encoding='utf8') as file: configuration = yaml.safe_load(file)