Skip to content

Commit

Permalink
Set list-type keys differently, excluding 0-like values and resetting…
Browse files Browse the repository at this point in the history
… whole list
  • Loading branch information
ianmcorvidae committed Sep 18, 2024
1 parent 4fdbcb9 commit c696d59
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion meshtastic/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit c696d59

Please sign in to comment.