From d54df6f85a4597f34a201abcfcfc15a12437315e Mon Sep 17 00:00:00 2001 From: cfif Date: Wed, 28 Jan 2026 16:13:43 +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 --- CanUds.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/CanUds.c b/CanUds.c index bf40961..530b532 100644 --- a/CanUds.c +++ b/CanUds.c @@ -78,9 +78,9 @@ char *sendLogCanUdsHex(tCanUds *env, uint8_t *data, size_t size) { for (uint8_t i = 0; i < full; ++i) { PrintfDebug(&data[i * 8], 8); - if ((len + strlen(strPrintfDebug_UDS)) < LEN_DEBUG_TP_BUFF) { + if ((len + strlen(strPrintfDebug_UDS)) < LEN_DEBUG_TP_BUFF) { + memcpy(&env->hexString[len], strPrintfDebug_UDS, strlen(strPrintfDebug_UDS)); len += strlen(strPrintfDebug_UDS); - memcpy(env->hexString, strPrintfDebug_UDS, strlen(strPrintfDebug_UDS)); } else { return env->hexString; } @@ -90,9 +90,9 @@ char *sendLogCanUdsHex(tCanUds *env, uint8_t *data, size_t size) { if (tail > 0) { PrintfDebug(&data[full * 8], tail); - if ((len + strlen(strPrintfDebug_UDS)) < LEN_DEBUG_TP_BUFF) { + if ((len + strlen(strPrintfDebug_UDS)) < LEN_DEBUG_TP_BUFF) { + memcpy(&env->hexString[len], strPrintfDebug_UDS, strlen(strPrintfDebug_UDS)); len += strlen(strPrintfDebug_UDS); - memcpy(env->hexString, strPrintfDebug_UDS, strlen(strPrintfDebug_UDS)); } else { return env->hexString; } @@ -147,9 +147,9 @@ static uint16_t TesterPresent_3E(tCanUds *env) { return setResponseError(env, UDS_TesterPresent, UDS_error_incorrectMessageLengthOrInvalidFormat); } - tTesterPresent testerPresent; - testerPresent.ServiceId = UDS_TesterPresent | 0b1000000; - testerPresent.zeroSubFunction = 0; + tTesterPresent *testerPresent = (tTesterPresent *) env->dataResponse; + testerPresent->ServiceId = UDS_TesterPresent | 0b1000000; + testerPresent->zeroSubFunction = 0; return 2; } @@ -726,8 +726,8 @@ const eUds_com uds_com[256] = { {NULL, ""}, {NULL, ""}, {NULL, ""}, - {ReadDataByIdentifier_22, "ReadDataByIdentifier_22"}, {NULL, ""}, + {ReadDataByIdentifier_22, "ReadDataByIdentifier_22"}, {NULL, ""}, {NULL, ""}, {NULL, ""}, @@ -970,7 +970,7 @@ void CanUds(tCanUds *env) { if (response_size) { - sendLogCanUdsHex(env,env->dataResponse, response_size); + sendLogCanUdsHex(env, env->dataResponse, response_size); LoggerFormatInfo(LOGGER, LOG_SIGN, "< %s [%d] %s", uds_com[com].desc, response_size, env->hexString) CanSerialPortFrameTpTransmit(&env->canSerialPortFrameTp, env->dataResponse,