From 129e2d1d33a5545593508215d03bb94a3a60b575 Mon Sep 17 00:00:00 2001 From: cfif Date: Mon, 27 Apr 2026 17:38:44 +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 --- DiagnosticTask.c | 27 +++++++++++++++++++-------- DiagnosticTask.h | 16 +++++++++------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/DiagnosticTask.c b/DiagnosticTask.c index b47d949..216c600 100644 --- a/DiagnosticTask.c +++ b/DiagnosticTask.c @@ -5,6 +5,7 @@ #include "CmsisRtosThreadUtils.h" #include "StatusData.h" #include "StatusError.h" +#include "HVAC_model.h" #define LOG_SIGN "DIAGNOSTIC" #define LOGGER env->logger @@ -23,8 +24,8 @@ void Diagnostic_Init(tDiagnostic *env, tLoggerInterface *logger) { // dtc_state_error[i] = UDS_dtc_mask_testNotCompletedThisOperationCycle; // } - InitThreadAtrStatic(&env->thread.attr, "Diagnostic", env->thread.controlBlock, env->thread.stack, - osPriorityNormal); +// InitThreadAtrStatic(&env->thread.attr, "Diagnostic", env->thread.controlBlock, env->thread.stack, +// osPriorityNormal); } static uint32_t diagnostic_ClearDiagnosticInformation_14(tDiagnostic *env, void *extEnv) { @@ -375,17 +376,19 @@ uint32_t SetGetDiagnosticData(tDiagnostic *env, eDiagnosticType diagnosticType, if (diagnostic_com[diagnosticType].func != NULL) { - if (osMutexAcquire(env->access, 1000) == osOK) { + if (osMutexAcquire(env->access, 5000) == osOK) { ret = diagnostic_com[diagnosticType].func(env, extEnv); osMutexRelease(env->access); + } else { + LoggerInfoStatic(LOGGER, LOG_SIGN, "Access error SetGetDiagnosticData"); } } return ret; } -void setNoBitsDTC(tDiagnostic *env, bool noBitsDTC) { - if (osMutexAcquire(env->access, 1000) == osOK) { +void set_NoBitsDTC(tDiagnostic *env, bool noBitsDTC) { + if (osMutexAcquire(env->access, 5000) == osOK) { env->isNoBitsDTC = noBitsDTC; memcpy(dtc_state_FIX_error, dtc_state_error, sizeof(dtc_state_error)); @@ -396,6 +399,14 @@ void setNoBitsDTC(tDiagnostic *env, bool noBitsDTC) { } } +// Ошибки DTC +void set_Dtc_state_error(tDiagnostic *env) { + if (osMutexAcquire(env->access, 1000) == osOK) { + memcpy(&dtc_state_error, &rtDW.dtc_state_error_model, sizeof(rtDW.dtc_state_error_model)); + osMutexRelease(env->access); + } +} + static _Noreturn void Diagnostic_Thread(tDiagnostic *env) { for (;;) { @@ -413,7 +424,7 @@ static _Noreturn void Diagnostic_Thread(tDiagnostic *env) { } void Diagnostic_StartThread(tDiagnostic *env) { - if (!env->thread.id) { - env->thread.id = osThreadNew((osThreadFunc_t) (Diagnostic_Thread), (void *) (env), &env->thread.attr); - } +// if (!env->thread.id) { +// env->thread.id = osThreadNew((osThreadFunc_t) (Diagnostic_Thread), (void *) (env), &env->thread.attr); +// } } \ No newline at end of file diff --git a/DiagnosticTask.h b/DiagnosticTask.h index d87e5c5..e336aa3 100644 --- a/DiagnosticTask.h +++ b/DiagnosticTask.h @@ -30,12 +30,12 @@ typedef struct { bool isNoBitsDTC; - struct { - osThreadId_t id; - uint32_t stack[512]; - StaticTask_t controlBlock; - osThreadAttr_t attr; - } thread; +// struct { +// osThreadId_t id; +// uint32_t stack[512]; +// StaticTask_t controlBlock; +// osThreadAttr_t attr; +// } thread; } tDiagnostic; @@ -50,7 +50,9 @@ void Diagnostic_Init(tDiagnostic *env, tLoggerInterface *logger); void Diagnostic_StartThread(tDiagnostic *env); -void setNoBitsDTC(tDiagnostic *env, bool noBitsDTC); +void set_NoBitsDTC(tDiagnostic *env, bool noBitsDTC); + +void set_Dtc_state_error(tDiagnostic *env); uint32_t SetGetDiagnosticData(tDiagnostic *env, eDiagnosticType diagnosticType, void *extEnv);