From df9cd9cef9e95e42f21c1efe21391edb39775991 Mon Sep 17 00:00:00 2001 From: cfif Date: Mon, 24 Nov 2025 11:53:41 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LinTasks.h | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 71 insertions(+), 4 deletions(-) diff --git a/LinTasks.h b/LinTasks.h index d041f83..ad502bd 100644 --- a/LinTasks.h +++ b/LinTasks.h @@ -108,11 +108,17 @@ typedef struct __attribute__ ((packed)) { // Using this service the master can switch an actuator to a needed functional mode. // Используя эту услугу, мастер может переключить привод в необходимый режим работы. +typedef enum { + LIN_MODE_NORMAL = 0, + LIN_MODE_SERVICE = 1, + LIN_MODE_STOP = 2 +} eMode_Mod; + typedef struct __attribute__ ((packed)) { uint8_t BUS_ADR; - uint8_t Mode; - uint8_t Data2_Mod; - uint8_t Data3_Mod; + eMode_Mod Mode; + uint8_t Data2_Mod; // Установить в 0xFF + uint8_t Data3_Mod; // Установить в 0xFF } ACT_CFR_MOD; @@ -181,7 +187,7 @@ typedef struct __attribute__ ((packed)) { uint8_t BUS_ADR; uint16_t CPOS_ALL: 15; eEmrf_Slave_STA Emrf_Slave: 1; - uint8_t Mode_Slave: 2; + eMode_Mod Mode_Slave: 2; uint8_t Error1_Supply_Slave: 1; uint8_t Error2_Communication_Slave: 1; uint8_t Error3_Temperature_Slave: 1; @@ -289,6 +295,67 @@ typedef struct __attribute__ ((packed)) { uint8_t Version_CFR; } ACT_RFR_PRG; + +// With this service the master can request a demanded actuator for the actual current position of it. +// The master sends an header which contains the address of the demanded actuator in the identifier. +// The information on the CPos in the response will be coded into 14 bits located in Data 0 and Data 1, with a resolution of 2 steps per LSB. +// In the reponse frame an additional information is included, if stall detection StD has occurred and / or if errors in the actuator have occurred. + +// С помощью этой службы ведущее устройство может запросить требуемый исполнительный механизм для получения информации о его фактическом текущем положении. +// Ведущее устройство отправляет заголовок, содержащий адрес требуемого исполнительного механизма в идентификаторе. +// Информация о CPos в ответе будет закодирована в 14 бит, расположенных в Data 0 и Data 1, с разрешением 2 шага на младший значащий бит. +// В кадр ответа включается дополнительная информация, если произошло обнаружение срыва (StD) и/или произошли ошибки в исполнительном механизме. + +// Actuators address without group definition, located in bit[0:4] of the identifier in the header. Reserved addresses are ISSR1 to ISSR22 and ISSR31 (default address of actuators). +// Remark: Addresses 23 to 30 are accessible by the +// Status Service _STA only. + +// Адрес исполнительных устройств без определения группы, указанный в бите [0:4] идентификатора в заголовке. Зарезервированные адреса: ISSR1–ISSR22 и ISSR31 (адрес исполнительных устройств по умолчанию). +// Примечание: Адреса с 23 по 30 доступны только +// службе состояния _STA. + +// BLOCK_MT: +// The actuator will set this bit, when it has detected an endstop or a block during its movement. +// The STALL flag can only be set if the stall detection is enabled. +// When a stall is detected (STALL flag = 1) the FPOS is set to CPOS. Thus the actuator will not move automatically after erase of the STALL flag from master. The master has to send a _SET command to restart it. +// As long the STALL flag is set all _SET commands are ignored. + +// Привод установит этот бит, если обнаружит концевой упор или блокировку во время движения. +// Флаг STALL может быть установлен только при включенном обнаружении остановки. +// При обнаружении остановки (флаг STALL = 1) FPOS устанавливается в CPOS. Таким образом, привод не будет двигаться автоматически после стирания флага STALL ведущим устройством. Ведущее устройство должно отправить команду _SET для его перезапуска. +// Пока флаг STALL установлен, все команды _SET игнорируются. + +// CPOS_1_LSB_MT, CPOS_1_MSB_MT: +// For CPos, give the relation with accuracy: if the real position is even, CPos = real position / 2; if the real position is odd, CPos = (real position - 1) / 2. +// The default value for CPos after a POR is the middle position of the possible range: CPOS = 0x1FFF (0x3FFF/2). + +// Для CPos укажите отношение с точностью: если вещественная позиция чётная, CPos = вещественная позиция / 2; если вещественная позиция нечётная, CPos = (вещественная позиция - 1) / 2. +// Значение по умолчанию для CPos после POR — это средняя позиция возможного диапазона: CPOS = 0x1FFF (0x3FFF/2). + +// DIAGNOSE_MT: +// The actuator will set this bit, when it has detected any error inside. +// The actuator has to set the _Error with each of the following bits and when they occur in each possible combination: +// •Power On Reset +// •Supply Error (over- / undervoltage) +// •Over Temperature +// •Permanent Electrical Defect +// •Emergency Run occurred (general bus time out) + +// Привод установит этот бит при обнаружении любой внутренней ошибки. +// Привод должен установить _Error для каждого из следующих битов и при их возникновении в каждой возможной комбинации: +// •Сброс при включении питания +// •Ошибка питания (повышение/понижение напряжения) +// •Перегрев +// •Постоянная неисправность электрооборудования +// •Произошёл аварийный запуск (превышение времени ожидания на общей шине) + +typedef struct __attribute__ ((packed)) { + uint8_t BLOCK_MT: 1; + uint8_t CPOS_1_LSB_MT: 7; + uint8_t CPOS_1_MSB_MT: 7; + uint8_t DIAGNOSE_MT: 1; +} ACT_RFR_ISSR; + typedef struct { tLinIO *linIo;