diff --git a/globals.py b/globals.py index 78b9475..3b598e3 100644 --- a/globals.py +++ b/globals.py @@ -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 \ No newline at end of file +current_window = 0 \ No newline at end of file diff --git a/save_to_radio.py b/save_to_radio.py index 28f45be..3fc7464 100644 --- a/save_to_radio.py +++ b/save_to_radio.py @@ -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}") \ No newline at end of file diff --git a/settings.py b/settings.py index f183a31..461e572 100644 --- a/settings.py +++ b/settings.py @@ -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")