mirror of
https://github.com/meshtastic/python.git
synced 2026-01-18 20:57:57 -05:00
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:
committed by
Felix Moessbauer
parent
6ceae7c72f
commit
4ca13bcede
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user