Обновление

This commit is contained in:
cfif 2026-02-16 16:48:48 +03:00
parent 02b6446537
commit ab33312c2b
3 changed files with 53 additions and 24 deletions

View File

@ -48,22 +48,25 @@ void LinActuatorWork(tMma *env, tLinTaskActuator *linTaskActuator,
linTaskActuator->linCommandActuator[i].Coils_Stop_SET = actuator_Command_Model_local->Coils_Stop_SET[i]; linTaskActuator->linCommandActuator[i].Coils_Stop_SET = actuator_Command_Model_local->Coils_Stop_SET[i];
// Заполнение данных ВХОДЫ МОДЕЛИ // Заполнение данных ВХОДЫ МОДЕЛИ
actuator_Output_Model_local->in_CPOS_ALL_Ch0[i] = (int16_t) linTaskActuator->linStateActuator[i].CPOS_ALL; actuator_Output_Model_local->in_CPOS_ALL[i] = (int16_t) linTaskActuator->linStateActuator[i].CPOS_ALL;
actuator_Output_Model_local->in_Act_Emrf_Slave_Ch0[i] = (int8_t) linTaskActuator->linStateActuator[i].Emrf_Slave; actuator_Output_Model_local->in_Act_Emrf_Slave[i] = (int8_t) linTaskActuator->linStateActuator[i].Emrf_Slave;
actuator_Output_Model_local->in_Mode_Slave_Ch0[i] = (int8_t) linTaskActuator->linStateActuator[i].Mode_Slave; actuator_Output_Model_local->in_Mode_Slave[i] = (int8_t) linTaskActuator->linStateActuator[i].Mode_Slave;
actuator_Output_Model_local->in_Act_Err1_Supply_Ch0[i] = (int8_t) linTaskActuator->linStateActuator[i].Error1_Supply_Slave; actuator_Output_Model_local->in_Act_Err1_Supply[i] = (int8_t) linTaskActuator->linStateActuator[i].Error1_Supply_Slave;
actuator_Output_Model_local->in_Act_Err2_Communication_Ch0[i] = (int8_t) linTaskActuator->linStateActuator[i].Error2_Communication_Slave; actuator_Output_Model_local->in_Act_Err2_Communication[i] = (int8_t) linTaskActuator->linStateActuator[i].Error2_Communication_Slave;
actuator_Output_Model_local->in_Act_Err3_Temperature_Ch0[i] = (int8_t) linTaskActuator->linStateActuator[i].Error3_Temperature_Slave; actuator_Output_Model_local->in_Act_Err3_Temperature[i] = (int8_t) linTaskActuator->linStateActuator[i].Error3_Temperature_Slave;
actuator_Output_Model_local->in_Act_Err4_Permanent_Electrical_Ch0[i] = (int8_t) linTaskActuator->linStateActuator[i].Error4_Permanent_Electrical_Slave; actuator_Output_Model_local->in_Act_Err4_Permanent_Electrical[i] = (int8_t) linTaskActuator->linStateActuator[i].Error4_Permanent_Electrical_Slave;
actuator_Output_Model_local->in_Act_Stall_Slave_Ch0[i] = linTaskActuator->linStateActuator[i].Stall_Slave; actuator_Output_Model_local->in_Act_Stall_Slave[i] = linTaskActuator->linStateActuator[i].Stall_Slave;
actuator_Output_Model_local->in_Act_Reset_Ch0[i] = linTaskActuator->linStateActuator[i].Reset_Slave; actuator_Output_Model_local->in_Act_Reset[i] = linTaskActuator->linStateActuator[i].Reset_Slave;
} }
env->isActuatorWorkBusy = setBusy(linTaskActuator); env->isActuatorWorkBusy = setBusy(linTaskActuator);
// Заполнение данных ВХОДЫ МОДЕЛИ // Заполнение данных ВХОДЫ МОДЕЛИ
actuator_Output_Model_local->Error_Connect_Ch0 = linTaskActuator->error_connect; actuator_Output_Model_local->Error_Connect = linTaskActuator->error_connect;
actuator_Output_Model_local->Busy_Ch0 = linTaskActuator->busy; actuator_Output_Model_local->Busy = linTaskActuator->busy;
LoggerFormatInfo(LOGGER, LOG_SIGN, "Busy = %d Error_Connect = %d", actuator_Output_Model_local->Busy, actuator_Output_Model_local->Error_Connect)
} }
osMutexRelease(linTaskActuator->access); osMutexRelease(linTaskActuator->access);
@ -78,7 +81,7 @@ void LinActuatorWork(tMma *env, tLinTaskActuator *linTaskActuator,
LoggerInfoStatic(LOGGER, LOG_SIGN, "DETECT COMMAND") LoggerInfoStatic(LOGGER, LOG_SIGN, "DETECT COMMAND")
#endif #endif
// //
actuator_Output_Model_local->Busy_Ch0 = 1; actuator_Output_Model_local->Busy = 1;
} }
// Если прията команда и актуатор не занят // Если прията команда и актуатор не занят
@ -93,7 +96,7 @@ void LinActuatorWork(tMma *env, tLinTaskActuator *linTaskActuator,
memcpy(actuator_Command_Model_local, actuator_Command_Model_trigger_local, sizeof(ActuatorCmdBus)); memcpy(actuator_Command_Model_local, actuator_Command_Model_trigger_local, sizeof(ActuatorCmdBus));
// Сброс STALL в состоянии актуатор и локальном состоянии // Сброс STALL в состоянии актуатор и локальном состоянии
resetStall(linTaskActuator, (uint8_t *) actuator_Output_Model_local->in_Act_Stall_Slave_Ch0, LOG_SIGN); resetStall(linTaskActuator, (uint8_t *) actuator_Output_Model_local->in_Act_Stall_Slave, LOG_SIGN);
// конец --- ВЫХОД МОДЕЛИ ---------- // конец --- ВЫХОД МОДЕЛИ ----------

View File

@ -222,11 +222,26 @@ void LoadDataInFromModel(tMma *env) {
if (osMutexAcquire(env->ModelTask.access, 5000) == osOK) { if (osMutexAcquire(env->ModelTask.access, 5000) == osOK) {
GpioPinGet(&env->gpios->power.BTS4175SGAXUMA1_ReservePowerOutput.ST_ReservePower); rtDW.ADC_Key_Data_Model.ST_ReservePower = GpioPinGet(&env->gpios->power.BTS4175SGAXUMA1_ReservePowerOutput.ST_ReservePower);
GpioPinGet(&env->gpios->power.BTS4175SGAXUMA1_ShutOFFValveBatteryChiller.ST_BATTChiller); rtDW.ADC_Key_Data_Model.ST_BATTChiller = GpioPinGet(&env->gpios->power.BTS4175SGAXUMA1_ShutOFFValveBatteryChiller.ST_BATTChiller);
GpioPinGet(&env->gpios->EmergencyAirCleanSwitch); rtDW.ADC_Key_Data_Model.EmergencyAirCleanSwitch = GpioPinGet(&env->gpios->EmergencyAirCleanSwitch);
GpioPinGet(&env->gpios->FireExtinguishSwitch); rtDW.ADC_Key_Data_Model.FireExtinguishSwitch = GpioPinGet(&env->gpios->FireExtinguishSwitch);
GpioPinGet(&env->gpios->Ign_Wakeup); rtDW.ADC_Key_Data_Model.Ign_Wakeup = GpioPinGet(&env->gpios->Ign_Wakeup);
PWM_Get.pwmPercentFront = env->pwms->pwmFrontCaptureIO.getPwm(env->pwms->pwmFrontCaptureIO.env);
PWM_Get.pwmPercentRear = env->pwms->pwmRearCaptureIO.getPwm(env->pwms->pwmRearCaptureIO.env);
PWM_Get.pwmPercentFrontReserved = env->pwms->pwmFrontCaptureIO.getPwm(env->pwms->pwmFrontReservedCaptureIO.env);
PWM_Get.pwmPercentRearReserved = env->pwms->pwmRearCaptureIO.getPwm(env->pwms->pwmRearReservedCaptureIO.env);
// LoggerFormatInfo(LOGGER, LOG_TASK_ARB, "PWM (Front) = %d", PWM_Get.pwmPercentFront )
// LoggerFormatInfo(LOGGER, LOG_TASK_ARB, "PWM (Rear) = %d", PWM_Get.pwmPercentRear)
// LoggerFormatInfo(LOGGER, LOG_TASK_ARB, "PWM (Front Reserve) = %d", PWM_Get.pwmPercentFrontReserved)
// LoggerFormatInfo(LOGGER, LOG_TASK_ARB, "PWM (Rear Reserve) = %d", PWM_Get.pwmPercentRearReserved)
env->pwms->pwmFrontIo.setActivePercent(env->pwms->pwmFrontIo.env, rtDW.PWM_Set_Model.pwmPercentFront);
env->pwms->pwmRearIo.setActivePercent(env->pwms->pwmRearIo.env, rtDW.PWM_Set_Model.pwmPercentRear);
env->pwms->pwmFrontReservedIo.setActivePercent(env->pwms->pwmFrontReservedIo.env, rtDW.PWM_Set_Model.pwmPercentFrontReserved);
env->pwms->pwmRearReservedIo.setActivePercent(env->pwms->pwmRearReservedIo.env, rtDW.PWM_Set_Model.pwmPercentRearReserved);
rtDW.t_now = GetSystemTick(); rtDW.t_now = GetSystemTick();
memcpy(&rtDW.ADC_Data_Model, &env->ADC_Data_Model_local, sizeof(rtDW.ADC_Data_Model)); memcpy(&rtDW.ADC_Data_Model, &env->ADC_Data_Model_local, sizeof(rtDW.ADC_Data_Model));
@ -259,11 +274,13 @@ static _Noreturn void Mma_Thread(tMma *env) {
LoggerInfoStatic(LOGGER, LOG_TASK_ARB, "Wake up from standby") LoggerInfoStatic(LOGGER, LOG_TASK_ARB, "Wake up from standby")
} }
env->pwms->pwmFrontIo.run(env->pwms->pwmFrontIo.env);
SystemDelayMs(1000); SystemDelayMs(1000);
LoadDataInFromModel(env); LoadDataInFromModel(env);
// ModelTask_StartThread(&env->ModelTask); ModelTask_StartThread(&env->ModelTask);
/* /*
@ -277,10 +294,6 @@ static _Noreturn void Mma_Thread(tMma *env) {
*/ */
env->pwms->pwmFrontIo.run(env->pwms->pwmFrontIo.env);
// env->pwms->pwmRearIo.run(env->pwms->pwmRearIo.env);
for (;;) { for (;;) {
/* /*
@ -307,12 +320,25 @@ static _Noreturn void Mma_Thread(tMma *env) {
*/ */
LoadDataInFromModel(env); LoadDataInFromModel(env);
LinActuatorWork(env, &env->linTaskActuator1, LinActuatorWork(env, &env->linTaskActuator1,
&env->actuator_Ch0_Command_Model_local_1, &env->actuator_Ch0_Command_Model_local_1,
&env->ModelTask.triggerActuatorCmdBus_1, &env->ModelTask.triggerActuatorCmdBus_1,
&env->actuator_Ch0_Input_Model_local_1, &env->actuator_Ch0_Input_Model_local_1,
&rtDW.Actuator_Ch0_Status_Model, &env->ModelTask.triggerCommand1, "Ln1 "); &rtDW.Actuator_Ch0_Status_Model, &env->ModelTask.triggerCommand1, "Ln1 ");
LinActuatorWork(env, &env->linTaskActuator2,
&env->actuator_Ch1_Command_Model_local_2,
&env->ModelTask.triggerActuatorCmdBus_2,
&env->actuator_Ch1_Input_Model_local_2,
&rtDW.Actuator_Ch1_Status_Model, &env->ModelTask.triggerCommand2, "Ln2 ");
LinActuatorWork(env, &env->linTaskActuator3,
&env->actuator_Ch2_Command_Model_local_3,
&env->ModelTask.triggerActuatorCmdBus_3,
&env->actuator_Ch2_Input_Model_local_3,
&rtDW.Actuator_Ch2_Status_Model, &env->ModelTask.triggerCommand3, "Ln3 ");
SystemDelayMs(50); SystemDelayMs(50);
GpioPinToggle(&env->gpios->led.LED_G); GpioPinToggle(&env->gpios->led.LED_G);

View File

@ -142,7 +142,7 @@ static void Mma_InitSubSystems(tMma *env) {
Lin2_StartThread(&env->linTaskActuator2); Lin2_StartThread(&env->linTaskActuator2);
tLinData *linData3 = Lin3_Init(GetLin123CallbackHandler); tLinData *linData3 = Lin3_Init(GetLin123CallbackHandler);
Lin_3_Init(&env->linTaskActuator3, linData3, &env->linPorts->lin3_Io, 9, &env->slog.logger); Lin_3_Init(&env->linTaskActuator3, linData3, &env->linPorts->lin3_Io, 8, &env->slog.logger);
Lin3_StartThread(&env->linTaskActuator3); Lin3_StartThread(&env->linTaskActuator3);