Обновление

This commit is contained in:
cfif 2026-01-21 15:00:24 +03:00
parent d1893882cb
commit a887adaf07
2 changed files with 48 additions and 0 deletions

View File

@ -67,8 +67,12 @@ static uint8_t DiagnosticSessionControl_10(tCanUds *env) {
diagnosticSessionsType->ServiceId = UDS_DiagnosticSessionControl | 0b1000000; diagnosticSessionsType->ServiceId = UDS_DiagnosticSessionControl | 0b1000000;
diagnosticSessionsType->diagnosticSessionType = env->data.data[1]; diagnosticSessionsType->diagnosticSessionType = env->data.data[1];
// Нормальный таймаут. Важно: Клиент может отправлять TesterPresent для поддержания сессии до истечения этого таймаута
diagnosticSessionsType->sessionParameterRecord[0] = 0; diagnosticSessionsType->sessionParameterRecord[0] = 0;
diagnosticSessionsType->sessionParameterRecord[1] = 0x32; diagnosticSessionsType->sessionParameterRecord[1] = 0x32;
// Расширенный таймаут. Например, ECU может обрабатывать сложный запрос 2 секунды и отправлять NRC 0x78, затем ответ
diagnosticSessionsType->sessionParameterRecord[2] = 0x01; diagnosticSessionsType->sessionParameterRecord[2] = 0x01;
diagnosticSessionsType->sessionParameterRecord[3] = 0xF4; diagnosticSessionsType->sessionParameterRecord[3] = 0xF4;
@ -140,6 +144,32 @@ static uint8_t WriteDataByIdentifier_2E(tCanUds *env) {
// конец --------------------------- Запись --------------------------------------------------------- // конец --------------------------- Запись ---------------------------------------------------------
// конец --------------------------- Запись --------------------------------------------------------- // конец --------------------------- Запись ---------------------------------------------------------
// начало --------------------------- Управление ---------------------------------------------------------
// начало --------------------------- Управление ---------------------------------------------------------
// начало --------------------------- Управление ---------------------------------------------------------
static uint8_t IoDataByIdentifier_2F(tCanUds *env) {
if ((env->data.len < 4) ||
(env->data.data[3] != UDS_io_returnControlToECU) ||
(env->data.data[3] != UDS_io_resetToDefault) ||
(env->data.data[3] != UDS_io_shortTermAdjustment)) {
return setResponseError(env, UDS_InputOutputControlByIdentifier,
UDS_error_incorrectMessageLengthOrInvalidFormat);
}
uint8_t dataIdentifier_hi = env->data.data[1];
uint8_t dataIdentifier_lo = env->data.data[2];
return setResponseError(env, UDS_InputOutputControlByIdentifier, UDS_error_requestOutOfRange);
}
// конец --------------------------- Управление ---------------------------------------------------------
// конец --------------------------- Управление ---------------------------------------------------------
// конец --------------------------- Управление ---------------------------------------------------------
const eUds_com uds_com[256] = { const eUds_com uds_com[256] = {
{NULL, ""}, {NULL, ""},
{NULL, ""}, {NULL, ""},

View File

@ -10,6 +10,18 @@
#define CAN_US_QUEUE_SIZE 3 #define CAN_US_QUEUE_SIZE 3
// Время (логарифмическая шкала)
// │
// ├── StMin (0.1-127 мс) ← Между КАДРАМИ
// │ │
// ├── N_As, N_Bs (до 1000 мс) ← Транспортные таймауты
// │ │
// ├── P2Server (до 50 мс) ← Между СООБЩЕНИЯМИ (UDS)
// │ │
// ├── P2*Server (до 5000 мс) ← Ожидание при ResponsePending
// │ │
// └── S3_Server (до 5000 мс) ← ТАЙМЕР ВСЕЙ СЕССИИ
typedef enum { typedef enum {
UDS_DiagnosticSessionControl = 0x10, UDS_DiagnosticSessionControl = 0x10,
UDS_ReadDTCInformation = 0x19, UDS_ReadDTCInformation = 0x19,
@ -19,6 +31,7 @@ typedef enum {
UDS_WriteDataByIdentifier = 0x2E, UDS_WriteDataByIdentifier = 0x2E,
UDS_RoutineControl = 0x31, UDS_RoutineControl = 0x31,
UDS_ECUResetService = 0x11, UDS_ECUResetService = 0x11,
UDS_InputOutputControlByIdentifier = 0x2F,
UDS_SecurityAccess = 0x27 UDS_SecurityAccess = 0x27
} eUdsServices; } eUdsServices;
@ -36,6 +49,11 @@ typedef enum {
UDS_session_extendedDiagnosticSession= 0x3 UDS_session_extendedDiagnosticSession= 0x3
} eUdsSession; } eUdsSession;
typedef enum {
UDS_io_returnControlToECU = 0x0,
UDS_io_resetToDefault= 0x1,
UDS_io_shortTermAdjustment= 0x3
} eUdsIO;
typedef struct { typedef struct {