Обновление
This commit is contained in:
parent
a692086561
commit
26f332f56d
15
Model_Task.c
15
Model_Task.c
|
|
@ -6,12 +6,16 @@
|
|||
#include <CmsisRtosThreadUtils.h>
|
||||
#include "Model_actuator.h"
|
||||
|
||||
#define LOG_SIGN "Model"
|
||||
#define LOGGER env->logger
|
||||
|
||||
void ModelTask_Init(
|
||||
tModelTask *env
|
||||
tModelTask *env,
|
||||
tLoggerInterface *logger
|
||||
) {
|
||||
Model_actuator_initialize();
|
||||
env->access = osMutexNew(NULL);
|
||||
|
||||
env->logger = logger;
|
||||
InitThreadAtrStatic(&env->thread.attr, "ModelTask", env->thread.controlBlock, env->thread.stack, osPriorityNormal);
|
||||
env->thread.id = 0;
|
||||
}
|
||||
|
|
@ -21,6 +25,8 @@ static bool setActuatorBusy(tModelTask *env) {
|
|||
for (uint8_t i = 0; i < 9; ++i) {
|
||||
if (rtY.Out1.COM[i] != 0) {
|
||||
|
||||
LoggerInfoStatic(LOGGER, LOG_SIGN, "DETECT COMMAND")
|
||||
|
||||
env->triggerCommand = true;
|
||||
|
||||
for (uint8_t j = 0; j < 9; ++j) {
|
||||
|
|
@ -38,11 +44,14 @@ static bool setActuatorBusy(tModelTask *env) {
|
|||
static _Noreturn void ModelTask_Thread(tModelTask *env) {
|
||||
for (;;) {
|
||||
if (osMutexAcquire(env->access, 1000) == osOK) {
|
||||
|
||||
LoggerFormatInfo(LOGGER, LOG_SIGN, "in_Busy_Ch0 = %d in_Act_Stall_Slave_Ch0 = %d", rtU.in_Busy_Ch0, rtU.in_Act_Stall_Slave_Ch0[7])
|
||||
|
||||
Model_actuator_step();
|
||||
setActuatorBusy(env);
|
||||
osMutexRelease(env->access);
|
||||
}
|
||||
SystemDelayMs(100);
|
||||
SystemDelayMs(250);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,11 +7,14 @@
|
|||
|
||||
#include <cmsis_os.h>
|
||||
#include "stdbool.h"
|
||||
#include "LoggerInterface.h"
|
||||
|
||||
typedef struct {
|
||||
|
||||
osMutexId_t access;
|
||||
|
||||
tLoggerInterface *logger;
|
||||
|
||||
bool triggerCommand;
|
||||
uint8_t numCommand[9];
|
||||
|
||||
|
|
@ -23,8 +26,10 @@ typedef struct {
|
|||
} thread;
|
||||
} tModelTask;
|
||||
|
||||
void ModelTask_Init(tModelTask *env);
|
||||
void ModelTask_Init(tModelTask *env, tLoggerInterface *logger);
|
||||
|
||||
void ModelTask_StartThread(tModelTask *env);
|
||||
|
||||
void ModelTask_StopThread(tModelTask *env);
|
||||
|
||||
#endif //HVAC_M7_MODEL_TASK_H
|
||||
|
|
|
|||
929
Model_actuator.c
929
Model_actuator.c
File diff suppressed because it is too large
Load Diff
|
|
@ -3,9 +3,9 @@
|
|||
*
|
||||
* Code generated for Simulink model 'Model_actuator'.
|
||||
*
|
||||
* Model version : 1.542
|
||||
* Model version : 1.550
|
||||
* Simulink Coder version : 24.1 (R2024a) 19-Nov-2023
|
||||
* C/C++ source code generated on : Fri Dec 19 17:44:01 2025
|
||||
* C/C++ source code generated on : Tue Dec 23 15:12:50 2025
|
||||
*
|
||||
* Target selection: ert.tlc
|
||||
* Embedded hardware selection: ARM Compatible->ARM Cortex-M
|
||||
|
|
@ -45,8 +45,8 @@ typedef struct {
|
|||
|
||||
/* Block states (default storage) for system '<Root>' */
|
||||
typedef struct {
|
||||
uint16_t Min_position_Ch0[9]; /* '<Root>/Data Store Memory12' */
|
||||
uint16_t Max_position_Ch0[9]; /* '<Root>/Data Store Memory13' */
|
||||
int16_t Min_position_Ch0[9]; /* '<Root>/Data Store Memory12' */
|
||||
int16_t Max_position_Ch0[9]; /* '<Root>/Data Store Memory13' */
|
||||
uint16_t pos_loc[9]; /* '<Root>/Data Store Memory4' */
|
||||
int8_t UnitDelay_DSTATE; /* '<Root>/Unit Delay' */
|
||||
int8_t stepSig; /* '<Root>/Data Store Memory' */
|
||||
|
|
@ -62,18 +62,18 @@ typedef struct {
|
|||
|
||||
/* External inputs (root inport signals with default storage) */
|
||||
typedef struct {
|
||||
uint16_t in_CPOS_ALL_Ch0[9]; /* '<Root>/in_CPOS_ALL_Ch0' */
|
||||
uint8_t in_Act_Emrf_Slave_Ch0[9]; /* '<Root>/in_Act_Emrf_Slave_Ch0' */
|
||||
uint8_t in_Mode_Slave_Ch0[9]; /* '<Root>/in_Mode_Slave_Ch0' */
|
||||
uint8_t in_Act_Err1_Supply_Ch0[9]; /* '<Root>/in_Act_Err1_Supply_Ch0' */
|
||||
uint8_t in_Act_Err2_Communication_Ch0[9];
|
||||
int16_t in_CPOS_ALL_Ch0[9]; /* '<Root>/in_CPOS_ALL_Ch0' */
|
||||
int8_t in_Act_Emrf_Slave_Ch0[9]; /* '<Root>/in_Act_Emrf_Slave_Ch0' */
|
||||
int8_t in_Mode_Slave_Ch0[9]; /* '<Root>/in_Mode_Slave_Ch0' */
|
||||
int8_t in_Act_Err1_Supply_Ch0[9]; /* '<Root>/in_Act_Err1_Supply_Ch0' */
|
||||
int8_t in_Act_Err2_Communication_Ch0[9];
|
||||
/* '<Root>/in_Act_Err2_Communication_Ch0' */
|
||||
uint8_t in_Act_Err3_Temperature_Ch0[9];
|
||||
int8_t in_Act_Err3_Temperature_Ch0[9];
|
||||
/* '<Root>/in_Act_Err3_Temperature_Ch0' */
|
||||
uint8_t in_Act_Err4_Permanent_Electrical_Ch0[9];
|
||||
int8_t in_Act_Err4_Permanent_Electrical_Ch0[9];
|
||||
/* '<Root>/in_Act_Err4_Permanent_Electrical_Ch0' */
|
||||
uint8_t in_Act_Stall_Slave_Ch0[9]; /* '<Root>/in_Act_Stall_Slave_Ch0' */
|
||||
uint8_t in_Act_Reset_Ch0[9]; /* '<Root>/in_Act_Reset_Ch0' */
|
||||
int8_t in_Act_Stall_Slave_Ch0[9]; /* '<Root>/in_Act_Stall_Slave_Ch0' */
|
||||
int8_t in_Act_Reset_Ch0[9]; /* '<Root>/in_Act_Reset_Ch0' */
|
||||
uint8_t in_Busy_Ch0; /* '<Root>/in_Busy_Ch0' */
|
||||
uint8_t in_Error_Connect_Ch0; /* '<Root>/in_Error_Connect_Ch0' */
|
||||
} ExtU;
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
*
|
||||
* Code generated for Simulink model 'Model_actuator'.
|
||||
*
|
||||
* Model version : 1.542
|
||||
* Model version : 1.550
|
||||
* Simulink Coder version : 24.1 (R2024a) 19-Nov-2023
|
||||
* C/C++ source code generated on : Fri Dec 19 17:44:01 2025
|
||||
* C/C++ source code generated on : Tue Dec 23 15:12:50 2025
|
||||
*
|
||||
* Target selection: ert.tlc
|
||||
* Embedded hardware selection: ARM Compatible->ARM Cortex-M
|
||||
|
|
@ -24,10 +24,6 @@
|
|||
|
||||
extern void IfActionSubsystem3(int8_t rtu_stepIn, int8_t *rty_step, uint8_t
|
||||
rtd_com_loc[9]);
|
||||
extern void IfActionSubsystem2(int8_t rtu_stepIn, int8_t *rty_step, uint8_t
|
||||
rtd_autos_set_loc[9], uint8_t rtd_coils_stop_set_loc[9], uint8_t rtd_com_loc[9],
|
||||
uint8_t rtd_lnoise_set_loc[9], uint8_t rtd_speed_set_loc[9], uint8_t
|
||||
rtd_stall_set_loc[9]);
|
||||
|
||||
#endif /* Model_actuator_private_h_ */
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
*
|
||||
* Code generated for Simulink model 'Model_actuator'.
|
||||
*
|
||||
* Model version : 1.542
|
||||
* Model version : 1.550
|
||||
* Simulink Coder version : 24.1 (R2024a) 19-Nov-2023
|
||||
* C/C++ source code generated on : Fri Dec 19 17:44:01 2025
|
||||
* C/C++ source code generated on : Tue Dec 23 15:12:50 2025
|
||||
*
|
||||
* Target selection: ert.tlc
|
||||
* Embedded hardware selection: ARM Compatible->ARM Cortex-M
|
||||
|
|
|
|||
Loading…
Reference in New Issue