Not needed to save the whole struct

This commit is contained in:
Aurora Wright 2017-04-14 05:02:45 +02:00
parent 7f33309903
commit 00dbbe1b28

View File

@ -31,7 +31,7 @@
CfgData configData; CfgData configData;
ConfigurationStatus needConfig; ConfigurationStatus needConfig;
static CfgData oldConfig; static u32 oldConfig;
bool readConfig(void) bool readConfig(void)
{ {
@ -48,19 +48,18 @@ bool readConfig(void)
} }
else ret = true; else ret = true;
oldConfig = configData; oldConfig = configData.config;
return ret; return ret;
} }
void writeConfig(bool isPayloadLaunch) void writeConfig(bool isPayloadLaunch)
{ {
if(isPayloadLaunch) configData.config = (configData.config & 0xFFFFFF00) | (oldConfig & 0xFF);
/* If the configuration is different from previously, overwrite it. /* If the configuration is different from previously, overwrite it.
Just the no-forcing flag being set is not enough */ Just the no-forcing flag being set is not enough */
if(needConfig != CREATE_CONFIGURATION && (configData.config & 0xFFFFFF7F) == oldConfig) return;
if(isPayloadLaunch) configData.config = (configData.config & 0xFFFFFF00) | (oldConfig.config & 0xFF);
if(needConfig != CREATE_CONFIGURATION && (configData.config & 0xFFFFFF7F) == oldConfig.config) return;
if(needConfig == CREATE_CONFIGURATION) if(needConfig == CREATE_CONFIGURATION)
{ {