wip with reboot process adjusted
This commit is contained in:
parent
3a562989a0
commit
4a01508b41
|
@ -124,7 +124,7 @@ int main(void)
|
|||
}
|
||||
|
||||
/* USER CODE BEGIN 2 */
|
||||
|
||||
STS_Sensor_Init();
|
||||
/* USER CODE END 2 */
|
||||
|
||||
/* Infinite loop */
|
||||
|
|
|
@ -559,22 +559,16 @@ void LoRaWAN_Init(void)
|
|||
}
|
||||
|
||||
/* USER CODE BEGIN LoRaWAN_Init_Last */
|
||||
|
||||
#if 0
|
||||
STS_REBOOT_CONFIG_Init();
|
||||
|
||||
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventRFAC), UTIL_SEQ_RFU, STS_YunhornSTSEventRFAC_Process);
|
||||
|
||||
#ifdef STS_M1
|
||||
|
||||
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), UTIL_SEQ_RFU, STS_YunhornSTSEventP1_Process);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(STS_P2)||defined(STS_T6)||defined(L8)
|
||||
|
||||
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP5), UTIL_SEQ_RFU, STS_YunhornSTSEventP5_Process);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef STS_R4
|
||||
|
@ -599,10 +593,55 @@ void LoRaWAN_Init(void)
|
|||
//UTIL_TIMER_Create(&YunhornSTSHeartBeatTimer, 1000*STS_HeartBeatTimerPeriod_sec, UTIL_TIMER_PERIODIC, OnYunhornSTSHeartBeatTimerEvent, NULL);
|
||||
// UTIL_TIMER_Create(&YunhornSTSHeartBeatTimer, 1000*STS_HeartBeatTimerPeriod_sec, UTIL_TIMER_ONESHOT, OnYunhornSTSHeartBeatTimerEvent, NULL);
|
||||
// UTIL_TIMER_Start(&YunhornSTSHeartBeatTimer);
|
||||
|
||||
#endif
|
||||
/* USER CODE END LoRaWAN_Init_Last */
|
||||
}
|
||||
|
||||
|
||||
void STS_Sensor_Init(void)
|
||||
{
|
||||
|
||||
/* VVVVVV migrated to yunhorn_sts_process.c */
|
||||
// #if 0
|
||||
/// **************************************************************************** TO-DO LIST
|
||||
STS_REBOOT_CONFIG_Init();
|
||||
|
||||
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventRFAC), UTIL_SEQ_RFU, STS_YunhornSTSEventRFAC_Process);
|
||||
#ifdef STS_M1
|
||||
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), UTIL_SEQ_RFU, STS_YunhornSTSEventP1_Process);
|
||||
#endif
|
||||
|
||||
#if defined(STS_P2)||defined(STS_T6)||defined(L8)
|
||||
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP5), UTIL_SEQ_RFU, STS_YunhornSTSEventP5_Process);
|
||||
#endif
|
||||
|
||||
#ifdef STS_R4
|
||||
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP6), UTIL_SEQ_RFU, STS_YunhornSTSEventP6_Process);
|
||||
#endif
|
||||
|
||||
#ifdef VL53L0
|
||||
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP4), UTIL_SEQ_RFU, STS_YunhornSTSEventP4_Process);
|
||||
#endif
|
||||
|
||||
#if defined(STS_T6)||defined(STS_O6)||defined(O1L)
|
||||
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP3), UTIL_SEQ_RFU, STS_YunhornSTSEventP3_Process);
|
||||
#endif
|
||||
|
||||
#if defined(STS_P2)||defined(STS_T6)||defined(L8)
|
||||
UTIL_TIMER_Create(&YunhornSTSWakeUpScanTimer, STS_TOFScanPeriod_msec, UTIL_TIMER_PERIODIC, (void*)STS_YunhornSTSEventP5_Process, NULL);
|
||||
UTIL_TIMER_Start(&YunhornSTSWakeUpScanTimer);
|
||||
#endif
|
||||
|
||||
UTIL_TIMER_Start(&STSLampBarColorTimer);
|
||||
UTIL_TIMER_Start(&STSDurationCheckTimer);
|
||||
//UTIL_TIMER_Create(&YunhornSTSHeartBeatTimer, 1000*STS_HeartBeatTimerPeriod_sec, UTIL_TIMER_PERIODIC, OnYunhornSTSHeartBeatTimerEvent, NULL);
|
||||
// UTIL_TIMER_Create(&YunhornSTSHeartBeatTimer, 1000*STS_HeartBeatTimerPeriod_sec, UTIL_TIMER_ONESHOT, OnYunhornSTSHeartBeatTimerEvent, NULL);
|
||||
// UTIL_TIMER_Start(&YunhornSTSHeartBeatTimer);
|
||||
/* VVVVVV migrated to yunhorn_sts_process.c */
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* USER CODE BEGIN PB_Callbacks */
|
||||
|
||||
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -464,6 +464,9 @@ void OnRestoreSTSCFGContextRequest(uint8_t *cfg_in_nvm);
|
|||
|
||||
void STS_REBOOT_CONFIG_Init(void);
|
||||
|
||||
void STS_Sensor_Init(void);
|
||||
void STS_Sensor_Prepare(void);
|
||||
|
||||
/**
|
||||
* @brief Apply/Process config to board
|
||||
*/
|
||||
|
|
|
@ -2056,7 +2056,7 @@ void STS_SENSOR_Distance_Test_Process(void)
|
|||
rpt++;
|
||||
range_sum += range_once ;
|
||||
}
|
||||
HAL_Delay(50);
|
||||
HAL_Delay(150);
|
||||
}while (rpt<3);
|
||||
|
||||
sts_sensor_install_height = range_sum/rpt;
|
||||
|
|
|
@ -185,9 +185,9 @@ void STS_LMZ_Ambient_Height_Scan_Process(void)
|
|||
uint8_t i=0;
|
||||
uint32_t range_distance =0;
|
||||
uint8_t j=0;
|
||||
uint32_t bg_distance[64]={0};
|
||||
uint16_t bg_distance[64]={0};
|
||||
uint8_t idx[64]={0};
|
||||
uint8_t IDX_LEN=10;
|
||||
uint8_t IDX_LEN=20;
|
||||
|
||||
for (i=0; i<64; i++)
|
||||
{
|
||||
|
@ -234,26 +234,32 @@ void STS_LMZ_Ambient_Height_Scan_Process(void)
|
|||
for (i = 0; i < 64; i++)
|
||||
{
|
||||
if (i % 8 ==0) APP_LOG(TS_OFF, VLEVEL_H, "\r\n[cm] ");
|
||||
if ((Result.ZoneResult[i].NumberOfTargets > 0))
|
||||
//if ((Result.ZoneResult[i].NumberOfTargets > 0))
|
||||
{
|
||||
bg_distance[i] += (uint32_t) Result.ZoneResult[i].Distance[0];
|
||||
bg_distance[i] += (uint16_t) Result.ZoneResult[i].Distance[0];
|
||||
idx[i] ++;
|
||||
APP_LOG(TS_OFF, VLEVEL_H, "|%3d ", Result.ZoneResult[i].Distance[0]/10);
|
||||
} else APP_LOG(TS_OFF, VLEVEL_H, "|%3d ", 0);
|
||||
}
|
||||
//else APP_LOG(TS_OFF, VLEVEL_H, "|%3d ", 0);
|
||||
|
||||
}
|
||||
|
||||
//}
|
||||
}
|
||||
HAL_Delay(50);
|
||||
HAL_Delay(150);
|
||||
}
|
||||
|
||||
APP_LOG(TS_OFF, VLEVEL_H, "\r\n\n\nAverage Distance==\r\n");
|
||||
for (i=0; i< 64; i++)
|
||||
{
|
||||
if (i%8==0) APP_LOG(TS_OFF, VLEVEL_H, "\r\n %2d ", i);
|
||||
bg_distance[i] /= idx[i];
|
||||
APP_LOG(TS_OFF, VLEVEL_H, "|%3d ", bg_distance[i]/10);
|
||||
}
|
||||
//STS_TOF_L8_Process();
|
||||
|
||||
|
||||
APP_LOG(TS_OFF, VLEVEL_L, "\r\n ----------------------"
|
||||
"\r\n------Gesture Mask off above Threshold %d cm--\r\n", fhmos_cfg.th_gesture_mask_off_height_cm);
|
||||
APP_LOG(TS_OFF, VLEVEL_L, "\r\n------Gesture Mask off above Threshold %d cm--\r\n", fhmos_cfg.th_gesture_mask_off_height_cm);
|
||||
|
||||
for (uint8_t i = 0; i < 64; i++)
|
||||
{
|
||||
|
@ -263,10 +269,21 @@ void STS_LMZ_Ambient_Height_Scan_Process(void)
|
|||
if (1)
|
||||
{
|
||||
// range_distance = (uint32_t)Result.ZoneResult[i].Distance[0];
|
||||
range_distance = (uint32_t)bg_distance[i];
|
||||
fhmos_bg.h2cm[i] = abs(sts_sensor_install_height - range_distance)/20; // in 2 cm
|
||||
range_distance = (uint16_t)bg_distance[i]; // mm
|
||||
if (sts_sensor_install_height > range_distance)
|
||||
{
|
||||
fhmos_bg.h2cm[i] = (sts_sensor_install_height - range_distance)/10;
|
||||
} else {
|
||||
|
||||
if (2*fhmos_bg.h2cm[i] < fhmos_cfg.th_gesture_mask_off_height_cm)
|
||||
fhmos_bg.h2cm[i] = 0;
|
||||
}
|
||||
|
||||
|
||||
//fhmos_bg.h2cm[i] = (uint16_t)(0, (sts_sensor_install_height/10 - range_distance)); // in cm
|
||||
|
||||
APP_LOG(TS_OFF, VLEVEL_L, "|%3d ", (uint16_t)fhmos_bg.h2cm[i]);
|
||||
|
||||
if ((uint16_t)fhmos_bg.h2cm[i] < (uint16_t)(fhmos_cfg.th_gesture_mask_off_height_cm))
|
||||
{
|
||||
fhmos_bg.maskoff[i] = 0;
|
||||
} else
|
||||
|
@ -277,7 +294,7 @@ void STS_LMZ_Ambient_Height_Scan_Process(void)
|
|||
//sts_mask_bitmap[(uint8_t)(i/8)] |= (fhmos_bg.maskoff[i])<<(7-i%8);
|
||||
// sts_mask_bitmap[(uint8_t)(i/8)] |= (fhmos_bg.maskoff[i])<<(7-i%8); // 2025-JAN-03 update
|
||||
// if (i%8==0) APP_LOG(TS_OFF, VLEVEL_M, "\r\n");
|
||||
APP_LOG(TS_OFF, VLEVEL_L, "|%3d ", fhmos_bg.h2cm[i]*2);
|
||||
//APP_LOG(TS_OFF, VLEVEL_L, "|%3d ", fhmos_bg.h2cm[i]*2);
|
||||
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue