Update __main__.py

Simple patch to fix the ignore_incoming management aka
https://github.com/meshtastic/python/issues/568
This commit is contained in:
868meshbot
2024-05-25 16:28:16 +01:00
committed by GitHub
parent 8d538e8f24
commit bcd60c9ef7

View File

@@ -226,13 +226,14 @@ def setPref(config, comp_name, valStr) -> bool:
config_values = getattr(config_part, config_type.name)
setattr(config_values, pref.name, valStr)
else:
config_values = getattr(config, config_type.name)
if val == 0:
# clear values
print("Clearing ignore_incoming list")
del config_type.message_type.ignore_incoming[:]
del config_values.ignore_incoming[:]
else:
print(f"Adding '{val}' to the ignore_incoming list")
config_type.message_type.ignore_incoming.extend([val])
config_values.ignore_incoming.extend([int(valStr)])
prefix = f"{'.'.join(name[0:-1])}." if config_type.message_type is not None else ""
if mt_config.camel_case: