From db579beb51ceda61aa2b0cae4ca13a546de762fe Mon Sep 17 00:00:00 2001 From: cfif Date: Fri, 16 Jan 2026 12:58:16 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VarTabDumpObserver.c | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/VarTabDumpObserver.c b/VarTabDumpObserver.c index 382db76..f613501 100644 --- a/VarTabDumpObserver.c +++ b/VarTabDumpObserver.c @@ -6,6 +6,7 @@ #include "VarsTabDumpObserver.h" #include "SystemDelayInterface.h" #include "string.h" +#include "StorageOnFlashFlagchip.h" #define LOGGER env->logger @@ -101,16 +102,18 @@ bool VarsTabDumpObserverParam_Load(tVarsTabDumpObserver *env) { bool VarsTabDumpObserverCalib_Dump(tVarsTabDumpObserver *env) { LoggerInfoStatic(LOGGER, LOG_SIGN, "Calibrations: Attempting to write to ROM") + tStorageOnFlashFlagchip *storageOnFlashChipsCheckClear = env->interfaceCalib->env; -// if (env->logger) { -// env->logger->logging( -// env->logger->env, "Калибровки. Хран.Наб.", -// sizeof("Калибровки. Хран.Наб.") - 1, -// LOGLEVEL_INFO, -// "Калибровки. Запись в ПЗУ...", -// sizeof("Калибровки. Запись в ПЗУ...") - 1, true -// ); -// } + int isMainFlashPageAddressCheckClear = memcmp((uint8_t *) storageOnFlashChipsCheckClear->mainFlashPageAddress, + env->dataCalib, env->sizeCalib - 8); + + int isRecoveryFlashPageAddressCheckClear = memcmp( + (uint8_t *) storageOnFlashChipsCheckClear->recoveryFlashPageAddress, env->dataCalib, env->sizeCalib -8); + + if ((isMainFlashPageAddressCheckClear == 0) && (isRecoveryFlashPageAddressCheckClear == 0)) { + LoggerInfoStatic(LOGGER, LOG_SIGN, "Calibrations: No need to write to ROM") + return true; + } if (osMutexAcquire(env->accessDumper, 1000) == osOK) { @@ -144,16 +147,18 @@ bool VarsTabDumpObserverCalib_Dump(tVarsTabDumpObserver *env) { bool VarsTabDumpObserverParam_Dump(tVarsTabDumpObserver *env) { LoggerInfoStatic(LOGGER, LOG_SIGN, "Parameters: Attempting to write to ROM") + tStorageOnFlashFlagchip *storageOnFlashChipsCheckClear = env->interfaceParam->env; -// if (env->logger) { -// env->logger->logging( -// env->logger->env, "Парамеры. Хран.Наб.", -// sizeof("Парамеры. Хран.Наб.") - 1, -// LOGLEVEL_INFO, -// "Парамеры. Запись в ПЗУ...", -// sizeof("Парамеры. Запись в ПЗУ...") - 1, true -// ); -// } + int isMainFlashPageAddressCheckClear = memcmp((uint8_t *) storageOnFlashChipsCheckClear->mainFlashPageAddress, + env->dataParam, env->sizeParam - 8); + + int isRecoveryFlashPageAddressCheckClear = memcmp( + (uint8_t *) storageOnFlashChipsCheckClear->recoveryFlashPageAddress, env->dataParam, env->sizeParam - 8); + + if ((isMainFlashPageAddressCheckClear == 0) && (isRecoveryFlashPageAddressCheckClear == 0)) { + LoggerInfoStatic(LOGGER, LOG_SIGN, "Parameters: No need to write to ROM") + return true; + } if (osMutexAcquire(env->accessDumper, 1000) == osOK) {