Обновление

This commit is contained in:
cfif 2026-04-03 19:02:24 +03:00
parent 31061f60f1
commit 99a70518a7
2 changed files with 52 additions and 31 deletions

View File

@ -221,7 +221,7 @@ void LoadDataInFromModel(tMma *env) {
}
if (osMutexAcquire(env->ModelTask.access, 5000) == osOK) {
/*
rtDW.ADC_Key_Data_Model.ST_ReservePower = GpioPinGet(
&env->gpios->power.BTS4175SGAXUMA1_ReservePowerOutput.ST_ReservePower);
rtDW.ADC_Key_Data_Model.ST_BATTChiller = GpioPinGet(
@ -229,6 +229,9 @@ void LoadDataInFromModel(tMma *env) {
rtDW.ADC_Key_Data_Model.EmergencyAirCleanSwitch = GpioPinGet(&env->gpios->EmergencyAirCleanSwitch);
rtDW.ADC_Key_Data_Model.FireExtinguishSwitch = GpioPinGet(&env->gpios->FireExtinguishSwitch);
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);
@ -247,7 +250,7 @@ void LoadDataInFromModel(tMma *env) {
*/
/*
rtDW.PWM_Set_Model.pwmPercentFront = env->pwms->pwmFrontCaptureIO.getPwm(env->pwms->pwmFrontCaptureIO.env);
rtDW.PWM_Set_Model.pwmPercentRear = env->pwms->pwmRearCaptureIO.getPwm(env->pwms->pwmRearCaptureIO.env);
rtDW.PWM_Set_Model.pwmPercentFrontReserved = env->pwms->pwmFrontCaptureIO.getPwm(
@ -261,7 +264,7 @@ void LoadDataInFromModel(tMma *env) {
env->pwms->pwmFrontReservedIo.setActivePercent(env->pwms->pwmFrontReservedIo.env,
PWM_Get.pwmPercentFrontReserved);
env->pwms->pwmRearReservedIo.setActivePercent(env->pwms->pwmRearReservedIo.env, PWM_Get.pwmPercentRearReserved);
*/
rtDW.t_now = GetSystemTick();
memcpy(&rtDW.ADC_Data_Model, &env->ADC_Data_Model_local, sizeof(rtDW.ADC_Data_Model));
@ -285,8 +288,8 @@ static _Noreturn void Mma_Thread(tMma *env) {
Mma_InitStage(env);
// Инициализируем обе таблицы одновременно с разными значениями R1
init_both_tables(3000.0f, // R1 для KST45
3000.0f, // R1 для INCAR
init_both_tables(20000.0f, // R1 для KST45
20000.0f, // R1 для INCAR
ALG_STEINHART);
@ -305,7 +308,7 @@ static _Noreturn void Mma_Thread(tMma *env) {
LoadDataInFromModel(env);
// ModelTask_StartThread(&env->ModelTask);
ModelTask_StartThread(&env->ModelTask);
/*
@ -321,7 +324,8 @@ static _Noreturn void Mma_Thread(tMma *env) {
for (;;) {
if (osMutexAcquire(env->adcTask0.access, 1000) == osOK) {
// if (osMutexAcquire(env->adcTask0.access, 1000) == osOK) {
/*
uint16_t adc_value = env->adcTask0.ADC0_Data.Sensor_Front_Duct1;
int16_t temp_incar = get_temperature_log_fast_for_table(adc_value, TABLE_KST45);
float resistance = get_resistance_log_fast_for_table(temp_incar, TABLE_KST45);
@ -330,8 +334,25 @@ static _Noreturn void Mma_Thread(tMma *env) {
LoggerFormatInfo(LOGGER, LOG_TASK_ARB, "Sensor_Front_Duct1: ADC = %u, Temp = %.2f °C, Resistance = %.2f Ohm U = %.2f",
adc_value, temp_incar / 10.0f, resistance, U)
*/
/*
uint16_t adc_value = env->adcTask0.ADC0_Data.Sensor_Front_Duct2;
int16_t temp_incar = get_temperature_log_fast_for_table(adc_value, TABLE_KST45);
float resistance = get_resistance_log_fast_for_table(temp_incar, TABLE_KST45);
float U = (float) adc_value * 5.0f / 4095.0f;
LoggerFormatInfo(LOGGER, LOG_TASK_ARB, "Sensor_Front_Duct1: ADC = %u, Temp = %.2f °C, Resistance = %.2f Ohm U = %.2f",
adc_value, temp_incar / 10.0f, resistance, U)
*/
/*
uint16_t adc_value = env->adcTask0.ADC0_Data.Sensor_Ambient_Temp;
int16_t Sensor_Ambient_Temp = get_temperature_log_fast_for_table(adc_value, TABLE_KST45);
float resistance = get_resistance_log_fast_for_table(Sensor_Ambient_Temp, TABLE_KST45);
float U = (float) adc_value * 5.0f / 4095.0f;
LoggerFormatInfo(LOGGER, LOG_TASK_ARB, "Sensor_Ambient_Temp: ADC = %u, Temp = %.2f °C, Resistance = %.2f Ohm U = %.2f",
adc_value, Sensor_Ambient_Temp / 10.0f, resistance, U)
*/
//uint16_t adc_value = env->adcTask0.ADC0_Data.Sensor_Incar_Temp_FL;
//int16_t temp_incar = get_temperature_log_fast_for_table(adc_value, TABLE_INCAR);
//LoggerFormatInfo(LOGGER, LOG_TASK_ARB, "Sensor_Incar_Temp_FL: ADC = %u, Temp = %.2f °C", adc_value,
@ -339,14 +360,14 @@ static _Noreturn void Mma_Thread(tMma *env) {
osMutexRelease(env->adcTask0.access);
}
// osMutexRelease(env->adcTask0.access);
// }
/*
env->pwms->pwmFrontIo.setActivePercent(env->pwms->pwmFrontIo.env, 40);
env->pwms->pwmRearIo.setActivePercent(env->pwms->pwmRearIo.env, 50);
env->pwms->pwmFrontReservedIo.setActivePercent(env->pwms->pwmFrontReservedIo.env, 60);
env->pwms->pwmRearReservedIo.setActivePercent(env->pwms->pwmRearReservedIo.env, 70);
env->pwms->pwmFrontIo.setActivePercent(env->pwms->pwmFrontIo.env, 10);
env->pwms->pwmRearIo.setActivePercent(env->pwms->pwmRearIo.env, 11);
env->pwms->pwmFrontReservedIo.setActivePercent(env->pwms->pwmFrontReservedIo.env, 12);
env->pwms->pwmRearReservedIo.setActivePercent(env->pwms->pwmRearReservedIo.env, 13);
SystemDelayMs(10);
uint8_t pwm1 = env->pwms->pwmFrontCaptureIO.getPwm(env->pwms->pwmFrontCaptureIO.env);
@ -364,7 +385,7 @@ static _Noreturn void Mma_Thread(tMma *env) {
uint8_t pwm4 = env->pwms->pwmRearCaptureIO.getPwm(env->pwms->pwmRearReservedCaptureIO.env);
LoggerFormatInfo(LOGGER, LOG_TASK_ARB, "PWM (Rear Reserve) = %d", pwm4)
*/
/*
LoadDataInFromModel(env);
LinActuatorWork(env, &env->linTaskActuator1,
@ -372,24 +393,24 @@ static _Noreturn void Mma_Thread(tMma *env) {
&env->ModelTask.triggerActuatorCmdBus_1,
&env->actuator_Ch0_Input_Model_local_1,
&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(250);
SystemDelayMs(200);
GpioPinToggle(&env->gpios->led.LED_G);
SystemDelayMs(200);
/*
if (RGM_SRS_WAKEUP_MASK == (RGM->SRS & RGM_SRS_WAKEUP_MASK)) {
} else {
@ -414,7 +435,7 @@ static _Noreturn void Mma_Thread(tMma *env) {
/*
uint8_t local[9];
tLinTaskActuator *linTaskActuator = &env->linTaskActuator1;
tLinTaskActuator *linTaskActuator = &env->linTaskActuator3;
if (osMutexAcquire(linTaskActuator->access, 5000) == osOK) {
@ -429,7 +450,7 @@ static _Noreturn void Mma_Thread(tMma *env) {
switch (step) {
case 0: {
resetStall(linTaskActuator, local);
resetStall(linTaskActuator, local, LOG_TASK_ARB);
linTaskActuator->linCommandActuator[0].COM = LIN_ACT_CFR_MOD;
linTaskActuator->linCommandActuator[0].BUS_ADR = 0;
@ -440,7 +461,7 @@ static _Noreturn void Mma_Thread(tMma *env) {
}
case 1: {
resetStall(linTaskActuator, local);
resetStall(linTaskActuator, local,LOG_TASK_ARB);
linTaskActuator->linCommandActuator[0].COM = LIN_ACT_CFR_INI;
linTaskActuator->linCommandActuator[0].BUS_ADR = 0;
@ -450,7 +471,7 @@ static _Noreturn void Mma_Thread(tMma *env) {
break;
}
case 2: {
resetStall(linTaskActuator, local);
resetStall(linTaskActuator, local,LOG_TASK_ARB);
linTaskActuator->linCommandActuator[0].COM = LIN_ACT_CFR_MOD;
linTaskActuator->linCommandActuator[0].BUS_ADR = 0;
@ -461,7 +482,7 @@ static _Noreturn void Mma_Thread(tMma *env) {
}
case 3: {
resetStall(linTaskActuator, local);
resetStall(linTaskActuator, local,LOG_TASK_ARB);
linTaskActuator->linCommandActuator[0].COM = LIN_ACT_CFR_SET;
linTaskActuator->linCommandActuator[0].BUS_ADR = 0;
@ -503,7 +524,7 @@ static _Noreturn void Mma_Thread(tMma *env) {
case 5: {
resetStall(linTaskActuator, local);
resetStall(linTaskActuator, local,LOG_TASK_ARB);
linTaskActuator->linCommandActuator[0].COM = LIN_ACT_CFR_MOD;
linTaskActuator->linCommandActuator[0].BUS_ADR = 0;
@ -516,7 +537,7 @@ static _Noreturn void Mma_Thread(tMma *env) {
case 6: {
resetStall(linTaskActuator, local);
resetStall(linTaskActuator, local,LOG_TASK_ARB);
linTaskActuator->linCommandActuator[0].COM = LIN_ACT_CFR_INI;
linTaskActuator->linCommandActuator[0].BUS_ADR = 0;
@ -527,7 +548,7 @@ static _Noreturn void Mma_Thread(tMma *env) {
}
case 7: {
resetStall(linTaskActuator, local);
resetStall(linTaskActuator, local,LOG_TASK_ARB);
linTaskActuator->linCommandActuator[0].COM = LIN_ACT_CFR_MOD;
linTaskActuator->linCommandActuator[0].BUS_ADR = 0;
@ -539,7 +560,7 @@ static _Noreturn void Mma_Thread(tMma *env) {
case 8: {
resetStall(linTaskActuator, local);
resetStall(linTaskActuator, local,LOG_TASK_ARB);
linTaskActuator->linCommandActuator[0].COM = LIN_ACT_CFR_SET;
linTaskActuator->linCommandActuator[0].BUS_ADR = 0;
@ -636,7 +657,7 @@ static _Noreturn void Mma_Thread(tMma *env) {
}
*/
// SystemDelayMs(10);
}
}

View File

@ -98,7 +98,7 @@ static void Mma_InitSubSystems(tMma *env) {
// Indication_Init(&env->Indication, HVAC_DEV_MODE_STARTUP);
CommandLine_Init(&env->cli, &env->serialPorts->SerialPortLog_IO, &env->serialPorts->cliVirtualPortOut_Io);
CommandLine_StartThread(&env->cli);
// CommandLine_StartThread(&env->cli);
Diagnostic_Init(&env->Diagnostic, &env->slog.logger);
@ -145,7 +145,7 @@ static void Mma_InitSubSystems(tMma *env) {
tLinData *linData5 = Lin5_Init(GetLin123CallbackHandler);
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_StartThread(&env->adcTask0);