minor improve for low power and do_fft_flag
This commit is contained in:
parent
55d5463b3d
commit
47a816b370
|
@ -59,8 +59,8 @@
|
|||
|
||||
#ifdef YUNHORN_STS_M7_ENABLED
|
||||
#define MajorVer 24U
|
||||
#define MinorVer 03U
|
||||
#define SubMinorVer 26U
|
||||
#define MinorVer 05U
|
||||
#define SubMinorVer 22U
|
||||
#define FirmwareVersion 3U
|
||||
/*
|
||||
#define YUNHORN_STS_M7_NVM_CFG_SIZE 3U
|
||||
|
|
|
@ -97,6 +97,7 @@ void PWR_EnterStopMode(void)
|
|||
/* USER CODE END EnterStopMode_1 */
|
||||
HAL_GPIO_WritePin(GPIOB,GPIO_PIN_All, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOC,GPIO_PIN_All, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOA,~(GPIO_PIN_0|GPIO_PIN_1), GPIO_PIN_RESET);
|
||||
HAL_SuspendTick();
|
||||
/* Clear Status Flag before entering STOP/STANDBY Mode */
|
||||
LL_PWR_ClearFlag_C1STOP_C1STB();
|
||||
|
|
|
@ -100,7 +100,7 @@ void SystemApp_Init(void)
|
|||
UTIL_TIMER_Init();
|
||||
SYS_TimerInitialisedFlag = 1;
|
||||
/* Initializes the SW probes pins and the monitor RF pins via Alternate Function */
|
||||
DBG_Init();
|
||||
//DBG_Init();
|
||||
|
||||
/*Initialize the terminal */
|
||||
UTIL_ADV_TRACE_Init();
|
||||
|
|
|
@ -1125,6 +1125,8 @@ static void SendTxData(void)
|
|||
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_mtmcode2); //mtmcode2; //#02
|
||||
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_hardware_ver); //hardware_Ver; //#03
|
||||
AppData.Buffer[i++] = (uint8_t)(99*batteryLevel/254); //#04 /* 99% (very low) to 254 (fully charged) */
|
||||
if (do_fft_flag !=0)
|
||||
{
|
||||
AppData.Buffer[i++] = 0x0D; //temp //#05
|
||||
|
||||
AppData.Buffer[i++] = (uint8_t)(0xFF & m7_data.vibration_duration); //06
|
||||
|
@ -1146,12 +1148,24 @@ static void SendTxData(void)
|
|||
|
||||
AppData.Buffer[i++] = (uint8_t)(0xFF & m7_data.vb_z_rms >>8 ); //17
|
||||
AppData.Buffer[i++] = (uint8_t)(0xFF & m7_data.vb_z_rms); //18
|
||||
} else {
|
||||
|
||||
AppData.Buffer[i++] = 0x01; //temp //#05
|
||||
|
||||
AppData.Buffer[i++] = (uint8_t)(0xFF & m7_data.vibration_duration); //06
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (do_fft_flag !=0)
|
||||
{
|
||||
APP_LOG(TS_OFF, VLEVEL_H, "###### Duration: %02d seconds | FREQ_X:%d Hz | FREQ_Y:%d Hz | FREQ_Z:%d Hz |\r\n###### | RMS_X:%d | RMS_Y:%d | RMS_Z:%d | BATTERY_B:%02d%% |\r\n",
|
||||
AppData.Buffer[6], (AppData.Buffer[7]*255+AppData.Buffer[8]), (AppData.Buffer[9]*255+AppData.Buffer[10]), (AppData.Buffer[11]*255+AppData.Buffer[12]),
|
||||
(AppData.Buffer[13]*255+AppData.Buffer[14]),(AppData.Buffer[15]*255+AppData.Buffer[16]),(AppData.Buffer[17]*255+AppData.Buffer[18]),AppData.Buffer[04]);
|
||||
} else {
|
||||
APP_LOG(TS_OFF, VLEVEL_H, "###### Duration: %02d seconds | BATTERY_B:%02d%% |\r\n",
|
||||
AppData.Buffer[6], AppData.Buffer[04]);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1748,9 +1762,9 @@ void STS_SENSOR_Function_Test_Process(void)
|
|||
{
|
||||
#ifdef YUNHORN_STS_M7_ENABLED
|
||||
int16_t self_test_result[9]={0,0,0,0, 0,0,0, 0,0};
|
||||
|
||||
do_fft_flag = 1;
|
||||
STS_MOTION_SENSOR_Function_Test_Process(&self_test_result[0], count);
|
||||
|
||||
do_fft_flag = 0;
|
||||
outbuf[i++] = (uint8_t) 0X12; //SIZE OF FOLLOWING DATA
|
||||
|
||||
outbuf[i++] = (uint8_t) (self_test_result[0]>>8)&0xff;
|
||||
|
@ -1789,7 +1803,7 @@ void STS_SENSOR_Function_Test_Process(void)
|
|||
|
||||
void STS_YunhornAuthenticationCode_Process(void)
|
||||
{
|
||||
if (sts_ac_code[0] == 0x00) {
|
||||
if ((sts_ac_code[0] == 0x00) && (sts_ac_code[19] == 0x00)) {
|
||||
APP_LOG(TS_OFF,VLEVEL_M, "Initial AC CODE blank... \r\n");
|
||||
return;
|
||||
}
|
||||
|
@ -1797,13 +1811,14 @@ void STS_YunhornAuthenticationCode_Process(void)
|
|||
sts_service_mask = (sts_hmac_verify()!= 0)? STS_SERVICE_MASK_L2:STS_SERVICE_MASK_L0;
|
||||
if (sts_service_mask == STS_SERVICE_MASK_L2) {
|
||||
sts_ac_code[0] = 0x0;
|
||||
sts_ac_code[19] = 0x0;
|
||||
}
|
||||
APP_LOG(TS_OFF, VLEVEL_M, "STS_SERVICE_MASK:%d \r\n",sts_service_mask);
|
||||
}
|
||||
|
||||
void STS_YunhornSTSEventRFAC_Process(void)
|
||||
{
|
||||
if (sts_ac_code[0] ==0x0)
|
||||
if ((sts_ac_code[0] ==0x0) && (sts_ac_code[19] == 0x00))
|
||||
{
|
||||
if ((rfac_timer >= STS_BURN_IN_RFAC) && (rfac_timer < (STS_BURN_IN_RFAC +3)))
|
||||
{
|
||||
|
@ -1816,6 +1831,7 @@ void STS_YunhornSTSEventRFAC_Process(void)
|
|||
sts_service_mask = (sts_hmac_verify()!= 0)? STS_SERVICE_MASK_L2:STS_SERVICE_MASK_L0;
|
||||
if (sts_service_mask == STS_SERVICE_MASK_L2) {
|
||||
sts_ac_code[0] = 0x0;
|
||||
sts_ac_code[19] = 0x0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue