Skip to content

Commit

Permalink
populate .swBuildId with values from firmware version
Browse files Browse the repository at this point in the history
(cherry picked from commit 2c6f66a)
  • Loading branch information
devbis committed Oct 8, 2023
1 parent cff2141 commit f1ec390
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
17 changes: 17 additions & 0 deletions src/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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();

Expand Down
6 changes: 3 additions & 3 deletions src/sensorEpCfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit f1ec390

Please sign in to comment.