From f1ec390a6d68e9b21c6a7965cf36de77086dc788 Mon Sep 17 00:00:00 2001 From: Ivan Belokobylskiy Date: Sun, 8 Oct 2023 23:26:21 +0400 Subject: [PATCH] populate .swBuildId with values from firmware version (cherry picked from commit 2c6f66ad37fb738d64af327584c5cb4f5045e6aa) --- src/device.c | 17 +++++++++++++++++ src/sensorEpCfg.c | 6 +++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/device.c b/src/device.c index a8d52de..b494a5c 100644 --- a/src/device.c +++ b/src/device.c @@ -250,6 +250,13 @@ static void sampleSensorSysException(void) //while(1); } +char int_to_hex(u8 num){ + char digits[] = "0123456789ABCDEF"; + if (num > 15) return digits[0]; + return digits[num]; +} + + /********************************************************************* * @fn user_init * @@ -281,6 +288,16 @@ void user_init(bool isRetention) ind_init(); if(!isRetention){ + /* Populate swBuildId version */ + g_zcl_basicAttrs.swBuildId[1] = int_to_hex(STACK_RELEASE>>4); + g_zcl_basicAttrs.swBuildId[2] = int_to_hex(STACK_RELEASE & 0xf); + g_zcl_basicAttrs.swBuildId[3] = int_to_hex(STACK_BUILD>>4); + g_zcl_basicAttrs.swBuildId[4] = int_to_hex(STACK_BUILD & 0xf); + g_zcl_basicAttrs.swBuildId[6] = int_to_hex(APP_RELEASE>>4); + g_zcl_basicAttrs.swBuildId[7] = int_to_hex(APP_RELEASE & 0xf); + g_zcl_basicAttrs.swBuildId[8] = int_to_hex(APP_BUILD>>4); + g_zcl_basicAttrs.swBuildId[9] = int_to_hex(APP_BUILD & 0xf); + /* Initialize Stack */ stack_init(); diff --git a/src/sensorEpCfg.c b/src/sensorEpCfg.c index 05d5cf1..6013939 100644 --- a/src/sensorEpCfg.c +++ b/src/sensorEpCfg.c @@ -40,9 +40,6 @@ #ifndef ZCL_BASIC_MODEL_ID #define ZCL_BASIC_MODEL_ID {8,'S','T','H','M','-','I','1','H'} #endif -//#ifndef ZCL_BASIC_SW_BUILD_ID -//#define ZCL_BASIC_SW_BUILD_ID {9,'3','0','0','0','-','0','0','0','1'} -//#endif #else // MIMIC_HEIMAN @@ -55,6 +52,9 @@ #endif // MIMIC_HEIMAN +#ifndef ZCL_BASIC_SW_BUILD_ID +#define ZCL_BASIC_SW_BUILD_ID {9,'0','0','0','0','-','0','0','0','0'} +#endif /********************************************************************** * TYPEDEFS