Skip to content
Snippets Groups Projects
Commit 728dfc68 authored by JuanPi Carbajal's avatar JuanPi Carbajal
Browse files

html ui: do nto fail of unique id in loaded file is empty

parent 2a99333b
No related branches found
No related tags found
No related merge requests found
......@@ -115,11 +115,10 @@ def load_config_file(fname):
if k in config_file_dict}
# Make sure device name is str and conserve unique id
if isinstance(formdict['device_name'], int):
hexname = f"{formdict['device_name']:#026X}"
formdict['device_name'] = hexname.replace('X', 'x', 1)
hexid = f"{formdict['unique_id']:#026X}"
formdict['unique_id'] = hexid.replace('X', 'x', 1)
for field in ('device_name', 'unique_id'):
if isinstance(formdict[field], int):
hexfield = f"{formdict[field]:#026X}"
formdict[field] = hexfield.replace('X', 'x', 1)
# mV to V
formdict['battery_cell_voltage'] = float(formdict['battery_cell_voltage']) * 1e-3
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment