mirror of https://github.com/rusefi/wideband.git
port: GetConfiguration() return reference, not copy (#161)
This commit is contained in:
parent
5fbe108258
commit
0a4a609db9
|
@ -95,12 +95,12 @@ int InitConfiguration()
|
|||
return 0;
|
||||
}
|
||||
|
||||
Configuration GetConfiguration()
|
||||
static Configuration c;
|
||||
|
||||
Configuration& GetConfiguration()
|
||||
{
|
||||
const auto& cfg = __configflash__start__;
|
||||
|
||||
Configuration c;
|
||||
|
||||
// If config has been written before, use the stored configuration
|
||||
if (cfg.IsValid())
|
||||
{
|
||||
|
|
|
@ -117,10 +117,12 @@ static struct {
|
|||
uint8_t pad[128];
|
||||
} config;
|
||||
|
||||
Configuration GetConfiguration()
|
||||
static Configuration c;
|
||||
|
||||
Configuration& GetConfiguration()
|
||||
{
|
||||
// TODO: implement me!
|
||||
return {};
|
||||
return c;
|
||||
}
|
||||
|
||||
void SetConfiguration(const Configuration& newConfig)
|
||||
|
|
|
@ -81,10 +81,12 @@ static struct {
|
|||
uint8_t pad[128];
|
||||
} config;
|
||||
|
||||
Configuration GetConfiguration()
|
||||
static Configuration c;
|
||||
|
||||
Configuration& GetConfiguration()
|
||||
{
|
||||
// TODO: implement me!
|
||||
return {};
|
||||
return c;
|
||||
}
|
||||
|
||||
void SetConfiguration(const Configuration& newConfig)
|
||||
|
|
|
@ -108,10 +108,12 @@ int InitConfiguration()
|
|||
return 0;
|
||||
}
|
||||
|
||||
Configuration GetConfiguration()
|
||||
static Configuration c;
|
||||
|
||||
Configuration& GetConfiguration()
|
||||
{
|
||||
// TODO: implement me!
|
||||
return {};
|
||||
return c;
|
||||
}
|
||||
|
||||
void SetConfiguration(const Configuration& newConfig)
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
uint8_t pad[128 - 1 - 4];
|
||||
};
|
||||
|
||||
Configuration GetConfiguration();
|
||||
Configuration& GetConfiguration();
|
||||
void SetConfiguration(const Configuration& newConfig);
|
||||
|
||||
/* TS stuff */
|
||||
|
|
|
@ -100,7 +100,7 @@ void CanRxThread(void*)
|
|||
// Check if it's an "index set" message
|
||||
else if (frame.DLC == 1 && frame.EID == WB_MSG_SET_INDEX)
|
||||
{
|
||||
auto newCfg = GetConfiguration();
|
||||
auto &newCfg = GetConfiguration();
|
||||
newCfg.CanIndexOffset = frame.data8[0];
|
||||
SetConfiguration(newCfg);
|
||||
configuration = GetConfiguration();
|
||||
|
|
Loading…
Reference in New Issue