From 09bcb0cf4234fbdd8e8b02bcb6e32de0b053d5e4 Mon Sep 17 00:00:00 2001 From: Markus Hitter Date: Wed, 1 Jun 2016 13:13:22 +0200 Subject: [PATCH] Configtool: attempt to fix broken pin definitions. We can't magically find out what the right pin is, but we can at least make sure it gets written with valid syntax next time. This also ensures pins can be handled in the GUI, avoiding failures like the one reported by inline comments here: https://github.com/Traumflug/Teacup_Firmware/commit/b9fe0a5dd00b3232d6b983caf0f2f2037aabad1a --- configtool/page.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/configtool/page.py b/configtool/page.py index 0af2603..8837bb5 100644 --- a/configtool/page.py +++ b/configtool/page.py @@ -267,11 +267,18 @@ class Page: print "Key " + k + " not found in config data." for k in self.choices.keys(): - if k in cfgValues.keys(): - self.choicesOriginal[k] = cfgValues[k] - self.setChoice(k, cfgValues, "-") - else: + if k not in cfgValues.keys(): print "Key " + k + " not found in config data." + # Fix this. + cfgValues[k] = ("xxxx", False) + + # Fix existing #define, but missing value. + if isinstance(cfgValues[k], bool): + print("Fixing %s from boolean to pin with value." % k); + cfgValues[k] = ("xxxx", False) + + self.choicesOriginal[k] = cfgValues[k] + self.setChoice(k, cfgValues, "-") for k in self.boolChoices.keys(): choice = self.boolChoices[k]