From 00dbbe1b284b42d0f0dfc507c10a8a97d5c3c09f Mon Sep 17 00:00:00 2001 From: Aurora Wright Date: Fri, 14 Apr 2017 05:02:45 +0200 Subject: [PATCH] Not needed to save the whole struct --- source/config.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/source/config.c b/source/config.c index 53198f7..6c02839 100644 --- a/source/config.c +++ b/source/config.c @@ -31,7 +31,7 @@ CfgData configData; ConfigurationStatus needConfig; -static CfgData oldConfig; +static u32 oldConfig; bool readConfig(void) { @@ -48,19 +48,18 @@ bool readConfig(void) } else ret = true; - oldConfig = configData; + oldConfig = configData.config; return ret; } void writeConfig(bool isPayloadLaunch) { + if(isPayloadLaunch) configData.config = (configData.config & 0xFFFFFF00) | (oldConfig & 0xFF); + /* If the configuration is different from previously, overwrite it. Just the no-forcing flag being set is not enough */ - - if(isPayloadLaunch) configData.config = (configData.config & 0xFFFFFF00) | (oldConfig.config & 0xFF); - - if(needConfig != CREATE_CONFIGURATION && (configData.config & 0xFFFFFF7F) == oldConfig.config) return; + if(needConfig != CREATE_CONFIGURATION && (configData.config & 0xFFFFFF7F) == oldConfig) return; if(needConfig == CREATE_CONFIGURATION) {