fix nvm p config size issu

This commit is contained in:
Yunhorn 2024-06-06 09:43:20 +08:00
parent f2cc56f8f8
commit ac700fe921
2 changed files with 57 additions and 22 deletions

View File

@ -525,29 +525,50 @@ typedef struct
/* Exported functions prototypes ---------------------------------------------*/
// 0 --- 10 11 12 -- 39 40 41 42 43 44-63
// LEN P RSS FALL_DETECTION AC_CODE
// 0 --- 10 11 12 ------ 31 32 40 41 42 43 44-63
// LEN [P RSS 20 ] [FALL_DETECTION ] [AC_CODE 20]
enum nvm_order {
NVM_MTM1=0,
NVM_MTM2,
NVM_VER,
NVM_HWV,
NVM_PERIODICITY,
NVM_UNIT,
NVM_SAMPLING,
NVM_S_UNIT,
NVM_WORK_MODE,
NVM_SERVICE_MASK,
NVM_MTM1=0, // 0
NVM_MTM2, // 1
NVM_VER, // 2
NVM_HWV, // 3
NVM_PERIODICITY, // 4
NVM_UNIT, // 5
NVM_SAMPLING, // 6
NVM_S_UNIT, // 7
NVM_WORK_MODE, // 8
NVM_SERVICE_MASK, // 9
NVM_RESERVE01, //10
NVM_LEN, //11, 32=0x20
NVM_CFG_START, //12, p[0] bytes for configs,
NVM_CFG_START=12, //12, p[0] bytes for configs,
//13, p[1]
//14, p[2]
// ...
//32, P[19]
// ...
NVM_LAMP_BAR_FLASHING_COLOR=39, //39, P[27]
NVM_FALL_DETECTION_ACC_THRESHOLD=40, //40
//15, p[3]
//16, p[4]
//17, p[5]
//18, p[6]
//19, p[7]
//20, p[8]
//21, p[9]
//22, p[10]
//23, p[11]
//24, p[12]
//25, p[13]
//26, p[14]
//27, p[15]
//28, p[16]
//29, p[17]
//30, p[18]
NVM_CFG_START_END=31, //31, p[19]
NVM_RESERVE02, //32
NVM_RESERVE03, //33
NVM_RESERVE04, //34
NVM_RESERVE05, //35
NVM_ALARM_MUTE_RESET_TIMER, //36
NVM_FALL_CONFIRM_THRESHOLD, //37
NVM_MOTIONLESS_THRESHOLD, //38
NVM_LAMP_BAR_FLASHING_COLOR, //39
NVM_FALL_DETECTION_ACC_THRESHOLD, //40
NVM_FALL_DETECTION_DEPTH_THRESHOLD, //41
NVM_UNCONCIOUS_THRESHOLD, //42
NVM_OCCUPANCY_OVERTIME_THRESHOLD, //43
@ -572,8 +593,8 @@ typedef struct sts_cfg_nvm {
uint8_t reserve02;
uint8_t reserve03;
uint8_t alarm_indictor_reset_state;
uint8_t alarm_indictor_mute_state;
uint8_t reserve04;
uint8_t reserve05;
uint8_t alarm_mute_or_reset_expire_timer_in_Sec;
uint8_t falldown_confirm_threshold_in_Sec;
uint8_t motionless_duration_threshold_in_Sec;

View File

@ -2322,6 +2322,13 @@ void OnStoreSTSCFGContextRequest(void)
for (j = 0; j < STS_O7_CFG_PCFG_SIZE; j++) {
nvm_store_value[i++] = (sts_cfg_nvm.p[j]);
}
nvm_store_value[i++] = sts_cfg_nvm.reserve02;
nvm_store_value[i++] = sts_cfg_nvm.reserve03;
nvm_store_value[i++] = sts_cfg_nvm.reserve04;
nvm_store_value[i++] = sts_cfg_nvm.reserve05;
nvm_store_value[i++] = sts_cfg_nvm.alarm_mute_or_reset_expire_timer_in_Sec;
nvm_store_value[i++] = sts_cfg_nvm.falldown_confirm_threshold_in_Sec;
nvm_store_value[i++] = sts_cfg_nvm.motionless_duration_threshold_in_Sec;
nvm_store_value[i++] = sts_cfg_nvm.lamp_bar_flashing_color;
nvm_store_value[i++] = sts_cfg_nvm.fall_detection_acc_threshold;
nvm_store_value[i++] = sts_cfg_nvm.fall_detection_depth_threshold;
@ -2403,10 +2410,17 @@ void STS_REBOOT_CONFIG_Init(void)
sts_cfg_nvm.reseve01 = (uint8_t)(nvm_stored_value[NVM_RESERVE01]);
sts_cfg_nvm.length = (uint8_t)(nvm_stored_value[NVM_LEN]&0x3F); //MAX 32 bytes
for (uint8_t j=0; j< sts_cfg_nvm.length; j++) {
for (uint8_t j=0; j< STS_O7_CFG_PCFG_SIZE; j++) { // P RSS CONFIG SIZE= 20U
sts_cfg_nvm.p[j] = (uint8_t)nvm_stored_value[NVM_CFG_START+j];
}
sts_cfg_nvm.reserve02 =(uint8_t)nvm_stored_value[NVM_RESERVE02];
sts_cfg_nvm.reserve03 =(uint8_t)nvm_stored_value[NVM_RESERVE03];
sts_cfg_nvm.reserve04 =(uint8_t)nvm_stored_value[NVM_RESERVE04];
sts_cfg_nvm.reserve05 =(uint8_t)nvm_stored_value[NVM_RESERVE05];
sts_cfg_nvm.alarm_mute_or_reset_expire_timer_in_Sec = (uint8_t)nvm_stored_value[NVM_ALARM_MUTE_RESET_TIMER];
sts_cfg_nvm.falldown_confirm_threshold_in_Sec = (uint8_t)nvm_stored_value[NVM_FALL_CONFIRM_THRESHOLD];
sts_cfg_nvm.motionless_duration_threshold_in_Sec = (uint8_t)nvm_stored_value[NVM_MOTIONLESS_THRESHOLD];
sts_cfg_nvm.motionless_duration_threshold_in_Sec= (uint8_t)nvm_stored_value[NVM_LAMP_BAR_FLASHING_COLOR];
sts_cfg_nvm.lamp_bar_flashing_color = (uint8_t)nvm_stored_value[NVM_LAMP_BAR_FLASHING_COLOR];
sts_cfg_nvm.fall_detection_acc_threshold = (uint8_t)nvm_stored_value[NVM_FALL_DETECTION_ACC_THRESHOLD];
sts_cfg_nvm.fall_detection_depth_threshold = (uint8_t)nvm_stored_value[NVM_FALL_DETECTION_DEPTH_THRESHOLD];