almost all CMD FINISHED
This commit is contained in:
parent
68f5cba632
commit
95b5be0fb8
|
@ -280,7 +280,7 @@ static void OnYunhornSTSHeartBeatTimerEvent(void *context);
|
||||||
* @brief Yunhorn STS Heart Beat Periodicity Chagne function
|
* @brief Yunhorn STS Heart Beat Periodicity Chagne function
|
||||||
* @param duration of periodicty in ms (1/1000 sec)
|
* @param duration of periodicty in ms (1/1000 sec)
|
||||||
*/
|
*/
|
||||||
static void OnYunhornSTSHeartBeatPeriodicityChanged(uint32_t periodicity);
|
//static void OnYunhornSTSHeartBeatPeriodicityChanged(uint32_t periodicity);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1230,7 +1230,7 @@ static void OnYunhornSTSHeartBeatTimerEvent(void *context)
|
||||||
|
|
||||||
STS_SENSOR_Upload_Message(appHeartBeatDataPort, appHeartBeatBufferSize, (uint8_t*)appHeartBeatDataBuffer);
|
STS_SENSOR_Upload_Message(appHeartBeatDataPort, appHeartBeatBufferSize, (uint8_t*)appHeartBeatDataBuffer);
|
||||||
#endif
|
#endif
|
||||||
if (rfac_timer <100)
|
if (rfac_timer <20)
|
||||||
{
|
{
|
||||||
STS_YunhornSTSEventRFAC_Process();
|
STS_YunhornSTSEventRFAC_Process();
|
||||||
rfac_timer ++;
|
rfac_timer ++;
|
||||||
|
|
|
@ -243,7 +243,7 @@ void STS_SENSOR_Upload_Message(uint8_t appDataPort, uint8_t appBufferSize, uint8
|
||||||
|
|
||||||
void STS_SENSOR_MEMS_Get_ID(uint16_t *devID);
|
void STS_SENSOR_MEMS_Get_ID(uint16_t *devID);
|
||||||
|
|
||||||
|
void OnYunhornSTSHeartBeatPeriodicityChanged(uint32_t periodicity);
|
||||||
|
|
||||||
void USER_APP_AUTO_RESPONDER_Parse(uint8_t *parse_buffer, uint8_t parse_buffer_size);
|
void USER_APP_AUTO_RESPONDER_Parse(uint8_t *parse_buffer, uint8_t parse_buffer_size);
|
||||||
void STS_SENSOR_Function_Test_Process(void);
|
void STS_SENSOR_Function_Test_Process(void);
|
||||||
|
|
|
@ -98,7 +98,7 @@ volatile sts_cfg_nvm_t sts_cfg_nvm = {
|
||||||
// below 20 bytes for RFAC code
|
// below 20 bytes for RFAC code
|
||||||
{0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0}
|
{0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0}
|
||||||
};
|
};
|
||||||
volatile uint8_t nvm_store_value[YUNHORN_STS_MAX_NVM_CFG_SIZE]={0x0};
|
//volatile uint8_t nvm_store_value[YUNHORN_STS_MAX_NVM_CFG_SIZE]={0x0};
|
||||||
volatile uint8_t sts_ac_code[20]={0x0};
|
volatile uint8_t sts_ac_code[20]={0x0};
|
||||||
volatile uint8_t sts_service_mask=STS_SERVICE_MASK_L0;
|
volatile uint8_t sts_service_mask=STS_SERVICE_MASK_L0;
|
||||||
volatile uint8_t sts_work_mode=4;
|
volatile uint8_t sts_work_mode=4;
|
||||||
|
@ -110,6 +110,9 @@ static uint8_t outbuf[128]={0x0};
|
||||||
extern volatile hmac_result_t hmac_result;
|
extern volatile hmac_result_t hmac_result;
|
||||||
extern uint16_t sensor_id;
|
extern uint16_t sensor_id;
|
||||||
extern UTIL_TIMER_Time_t TxPeriodicity;
|
extern UTIL_TIMER_Time_t TxPeriodicity;
|
||||||
|
extern UTIL_TIMER_Object_t YunhornSTSHeartBeatTimer;
|
||||||
|
static void STS_Show_STS_CFG_NVM(uint8_t * nvm_store_value);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
volatile uint8_t sts_reed_hall_result, last_sts_reed_hall_result,sts_reed_hall_changed_flag;
|
volatile uint8_t sts_reed_hall_result, last_sts_reed_hall_result,sts_reed_hall_changed_flag;
|
||||||
volatile uint32_t event_start_time, event_stop_time;
|
volatile uint32_t event_start_time, event_stop_time;
|
||||||
|
@ -167,7 +170,7 @@ extern volatile float sts_presence_rss_distance;
|
||||||
|
|
||||||
/* External variables ---------------------------------------------------------*/
|
/* External variables ---------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN EV */
|
/* USER CODE BEGIN EV */
|
||||||
extern UTIL_TIMER_Object_t YunhornSTSHeartBeatTimer;
|
//extern UTIL_TIMER_Object_t YunhornSTSHeartBeatTimer;
|
||||||
/* USER CODE END EV */
|
/* USER CODE END EV */
|
||||||
|
|
||||||
/* Private typedef -----------------------------------------------------------*/
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
|
@ -219,11 +222,13 @@ void STS_YunhornAuthenticationCode_Process(void)
|
||||||
/* initiated by Heart-beat timer */
|
/* initiated by Heart-beat timer */
|
||||||
void STS_YunhornSTSEventRFAC_Process(void)
|
void STS_YunhornSTSEventRFAC_Process(void)
|
||||||
{
|
{
|
||||||
|
if ((sts_cfg_nvm.ac[0]==0x0)&&(sts_cfg_nvm.ac[19]==0x0))
|
||||||
if ((rfac_timer >= STS_BURN_IN_RFAC) && (rfac_timer < (STS_BURN_IN_RFAC +3)))
|
|
||||||
{
|
{
|
||||||
APP_LOG(TS_OFF, VLEVEL_M, "\r\n -RFAC Process\r\n");
|
if ((rfac_timer >= STS_BURN_IN_RFAC) && (rfac_timer < (STS_BURN_IN_RFAC +3)))
|
||||||
STS_SENSOR_Upload_Message(YUNHORN_STS_USER_APP_CTRL_REPLY_PORT, 4, (uint8_t*)"RFAC");
|
{
|
||||||
|
APP_LOG(TS_OFF, VLEVEL_M, "\r\n -RFAC Process\r\n");
|
||||||
|
STS_SENSOR_Upload_Message(YUNHORN_STS_USER_APP_CTRL_REPLY_PORT, 4, (uint8_t*)"RFAC");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#if 0
|
#if 0
|
||||||
if ((rfac_timer > (STS_BURN_IN_RFAC + 3)))
|
if ((rfac_timer > (STS_BURN_IN_RFAC + 3)))
|
||||||
|
@ -1145,7 +1150,7 @@ void USER_APP_AUTO_RESPONDER_Parse(uint8_t *parse_buffer, uint8_t parse_buffer_s
|
||||||
STS_HeartBeatTimerPeriod_sec = heart_beat_or_sampling_periodicity_length;
|
STS_HeartBeatTimerPeriod_sec = heart_beat_or_sampling_periodicity_length;
|
||||||
|
|
||||||
#ifdef STS_P2
|
#ifdef STS_P2
|
||||||
//OnYunhornSTSHeartBeatPeriodicityChanged(STS_HeartBeatTimerPeriod_sec*1000);
|
OnYunhornSTSHeartBeatPeriodicityChanged(STS_HeartBeatTimerPeriod_sec*1000);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef YUNHORN_STS_E0_ENABLED
|
#ifdef YUNHORN_STS_E0_ENABLED
|
||||||
|
@ -1454,7 +1459,7 @@ void STS_REBOOT_CONFIG_Init(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
STS_Show_STS_CFG_NVM((uint8_t*)nvm_store_value);
|
||||||
OnRestoreSTSCFGContextProcess();
|
OnRestoreSTSCFGContextProcess();
|
||||||
|
|
||||||
/* USER CODE END OnRestoreContextRequest_Last */
|
/* USER CODE END OnRestoreContextRequest_Last */
|
||||||
|
@ -1472,7 +1477,7 @@ void OnRestoreSTSCFGContextProcess(void)
|
||||||
}
|
}
|
||||||
periodicity = (periodicity > 10)? periodicity : 10; // in seconds unit
|
periodicity = (periodicity > 10)? periodicity : 10; // in seconds unit
|
||||||
|
|
||||||
//TxPeriodicity= periodicity*1000; // to ms
|
TxPeriodicity= periodicity*1000; // to ms
|
||||||
|
|
||||||
uint32_t sampling_heartbeat_periodicity = (sts_cfg_nvm.sampling); //Heart-beat or Sampling interval
|
uint32_t sampling_heartbeat_periodicity = (sts_cfg_nvm.sampling); //Heart-beat or Sampling interval
|
||||||
if ((char)sts_cfg_nvm.s_unit =='M') {
|
if ((char)sts_cfg_nvm.s_unit =='M') {
|
||||||
|
@ -1495,8 +1500,11 @@ void OnRestoreSTSCFGContextProcess(void)
|
||||||
//OnTxPeriodicityChanged(TxPeriodicity); // in msec unit
|
//OnTxPeriodicityChanged(TxPeriodicity); // in msec unit
|
||||||
//OnTxPeriodicityChanged(periodicity*1000);
|
//OnTxPeriodicityChanged(periodicity*1000);
|
||||||
//Heart-beat or Sampling interval
|
//Heart-beat or Sampling interval
|
||||||
sampling_heartbeat_periodicity = (sampling_heartbeat_periodicity > 0)? sampling_heartbeat_periodicity : 1; // in seconds unit
|
//sampling_heartbeat_periodicity = (sampling_heartbeat_periodicity > 0)? sampling_heartbeat_periodicity : 1; // in seconds unit
|
||||||
sampling_heartbeat_periodicity = sampling_heartbeat_periodicity*1000;
|
//sampling_heartbeat_periodicity = sampling_heartbeat_periodicity*1000;
|
||||||
|
#ifdef STS_P2
|
||||||
|
STS_HeartBeatTimerPeriod_sec = sampling_heartbeat_periodicity;
|
||||||
|
#endif
|
||||||
#if defined(YUNHORN_STS_O6_ENABLED) ||defined(YUNHORN_STS_O5_ENABLED)
|
#if defined(YUNHORN_STS_O6_ENABLED) ||defined(YUNHORN_STS_O5_ENABLED)
|
||||||
OnYunhornSTSSamplingPeriodicityChanged(sampling_heartbeat_periodicity); // in m-sec unit
|
OnYunhornSTSSamplingPeriodicityChanged(sampling_heartbeat_periodicity); // in m-sec unit
|
||||||
#endif
|
#endif
|
||||||
|
@ -1534,6 +1542,17 @@ void OnRestoreSTSCFGContextProcess(void)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void STS_Show_STS_CFG_NVM(uint8_t * nvm_store_value)
|
||||||
|
{
|
||||||
|
APP_LOG(TS_OFF, VLEVEL_M, "\n *** STS_CFG_NVM ***\n");
|
||||||
|
APP_LOG(TS_OFF, VLEVEL_M, "\n00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15\n");
|
||||||
|
for (uint8_t i=0; i<YUNHORN_STS_MAX_NVM_CFG_SIZE; i++)
|
||||||
|
{
|
||||||
|
if (i%16==0) APP_LOG(TS_OFF, VLEVEL_M, "\n");
|
||||||
|
APP_LOG(TS_OFF, VLEVEL_M, "%02X ", nvm_store_value[i]);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
void STS_SENSOR_Distance_Test_Process(void)
|
void STS_SENSOR_Distance_Test_Process(void)
|
||||||
{
|
{
|
||||||
#ifdef YUNHORN_STS_O6_ENABLED
|
#ifdef YUNHORN_STS_O6_ENABLED
|
||||||
|
|
Loading…
Reference in New Issue