From addcb93d2a9aad92572eb018f12cae38abe00c36 Mon Sep 17 00:00:00 2001 From: cfif Date: Tue, 24 Feb 2026 14:54:37 +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 --- DataNonVolatile.h | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/DataNonVolatile.h b/DataNonVolatile.h index a74311f..8040081 100644 --- a/DataNonVolatile.h +++ b/DataNonVolatile.h @@ -7,11 +7,36 @@ #include "DataRuntime.h" #include "HVAC_preDefine.h" -#include "StatusData.h" #define DEVICE_DATA_VERSION_CALIB 0x01 #define DEVICE_DATA_VERSION_PARAM 0x01 +// BCD в двоичное число +#define bcd_to_binary(bcd) (((bcd >> 4) * 10) + (bcd & 0x0F)) + +// Двоичное число в BCD +#define binary_to_bcd(binary) (((binary / 10) << 4) | (binary % 10)) + +typedef struct __attribute__ ((packed)) { + uint8_t year; // BCD: 0x18 = 2018 год + uint8_t month; // BCD: 0x10 = октябрь + uint8_t day; // BCD: 0x16 = 16 число + char tester_serial[9]; // ASCII: "123456789" +} tFingerprint; + +// Packet [4] Byte +//Data Objects: +//[0:0] Date year (yy), Unsigned (1Byte) +// - 02 – 99 +//[1:0] Date month (mm), Unsigned (1Byte) +// - 01 – 12 +//[2:0] Date day (dd), Unsigned (1Byte) +// - 01-31 +//[3:0] Revision, Unsigned (1Byte) +typedef struct { + uint8_t SW[4]; + uint8_t MBD[4]; +} tInternal_SW_Version; typedef struct { tInternal_SW_Version Internal_SW_Version;