diff --git a/DeviceStorage.c b/DeviceStorage.c index d5c000c..23b350d 100644 --- a/DeviceStorage.c +++ b/DeviceStorage.c @@ -132,3 +132,20 @@ bool DeviceStorage_Init(tDeviceStorage *env, bool loadParamOnly, tStorageInterfa return false; } + +void LoadFromStorageToStatusData(tDeviceStorage *env, ecu_identification_t *ecu) { + if (osMutexAcquire(env->dumpObserver.accessDumper, 1000) == osOK) { + memcpy(ecu, &env->dataParam->device.identification, sizeof(ecu_identification_t)); + osMutexRelease(env->dumpObserver.accessDumper); + } +} + +void SaveToStorageFromStatusData(tDeviceStorage *env, ecu_identification_t *ecu) { + + if (osMutexAcquire(env->dumpObserver.accessDumper, 1000) == osOK) { + memcpy(&env->dataParam->device.identification, ecu, sizeof(ecu_identification_t)); + osMutexRelease(env->dumpObserver.accessDumper); + } + + DeviceStorageParam_DelayedDump(env); +} \ No newline at end of file diff --git a/DeviceStorage.h b/DeviceStorage.h index 17c0c36..8df8a1a 100644 --- a/DeviceStorage.h +++ b/DeviceStorage.h @@ -32,4 +32,7 @@ void DeviceStorageCalib_ForceDump(tDeviceStorage *env); void DeviceStorageParam_ForceDump(tDeviceStorage *env); void DeviceStorageParam_DelayedDump(tDeviceStorage *env); +void LoadFromStorageToStatusData(tDeviceStorage *env, ecu_identification_t *ecu); +void SaveToStorageFromStatusData(tDeviceStorage *env, ecu_identification_t *ecu); + #endif //HVAC_DEVICESTORAGE_H