Обновление

This commit is contained in:
cfif 2026-04-27 17:38:44 +03:00
parent c9db613d73
commit 129e2d1d33
2 changed files with 28 additions and 15 deletions

View File

@ -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);
// }
}

View File

@ -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);