From c696d59b9052361856630c8eb97a061cdb51dc6b Mon Sep 17 00:00:00 2001 From: Ian McEwen Date: Tue, 17 Sep 2024 21:52:57 -0700 Subject: [PATCH] Set list-type keys differently, excluding 0-like values and resetting whole list --- meshtastic/__main__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index a9fb7886..8eb04eb7 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -253,7 +253,9 @@ def setPref(config, comp_name, valStr) -> bool: del getattr(config_values, pref.name)[:] else: print(f"Adding '{val}' to the {pref.name} list") - getattr(config_values, pref.name).append(val) + cur_vals = [x for x in getattr(config_values, pref.name) if x not in [0, "", b""]] + cur_vals.append(val) + getattr(config_values, pref.name)[:] = cur_vals prefix = f"{'.'.join(name[0:-1])}." if config_type.message_type is not None else "" if mt_config.camel_case: