mirror of
https://github.com/pdxlocations/contact.git
synced 2026-08-05 16:33:33 +02:00
use global interface in save
This commit is contained in:
committed by
pdxlocations
parent
3db44f4ae3
commit
f644b92356
+2
-2
@@ -1,4 +1,5 @@
|
||||
interface = None
|
||||
lock = None
|
||||
display_log = False
|
||||
all_messages = {}
|
||||
channel_list = []
|
||||
@@ -9,5 +10,4 @@ myNodeNum = 0
|
||||
selected_channel = 0
|
||||
selected_message = 0
|
||||
selected_node = 0
|
||||
current_window = 0
|
||||
lock = None
|
||||
current_window = 0
|
||||
+4
-4
@@ -5,7 +5,7 @@ import base64
|
||||
from db_handler import update_node_info_in_db
|
||||
import globals
|
||||
|
||||
def save_changes(interface, menu_path, modified_settings):
|
||||
def save_changes(menu_path, modified_settings):
|
||||
"""
|
||||
Save changes to the device based on modified settings.
|
||||
:param interface: Meshtastic interface instance
|
||||
@@ -17,7 +17,7 @@ def save_changes(interface, menu_path, modified_settings):
|
||||
logging.info("No changes to save. modified_settings is empty.")
|
||||
return
|
||||
|
||||
node = interface.getNode('^local')
|
||||
node = globals.interface.getNode('^local')
|
||||
|
||||
if menu_path[1] == "Radio Settings" or menu_path[1] == "Module Settings":
|
||||
config_category = menu_path[2].lower() # for radio and module configs
|
||||
@@ -27,7 +27,7 @@ def save_changes(interface, menu_path, modified_settings):
|
||||
lon = float(modified_settings.get('longitude', 0.0))
|
||||
alt = int(modified_settings.get('altitude', 0))
|
||||
|
||||
interface.localNode.setFixedPosition(lat, lon, alt)
|
||||
globals.interface.localNode.setFixedPosition(lat, lon, alt)
|
||||
logging.info(f"Updated {config_category} with Latitude: {lat} and Longitude {lon} and Altitude {alt}")
|
||||
return
|
||||
|
||||
@@ -123,4 +123,4 @@ def save_changes(interface, menu_path, modified_settings):
|
||||
logging.error(f"Failed to write configuration for category '{config_category}': {e}")
|
||||
|
||||
except Exception as e:
|
||||
logging.error(f"Error saving changes: {e}")
|
||||
logging.error(f"Error saving changes: {e}")
|
||||
+1
-1
@@ -152,7 +152,7 @@ def settings_menu(stdscr, interface):
|
||||
menu_win.erase()
|
||||
menu_win.refresh()
|
||||
if show_save_option and selected_index == len(options):
|
||||
save_changes(interface, menu_path, modified_settings)
|
||||
save_changes(menu_path, modified_settings)
|
||||
modified_settings.clear()
|
||||
logging.info("Changes Saved")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user