fix setting of list item on configure

When setting the whole configuration via --configure, list types like
adminKey need special handling. Previously this failed as a list cannot
be appended to a list. The new code adds dedicated logic to replace the
repeated value when passing a list. Also, all items of that list are
converted into the correct (typed) form before setting them.
This commit is contained in:
Felix Moessbauer
2024-10-25 15:48:55 +02:00
committed by Felix Moessbauer
parent 6ceae7c72f
commit 4ca13bcede

View File

@@ -241,6 +241,10 @@ def setPref(config, comp_name, raw_val) -> bool:
# The setter didn't like our arg type guess try again as a string
config_values = getattr(config_part, config_type.name)
setattr(config_values, pref.name, str(val))
elif type(val) == list:
new_vals = [meshtastic.util.fromStr(x) for x in val]
config_values = getattr(config, config_type.name)
getattr(config_values, pref.name)[:] = new_vals
else:
config_values = getattr(config, config_type.name)
if val == 0: