Обновление

This commit is contained in:
cfif 2025-10-24 12:29:49 +03:00
parent bc0282c661
commit baf09ee366
2 changed files with 6 additions and 89 deletions

View File

@ -6,7 +6,7 @@
#include <memory.h> #include <memory.h>
#include "DeviceStorage.h" #include "DeviceStorage.h"
#include "DataNonVolatile.h" #include "DataNonVolatile.h"
#include "StorageOnFlashArtery.h" #include "StorageOnFlashFlagchip.h"
#include "SystemDelayInterface.h" #include "SystemDelayInterface.h"
#define LOGGER env->logger #define LOGGER env->logger
@ -35,87 +35,10 @@ bool DeviceStorage_LoadNonVolatile(tDeviceStorage *env) {
} }
} }
LoggerInfoStatic(LOGGER, LOG_SIGN, "СБРОС НАСТРОЕК УВЭОС"); LoggerInfoStatic(LOGGER, LOG_SIGN, "Сброс настроек");
DeviceDataNonVolatile_InitDefaults(env->nvm); DeviceDataNonVolatile_InitDefaults(env->nvm);
if (!isLoad) {
tStorageOnFlashArtery *storageOnFlashArtery = (tStorageOnFlashArtery *) (env->dumpObserver.interface->env);
tDeviceDataNonVolatile *DeviceDataNonVolatile = (tDeviceDataNonVolatile *) (storageOnFlashArtery->mainFlashPageAddress);
if ( (DeviceDataNonVolatile->gost.VIN.length == 17) && (env->nvm->device.ECUSerialNumber.length < 32) ) {
memcpy(env->nvm->dataTeledata, DeviceDataNonVolatile->dataTeledata, sizeof(DeviceDataNonVolatile->dataTeledata));
LoggerInfoStatic(LOGGER, LOG_SIGN, " ");
LoggerInfoStatic(LOGGER, LOG_SIGN, "=================================================");
LoggerInfoStatic(LOGGER, LOG_SIGN, " ");
LoggerInfoStatic(LOGGER, LOG_SIGN, "НАЙДЕНЫ АКТУАЛЬНЫЕ ДАННЫЕ");
LoggerFormatInfo(LOGGER, LOG_SIGN, "VIN: %s", DeviceDataNonVolatile->gost.VIN.data);
env->nvm->gost.VIN.length = DeviceDataNonVolatile->gost.VIN.length;
memcpy(&env->nvm->gost.VIN.data, DeviceDataNonVolatile->gost.VIN.data, 17);
LoggerFormatInfo(LOGGER, LOG_SIGN, "VEHICLE_PROPULSION_STORAGE_TYPE: %d",
DeviceDataNonVolatile->gost.VEHICLE_PROPULSION_STORAGE_TYPE);
env->nvm->gost.VEHICLE_PROPULSION_STORAGE_TYPE = DeviceDataNonVolatile->gost.VEHICLE_PROPULSION_STORAGE_TYPE;
LoggerFormatInfo(LOGGER, LOG_SIGN, "VEHICLE_TYPE: %d",
DeviceDataNonVolatile->gost.VEHICLE_TYPE);
env->nvm->gost.VEHICLE_TYPE = DeviceDataNonVolatile->gost.VEHICLE_TYPE;
LoggerFormatInfo(LOGGER, LOG_SIGN, "ECUSerialNumber: %s", DeviceDataNonVolatile->device.ECUSerialNumber.data);
env->nvm->device.ECUSerialNumber.length = DeviceDataNonVolatile->device.ECUSerialNumber.length;
memcpy(&env->nvm->device.ECUSerialNumber.data, DeviceDataNonVolatile->device.ECUSerialNumber.data, env->nvm->device.ECUSerialNumber.length);
LoggerFormatInfo(LOGGER, LOG_SIGN, "ASI15_TRESHOLD * 100 : %d", (uint32_t) (DeviceDataNonVolatile->gost.ASI15_TRESHOLD*100));
env->nvm->gost.ASI15_TRESHOLD = DeviceDataNonVolatile->gost.ASI15_TRESHOLD;
LoggerFormatInfo(LOGGER, LOG_SIGN, "AccelCalibrationX: %d",
DeviceDataNonVolatile->device.AccelCalibrationX);
env->nvm->device.AccelCalibrationX = DeviceDataNonVolatile->device.AccelCalibrationX;
LoggerFormatInfo(LOGGER, LOG_SIGN, "AccelCalibrationY: %d",
DeviceDataNonVolatile->device.AccelCalibrationY);
env->nvm->device.AccelCalibrationY = DeviceDataNonVolatile->device.AccelCalibrationY;
LoggerFormatInfo(LOGGER, LOG_SIGN, "AccelCalibrationZ: %d",
DeviceDataNonVolatile->device.AccelCalibrationZ);
env->nvm->device.AccelCalibrationZ = DeviceDataNonVolatile->device.AccelCalibrationZ;
LoggerFormatInfo(LOGGER, LOG_SIGN, "RolloverAngle: %d", DeviceDataNonVolatile->device.RolloverAngle);
env->nvm->device.RolloverAngle = DeviceDataNonVolatile->device.RolloverAngle;
LoggerFormatInfo(LOGGER, LOG_SIGN, "RolloverTime: %d", DeviceDataNonVolatile->device.RolloverTime);
env->nvm->device.RolloverTime = DeviceDataNonVolatile->device.RolloverTime;
LoggerFormatInfo(LOGGER, LOG_SIGN, "DirectionAngle: %d", DeviceDataNonVolatile->device.DirectionAngle);
env->nvm->device.DirectionAngle = DeviceDataNonVolatile->device.DirectionAngle;
LoggerFormatInfo(LOGGER, LOG_SIGN, "factoryMode: %d", DeviceDataNonVolatile->device.factoryMode);
env->nvm->device.factoryMode = DeviceDataNonVolatile->device.factoryMode;
LoggerFormatInfo(LOGGER, LOG_SIGN, "CRASH_SIGNAL_INTERNAL: %d", DeviceDataNonVolatile->gost.CRASH_SIGNAL_INTERNAL);
env->nvm->gost.CRASH_SIGNAL_INTERNAL = DeviceDataNonVolatile->gost.CRASH_SIGNAL_INTERNAL;
LoggerFormatInfo(LOGGER, LOG_SIGN, "telematicaIsActive: %d", DeviceDataNonVolatile->device.telematicaIsActive);
env->nvm->device.telematicaIsActive = DeviceDataNonVolatile->device.telematicaIsActive;
LoggerFormatInfo(LOGGER, LOG_SIGN, "GNSS_GENERAL: %d", DeviceDataNonVolatile->DataToCan.gnss_general_ToCan);
env->nvm->DataToCan.gnss_general_ToCan = DeviceDataNonVolatile->DataToCan.gnss_general_ToCan;
LoggerFormatInfo(LOGGER, LOG_SIGN, "NAV_DATA_TO_CAN: %d", DeviceDataNonVolatile->DataToCan.nav_data_ToCan);
env->nvm->DataToCan.nav_data_ToCan = DeviceDataNonVolatile->DataToCan.nav_data_ToCan;
LoggerFormatInfo(LOGGER, LOG_SIGN, "MODEM_SOFT_VERSION: %s", DeviceDataNonVolatile->device.modemSoftVers);
env->nvm->device.modemSoftVers.length = DeviceDataNonVolatile->device.modemSoftVers.length;
memcpy(env->nvm->device.modemSoftVers.data, DeviceDataNonVolatile->device.modemSoftVers.data, DeviceDataNonVolatile->device.modemSoftVers.length);
LoggerInfoStatic(LOGGER, LOG_SIGN, " ");
LoggerInfoStatic(LOGGER, LOG_SIGN, "=================================================");
LoggerInfoStatic(LOGGER, LOG_SIGN, " ");
}
}
return VarsTabDumpObserver_Dump(&env->dumpObserver); return VarsTabDumpObserver_Dump(&env->dumpObserver);
} }
@ -135,19 +58,14 @@ void DeviceStorage_InitCommon(tDeviceStorage *env, tStorageInterface *storageInt
5000, 5000,
env->nvm, env->nvm,
// sizeof(env->nvm), // sizeof(env->nvm),
16000, 16000,
&env->publicVariablesTable, &env->publicVariablesTable,
VARIABLE_GROUP_FLASH VARIABLE_GROUP_FLASH
); );
env->uveosDumper = (tEraGlonassUveosDumperInterface) {
.env = env,
.forceDump = (eraGlonassForceDumpCall) DeviceStorage_ForceDump
};
DeviceStorage_InitVariablesTable(env); DeviceStorage_InitVariablesTable(env);
bool t=0;
} }
void DeviceStorage_InitDefaults(tDeviceStorage *env) { void DeviceStorage_InitDefaults(tDeviceStorage *env) {
@ -158,8 +76,7 @@ void DeviceStorage_InitDefaults(tDeviceStorage *env) {
uint8_t dataReservedStore[16000]; uint8_t dataReservedStore[16000];
bool DeviceStorage_Init(tDeviceStorage *env, tStorageInterface *storageInterface) { bool DeviceStorage_Init(tDeviceStorage *env, tStorageInterface *storageInterface) {
env->nvm = (tDeviceDataNonVolatile *)dataReservedStore; env->nvm = (tDeviceDataNonVolatile *) dataReservedStore;
DeviceStorage_InitCommon(env, storageInterface); DeviceStorage_InitCommon(env, storageInterface);
return DeviceStorage_LoadNonVolatile(env); return DeviceStorage_LoadNonVolatile(env);

View File

@ -4,13 +4,13 @@
#ifndef HVAC_DEVICESTORAGE_H #ifndef HVAC_DEVICESTORAGE_H
#define HVAC_DEVICESTORAGE_H #define HVAC_DEVICESTORAGE_H
//#include "EraGlonassUveos.h"
//#include "DeviceDataNonVolatile.h" //#include "DeviceDataNonVolatile.h"
//#include "DeviceDataRuntime.h" //#include "DeviceDataRuntime.h"
#include "LoggerInterface.h" #include "LoggerInterface.h"
#include "DataRuntime.h" #include "DataRuntime.h"
#include "DataNonVolatile.h" #include "DataNonVolatile.h"
#include "StorageIO.h"
#include "VarsTabDumpObserver.h" #include "VarsTabDumpObserver.h"