From d37f99c57b0ffa5744e8d7ecb1c43457ea2850d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D1=8F=D1=87=D0=B5=D1=81=D0=BB=D0=B0=D0=B2=20=D0=A8?= =?UTF-8?q?=D1=82=D0=B5=D0=B9=D0=B1=D0=B5=D0=B7=D0=B0=D0=BD=D0=B4=D1=82?= Date: Tue, 1 Sep 2026 13:35:02 +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=20define?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Core/Inc/protocan.h | 14 +++++++++++++- Core/Src/protocan.c | 8 ++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Core/Inc/protocan.h b/Core/Inc/protocan.h index 99fa270..466f33c 100644 --- a/Core/Inc/protocan.h +++ b/Core/Inc/protocan.h @@ -8,9 +8,21 @@ #define ONLINE 1; #define OFFLINE 0; -#define ID_MAIN_DEVICE 0x000 +#ifndef YESNO +#define YESNO +#define YES 1 +#define NO 0 +#endif + +#define ISPM NO + +#ifndef CURRENT_TYPE_DEVICE #define CURRENT_TYPE_DEVICE 0b001 +#endif + +#ifndef CURRENT_ID_DEVICE #define CURRENT_ID_DEVICE 0b0010 +#endif #define PROTOCAN_RX_BUFFER_SIZE 128 diff --git a/Core/Src/protocan.c b/Core/Src/protocan.c index b5dcb5a..8691f2e 100644 --- a/Core/Src/protocan.c +++ b/Core/Src/protocan.c @@ -1414,9 +1414,13 @@ void PROTOCAN_FILTERS() #define BITS_20_23_MASK (0xFUL << 20) // 4 бита (20..23) #define BITS_24_26_MASK (0x7UL << 24) // 3 бита (24..26) - uint32_t filter1_id = BIT27 | (CURRENT_TYPE_DEVICE << 24) | (CURRENT_ID_DEVICE << 20); + #if ISPM == 0 + uint32_t filter1_id = 0 | (CURRENT_TYPE_DEVICE << 24) | (CURRENT_ID_DEVICE << 20); uint32_t filter1_mask = BIT27 | BITS_24_26_MASK | BITS_20_23_MASK; // все проверяемые биты - + #else + uint32_t filter1_id = BIT27; + uint32_t filter1_mask = BIT27; // все проверяемые биты + #endif #define BITS_16_19_MASK (0xFUL << 16) uint32_t filter2_id = PROTOCAN_MSGTYPE_BROADCAST << 16;