Обновление

This commit is contained in:
cfif 2026-04-27 17:38:44 +03:00
parent 800897a0f7
commit 20da53c2d8
3 changed files with 26 additions and 40 deletions

View File

@ -107,7 +107,7 @@ void ANALOG_SENSOR(tMma *env, char *desc, uint16_t adc_value) {
void LoadDataInFromModel(tMma *env) { void LoadDataInFromModel(tMma *env) {
// int16_t temp1 = 0; // int16_t temp1 = 0;
// float temp2 = 0; // float temp2 = 0;
/*
if (osMutexAcquire(env->adcTask0.access, 5000) == osOK) { if (osMutexAcquire(env->adcTask0.access, 5000) == osOK) {
if (env->adcTask0.ADC_isUpdate) { if (env->adcTask0.ADC_isUpdate) {
@ -218,7 +218,7 @@ void LoadDataInFromModel(tMma *env) {
osMutexRelease(env->adcTask1.access); osMutexRelease(env->adcTask1.access);
//LoggerFormatInfo(LOGGER, LOG_TASK_ARB, "Temp2 = %d", temp2) //LoggerFormatInfo(LOGGER, LOG_TASK_ARB, "Temp2 = %d", temp2)
} }
*/
if (osMutexAcquire(env->ModelTask.access, 5000) == osOK) { if (osMutexAcquire(env->ModelTask.access, 5000) == osOK) {
/* /*
rtDW.ADC_Key_Data_Model.ST_ReservePower = GpioPinGet( rtDW.ADC_Key_Data_Model.ST_ReservePower = GpioPinGet(
@ -262,19 +262,8 @@ void LoadDataInFromModel(tMma *env) {
env->pwms->pwmRearReservedIo.setActivePercent(env->pwms->pwmRearReservedIo.env, PWM_Get.pwmPercentRearReserved); env->pwms->pwmRearReservedIo.setActivePercent(env->pwms->pwmRearReservedIo.env, PWM_Get.pwmPercentRearReserved);
*/ */
// Ошибки DTC set_Dtc_state_error(&env->Diagnostic);
if (osMutexAcquire(env->Diagnostic.access, 1000) == osOK) {
memcpy(&dtc_state_error, &rtDW.dtc_state_error_model, sizeof(rtDW.dtc_state_error_model));
osMutexRelease(env->Diagnostic.access);
}
memcpy(&rtDW.ADC_Data_Model, &env->ADC_Data_Model_local, sizeof(rtDW.ADC_Data_Model));
if (env->ModelTask.isUpdate) {
env->ModelTask.isUpdate = false;
set_CCU_Errors(&env->canSpamTransmitter, (CCU_Errors_t *) &CCU_Errors_Model); set_CCU_Errors(&env->canSpamTransmitter, (CCU_Errors_t *) &CCU_Errors_Model);
}
osMutexRelease(env->ModelTask.access); osMutexRelease(env->ModelTask.access);
} }
@ -308,7 +297,7 @@ static _Noreturn void Mma_Thread(tMma *env) {
env->pwms->pwmFrontIo.run(env->pwms->pwmFrontIo.env); env->pwms->pwmFrontIo.run(env->pwms->pwmFrontIo.env);
SystemDelayMs(100); SystemDelayMs(100);
LoadDataInFromModel(env); // LoadDataInFromModel(env);
ModelTask_StartThread(&env->ModelTask); ModelTask_StartThread(&env->ModelTask);
@ -370,6 +359,16 @@ static _Noreturn void Mma_Thread(tMma *env) {
env->pwms->pwmRearIo.setActivePercent(env->pwms->pwmRearIo.env, 95); env->pwms->pwmRearIo.setActivePercent(env->pwms->pwmRearIo.env, 95);
env->pwms->pwmFrontReservedIo.setActivePercent(env->pwms->pwmFrontReservedIo.env, 10); env->pwms->pwmFrontReservedIo.setActivePercent(env->pwms->pwmFrontReservedIo.env, 10);
env->pwms->pwmRearReservedIo.setActivePercent(env->pwms->pwmRearReservedIo.env, 20); env->pwms->pwmRearReservedIo.setActivePercent(env->pwms->pwmRearReservedIo.env, 20);
if (osMutexAcquire(env->ModelTask.access, 5000) == osOK) {
set_Dtc_state_error(&env->Diagnostic);
set_CCU_Errors(&env->canSpamTransmitter, (CCU_Errors_t *) &CCU_Errors_Model);
osMutexRelease(env->ModelTask.access);
}
/* /*
SystemDelayMs(10); SystemDelayMs(10);
uint8_t pwm1 = env->pwms->pwmFrontCaptureIO.getPwm(env->pwms->pwmFrontCaptureIO.env); uint8_t pwm1 = env->pwms->pwmFrontCaptureIO.getPwm(env->pwms->pwmFrontCaptureIO.env);
@ -388,7 +387,7 @@ static _Noreturn void Mma_Thread(tMma *env) {
LoggerFormatInfo(LOGGER, LOG_TASK_ARB, "PWM (Rear Reserve) = %d", pwm4) LoggerFormatInfo(LOGGER, LOG_TASK_ARB, "PWM (Rear Reserve) = %d", pwm4)
*/ */
LoadDataInFromModel(env); // LoadDataInFromModel(env);
/* /*
LinActuatorWork(env, &env->linTaskActuator1, 1, LinActuatorWork(env, &env->linTaskActuator1, 1,
&env->actuator_Ch0_Command_Model_local_1, &env->actuator_Ch0_Command_Model_local_1,

View File

@ -83,21 +83,6 @@ typedef struct {
osThreadAttr_t attr; osThreadAttr_t attr;
} thread; } thread;
CmdBusADCData ADC_Data_Model_local;
/*
// Входные данные (локальные) для модели
ActuatorCmdBus actuator_Ch0_Command_Model_local_1;
ActuatorCmdBus actuator_Ch1_Command_Model_local_2;
ActuatorCmdBus actuator_Ch2_Command_Model_local_3;
// Выходные данные (локальные) для модели
ActuatorCmdBusInput actuator_Ch0_Input_Model_local_1;
ActuatorCmdBusInput actuator_Ch1_Input_Model_local_2;
ActuatorCmdBusInput actuator_Ch2_Input_Model_local_3;
*/
bool isActuatorNoGetNextCommand[3];
} tMma; } tMma;

View File

@ -99,9 +99,11 @@ static void Mma_InitSubSystems(tMma *env) {
// Indication_Init(&env->Indication, HVAC_DEV_MODE_STARTUP); // Indication_Init(&env->Indication, HVAC_DEV_MODE_STARTUP);
ModelTask_Init(&env->ModelTask, &env->linTaskActuator1, &env->linTaskActuator2, &env->linTaskActuator3, &env->slog.logger); ModelTask_Init(&env->ModelTask, &env->linTaskActuator1, &env->linTaskActuator2, &env->linTaskActuator3,
&env->slog.logger);
CommandLine_Init(&env->cli, &env->slog, &env->serialPorts->SerialPortLog_IO, &env->serialPorts->cliVirtualPortOut_Io); CommandLine_Init(&env->cli, &env->slog, &env->serialPorts->SerialPortLog_IO,
&env->serialPorts->cliVirtualPortOut_Io);
CommandLine_StartThread(&env->cli); CommandLine_StartThread(&env->cli);
Diagnostic_Init(&env->Diagnostic, &env->slog.logger); Diagnostic_Init(&env->Diagnostic, &env->slog.logger);
@ -175,10 +177,10 @@ static void Mma_InitSubSystems(tMma *env) {
Lin_5_Init(&env->linTaskSensor5, linData5, &env->linPorts->lin5_Io, &env->slog.logger); Lin_5_Init(&env->linTaskSensor5, linData5, &env->linPorts->lin5_Io, &env->slog.logger);
// Lin5_StartThread(&env->linTaskSensor5); // Lin5_StartThread(&env->linTaskSensor5);
Adc_0_Init(&env->adcTask0, &env->adcs->adc_0_IO, env->gpios); Adc_0_Init(&env->adcTask0, env->ModelTask.access, &env->adcs->adc_0_IO, env->gpios);
Adc_0_StartThread(&env->adcTask0); Adc_0_StartThread(&env->adcTask0);
Adc_1_Init(&env->adcTask1, &env->adcs->adc_1_IO, env->gpios); Adc_1_Init(&env->adcTask1, env->ModelTask.access, &env->adcs->adc_1_IO, env->gpios);
Adc_1_StartThread(&env->adcTask1); Adc_1_StartThread(&env->adcTask1);
CanUds_Init( CanUds_Init(