migrate waterfall settings away from tuples

This commit is contained in:
Jakob Ketterl
2020-03-29 18:49:13 +02:00
parent 1d5f450f74
commit 056a8a3289
3 changed files with 17 additions and 12 deletions

View File

@ -29,8 +29,13 @@ class ConfigMigrator(ABC):
class ConfigMigratorVersion1(ConfigMigrator):
def migrate(self, config):
gps = config["receiver_gps"]
config["receiver_gps"] = {"lat": gps[0], "lon": gps[1]}
if "receiver_gps" in config:
gps = config["receiver_gps"]
config["receiver_gps"] = {"lat": gps[0], "lon": gps[1]}
if "waterfall_auto_level_margin" in config:
levels = config["waterfall_auto_level_margin"]
config["waterfall_auto_level_margin"] = {"min": levels[0], "max": levels[1]}
config["version"] = 2
return config