Обновление
This commit is contained in:
parent
c9db613d73
commit
129e2d1d33
|
|
@ -5,6 +5,7 @@
|
||||||
#include "CmsisRtosThreadUtils.h"
|
#include "CmsisRtosThreadUtils.h"
|
||||||
#include "StatusData.h"
|
#include "StatusData.h"
|
||||||
#include "StatusError.h"
|
#include "StatusError.h"
|
||||||
|
#include "HVAC_model.h"
|
||||||
|
|
||||||
#define LOG_SIGN "DIAGNOSTIC"
|
#define LOG_SIGN "DIAGNOSTIC"
|
||||||
#define LOGGER env->logger
|
#define LOGGER env->logger
|
||||||
|
|
@ -23,8 +24,8 @@ void Diagnostic_Init(tDiagnostic *env, tLoggerInterface *logger) {
|
||||||
// dtc_state_error[i] = UDS_dtc_mask_testNotCompletedThisOperationCycle;
|
// dtc_state_error[i] = UDS_dtc_mask_testNotCompletedThisOperationCycle;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
InitThreadAtrStatic(&env->thread.attr, "Diagnostic", env->thread.controlBlock, env->thread.stack,
|
// InitThreadAtrStatic(&env->thread.attr, "Diagnostic", env->thread.controlBlock, env->thread.stack,
|
||||||
osPriorityNormal);
|
// osPriorityNormal);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t diagnostic_ClearDiagnosticInformation_14(tDiagnostic *env, void *extEnv) {
|
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 (diagnostic_com[diagnosticType].func != NULL) {
|
||||||
|
|
||||||
if (osMutexAcquire(env->access, 1000) == osOK) {
|
if (osMutexAcquire(env->access, 5000) == osOK) {
|
||||||
ret = diagnostic_com[diagnosticType].func(env, extEnv);
|
ret = diagnostic_com[diagnosticType].func(env, extEnv);
|
||||||
osMutexRelease(env->access);
|
osMutexRelease(env->access);
|
||||||
|
} else {
|
||||||
|
LoggerInfoStatic(LOGGER, LOG_SIGN, "Access error SetGetDiagnosticData");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setNoBitsDTC(tDiagnostic *env, bool noBitsDTC) {
|
void set_NoBitsDTC(tDiagnostic *env, bool noBitsDTC) {
|
||||||
if (osMutexAcquire(env->access, 1000) == osOK) {
|
if (osMutexAcquire(env->access, 5000) == osOK) {
|
||||||
|
|
||||||
env->isNoBitsDTC = noBitsDTC;
|
env->isNoBitsDTC = noBitsDTC;
|
||||||
memcpy(dtc_state_FIX_error, dtc_state_error, sizeof(dtc_state_error));
|
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) {
|
static _Noreturn void Diagnostic_Thread(tDiagnostic *env) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
@ -413,7 +424,7 @@ static _Noreturn void Diagnostic_Thread(tDiagnostic *env) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Diagnostic_StartThread(tDiagnostic *env) {
|
void Diagnostic_StartThread(tDiagnostic *env) {
|
||||||
if (!env->thread.id) {
|
// if (!env->thread.id) {
|
||||||
env->thread.id = osThreadNew((osThreadFunc_t) (Diagnostic_Thread), (void *) (env), &env->thread.attr);
|
// env->thread.id = osThreadNew((osThreadFunc_t) (Diagnostic_Thread), (void *) (env), &env->thread.attr);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
@ -30,12 +30,12 @@ typedef struct {
|
||||||
|
|
||||||
bool isNoBitsDTC;
|
bool isNoBitsDTC;
|
||||||
|
|
||||||
struct {
|
// struct {
|
||||||
osThreadId_t id;
|
// osThreadId_t id;
|
||||||
uint32_t stack[512];
|
// uint32_t stack[512];
|
||||||
StaticTask_t controlBlock;
|
// StaticTask_t controlBlock;
|
||||||
osThreadAttr_t attr;
|
// osThreadAttr_t attr;
|
||||||
} thread;
|
// } thread;
|
||||||
|
|
||||||
} tDiagnostic;
|
} tDiagnostic;
|
||||||
|
|
||||||
|
|
@ -50,7 +50,9 @@ void Diagnostic_Init(tDiagnostic *env, tLoggerInterface *logger);
|
||||||
|
|
||||||
void Diagnostic_StartThread(tDiagnostic *env);
|
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);
|
uint32_t SetGetDiagnosticData(tDiagnostic *env, eDiagnosticType diagnosticType, void *extEnv);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue