MINOR REVISE
This commit is contained in:
parent
de2e2b96c6
commit
ddba00ae21
|
@ -106,7 +106,7 @@
|
|||
|
||||
#define MajorVer 24U
|
||||
#define MinorVer 05U
|
||||
#define SubMinorVer 28U
|
||||
#define SubMinorVer 29U
|
||||
#define FirmwareVersion 3U
|
||||
#define YUNHORN_STS_MAX_NVM_CFG_SIZE 64U
|
||||
#define YUNHORN_STS_AC_CODE_SIZE 20U
|
||||
|
|
|
@ -44,9 +44,7 @@ void MX_DMA_Init(void)
|
|||
/* DMA controller clock enable */
|
||||
__HAL_RCC_DMAMUX1_CLK_ENABLE();
|
||||
__HAL_RCC_DMA1_CLK_ENABLE();
|
||||
#if 0
|
||||
__HAL_RCC_DMA2_CLK_ENABLE();
|
||||
#endif
|
||||
|
||||
/* DMA interrupt init */
|
||||
#if 0
|
||||
// **** TIM1_CH2 WS2812B @ PA-9
|
||||
|
|
|
@ -115,11 +115,6 @@ int main(void)
|
|||
MX_LoRaWAN_Init();
|
||||
|
||||
/* USER CODE BEGIN 2 */
|
||||
//HAL_UART_DeInit(&huart2);
|
||||
|
||||
//vcom_DeInit();
|
||||
//HAL_Delay(3000);
|
||||
|
||||
|
||||
/* USER CODE END 2 */
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ uint32_t sts_hmac_verify(void)
|
|||
|
||||
hmac_result.ac_pass = (ret == 0x0)?1U:0U;
|
||||
|
||||
APP_LOG(TS_OFF, VLEVEL_M, "\r\nHMAC Verify Success = %u \r\n", hmac_result.ac_pass);
|
||||
//APP_LOG(TS_OFF, VLEVEL_L, "\r\nHMAC Verify Success = %u \r\n", hmac_result.ac_pass);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -302,14 +302,14 @@ void STS_YunhornSTSEventP3_Process(void)
|
|||
void STS_YunhornSTSEventP4_Process(void)
|
||||
{
|
||||
STS_SENSOR_Power_ON(0);
|
||||
HAL_Delay(10);
|
||||
//HAL_Delay(10);
|
||||
#ifdef LED_ONBOARD
|
||||
LED_ON;
|
||||
HAL_Delay(10);
|
||||
LED_OFF;
|
||||
#endif
|
||||
#if defined(TOF_1)||defined(TOF_2)
|
||||
APP_LOG(TS_OFF, VLEVEL_H, "\r\n TOF_1, TOF_2 RANGING Process\r\n");
|
||||
APP_LOG(TS_OFF, VLEVEL_L, "\r\n TOF_1, TOF_2 RANGING Process\r\n");
|
||||
//STS_TOF_VL53L0X_Range_Process();
|
||||
MX_TOF_Process();
|
||||
#endif
|
||||
|
@ -414,106 +414,7 @@ void STS_YunhornSTSEventPIORS485_Process(void)
|
|||
|
||||
void STS_Combined_Status_Processing(void)
|
||||
{
|
||||
#if (defined(YUNHORN_STS_O6_ENABLED) && defined(USE_ACCONEER_A111))
|
||||
switch (sts_work_mode)
|
||||
{
|
||||
case STS_NETWORK_MODE:
|
||||
sts_status_color = sts_cloud_netcolor;
|
||||
break;
|
||||
case STS_WIRED_MODE: // NO LAMP BAR FOR THOSE WATER LEAKAGE SENSOR OR SOAP CAPACITY SENSORS
|
||||
sts_status_color = STS_DARK;
|
||||
sts_water_leakage_result = sts_reed_hall_result; // == STS_Status_Door_Open )?1U:0U; //STS_RESULT_WATER_LEAKAGE_YES:STS_RESULT_WATER_LEAKAGE_NO;
|
||||
sts_water_leakage_changed_flag = 1;
|
||||
break;
|
||||
case STS_REEDSWITCH_MODE:
|
||||
|
||||
sts_status_color = (sts_reed_hall_result == STS_Status_Door_Open )? STS_GREEN: STS_RED;
|
||||
|
||||
break;
|
||||
case STS_RSS_MODE:
|
||||
if (sts_rss_result == STS_RESULT_NO_MOTION){
|
||||
sts_status_color = STS_GREEN;
|
||||
} else if ((sts_rss_result == STS_RESULT_MOTION))
|
||||
{
|
||||
sts_status_color = STS_RED;
|
||||
}
|
||||
break;
|
||||
case STS_DUAL_MODE:
|
||||
if ((sts_rss_result == STS_RESULT_NO_MOTION) && (sts_reed_hall_result == STS_Status_Door_Open ))
|
||||
{
|
||||
sts_status_color = STS_GREEN;
|
||||
|
||||
} else if ((sts_rss_result == STS_RESULT_MOTION) || (sts_reed_hall_result == STS_Status_Door_Close ))
|
||||
{
|
||||
sts_status_color = STS_RED;
|
||||
}
|
||||
break;
|
||||
case STS_DUAL_RSS_MODE:
|
||||
if ((sts_rss_result == STS_RESULT_NO_MOTION) && (sts_rss_2nd_result == STS_RESULT_NO_MOTION))
|
||||
{
|
||||
sts_status_color = STS_GREEN;
|
||||
} else if ((sts_rss_result == STS_RESULT_MOTION) || (sts_rss_2nd_result == STS_RESULT_MOTION))
|
||||
{
|
||||
sts_status_color = STS_RED;
|
||||
}
|
||||
|
||||
break;
|
||||
case STS_TOF_RSS_MODE:
|
||||
if ((sts_rss_result == STS_RESULT_NO_MOTION) && (sts_tof_result == STS_RESULT_NO_PRESENCE)){
|
||||
sts_status_color = STS_GREEN;
|
||||
|
||||
} else if ((sts_rss_result == STS_RESULT_MOTION) || (sts_tof_result == STS_RESULT_PRESENCE))
|
||||
{
|
||||
sts_status_color = STS_RED;
|
||||
}
|
||||
|
||||
break;
|
||||
// TO-DO LIST ***********************************************************
|
||||
case STS_TOF_DISTANCE_MODE:
|
||||
if ((sts_tof_result == STS_RESULT_NO_PRESENCE)) {
|
||||
sts_status_color = STS_GREEN;
|
||||
} else if ((sts_tof_result == STS_RESULT_PRESENCE)) {
|
||||
sts_status_color = STS_RED;
|
||||
}
|
||||
break;
|
||||
case STS_TOF_PRESENCE_MODE:
|
||||
if ((sts_tof_result == STS_RESULT_NO_PRESENCE)) {
|
||||
sts_status_color = STS_GREEN;
|
||||
} else if ((sts_tof_result == STS_RESULT_PRESENCE)) {
|
||||
sts_status_color = STS_RED;
|
||||
}
|
||||
break;
|
||||
case STS_TOF_IN_OUT_MODE:
|
||||
if ((sts_tof_result == STS_RESULT_NO_PRESENCE)) {
|
||||
sts_status_color = STS_GREEN;
|
||||
} else if ((sts_tof_result == STS_RESULT_PRESENCE)) {
|
||||
sts_status_color = STS_RED;
|
||||
}
|
||||
break;
|
||||
// TO-DO LIST ***********************************************************
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (sts_work_mode != STS_WIRED_MODE)
|
||||
{
|
||||
if ((last_lamp_bar_color != sts_status_color))
|
||||
{
|
||||
sts_lamp_bar_color = ((sts_service_mask == STS_SERVICE_MASK_L0)? STS_DARK: sts_status_color);
|
||||
|
||||
STS_Lamp_Bar_Set_STS_RGB_Color(sts_lamp_bar_color, luminance_level);
|
||||
if ((sts_service_mask == STS_SERVICE_MASK_L0) || (sts_lamp_bar_color == STS_DARK))
|
||||
{
|
||||
STS_WS2812B_Refresh();
|
||||
}
|
||||
|
||||
last_lamp_bar_color = sts_lamp_bar_color;
|
||||
}
|
||||
} else STS_Lamp_Bar_Set_Dark();
|
||||
|
||||
if ((sts_rss_result_changed_flag + sts_reed_hall_changed_flag + sts_tof_result_changed_flag +sts_water_leakage_changed_flag))
|
||||
sensor_data_ready = 1U;
|
||||
STS_PRESENCE_SENSOR_Prepare_Send_Data();
|
||||
#endif
|
||||
}
|
||||
|
||||
void STS_SENSOR_Power_ON(uint8_t cnt)
|
||||
|
|
|
@ -639,9 +639,6 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
|||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), CFG_SEQ_Prio_0);
|
||||
#endif
|
||||
|
||||
#ifdef STS_R1D
|
||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP4), CFG_SEQ_Prio_0);
|
||||
#endif
|
||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
|
||||
#ifdef LED_ONBOARD
|
||||
LED_ON;
|
||||
|
@ -801,7 +798,6 @@ static void SendTxData(void)
|
|||
if (LmHandlerIsBusy() == false)
|
||||
{
|
||||
uint8_t i = 0;
|
||||
//MX_TOF_Process();
|
||||
#if defined(YUNHORN_STS_O5_ENABLED)
|
||||
STS_O5_SENSOR_Read(&oo_data);
|
||||
#endif
|
||||
|
@ -809,24 +805,16 @@ static void SendTxData(void)
|
|||
STS_YunhornSTSEventP6_Process();
|
||||
#endif
|
||||
|
||||
//UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP6), CFG_SEQ_Prio_0);
|
||||
#if defined(YUNHORN_STS_R0_ENABLED)||defined(YUNHORN_STS_R5_ENABLED)
|
||||
//UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP4), CFG_SEQ_Prio_0);
|
||||
|
||||
MX_TOF_Init();
|
||||
MX_TOF_Process();
|
||||
STS_R0_SENSOR_Read(&r0_data);
|
||||
//r0_data.battery_mV = batteryLevelmV;
|
||||
r0_data.battery_Pct = (uint8_t)(99*batteryLevel/254);
|
||||
#endif
|
||||
//r0_data.battery_Pct = batteryLevel; //(uint8_t)(99*batteryLevel/254);
|
||||
|
||||
//EnvSensors_Read(&sensor_data);
|
||||
|
||||
// APP_LOG(TS_ON, VLEVEL_M, "\r\nVDDA: %d\r\n", batteryLevel);
|
||||
// APP_LOG(TS_ON, VLEVEL_M, "\r\ntemp: %d\r\n", (int16_t)(sensor_data.temperature));
|
||||
|
||||
//APP_LOG(TS_ON, VLEVEL_L, "\r\nDistance = %d mm, VBAT=%d%%\r\n", r0_data.distance_mm, r0_data.battery_Pct);
|
||||
|
||||
// EnvSensors_Read(&sensor_data);
|
||||
// APP_LOG(TS_ON, VLEVEL_M, "\r\nVDDA: %d\r\n", batteryLevel);
|
||||
// APP_LOG(TS_ON, VLEVEL_M, "\r\ntemp: %d\r\n", (int16_t)(sensor_data.temperature));
|
||||
|
||||
AppData.Port = LORAWAN_USER_APP_PORT;
|
||||
#ifdef ROCTEC_R5
|
||||
|
@ -861,13 +849,11 @@ static void SendTxData(void)
|
|||
AppData.Buffer[i++] = (uint8_t)(oo_data.state_sensor1_on_off)&0xff;
|
||||
#endif
|
||||
#ifdef STS_R1D // TOF_1 & TOF_2 for STS_R1D
|
||||
AppData.Buffer[i++] = (uint8_t)(0x06)&0xff; //#length of following bytes
|
||||
AppData.Buffer[i++] = (uint8_t)(0x04)&0xff; //#length of following bytes
|
||||
AppData.Buffer[i++] = (uint8_t)(r0_data.distance_mm >>8)&0xff; //#05
|
||||
AppData.Buffer[i++] = (uint8_t)(r0_data.distance_mm)&0xff; //#06
|
||||
AppData.Buffer[i++] = (uint8_t)(r0_data.distance1_mm >>8)&0xff; //#07
|
||||
AppData.Buffer[i++] = (uint8_t)(r0_data.distance1_mm)&0xff; //#08
|
||||
AppData.Buffer[i++] = (uint8_t)(r0_data.distance2_mm >>8)&0xff; //#07
|
||||
AppData.Buffer[i++] = (uint8_t)(r0_data.distance2_mm)&0xff; //#08
|
||||
#endif
|
||||
#ifdef TOF_3
|
||||
AppData.Buffer[i++] = (uint8_t)(r0_data.distance2_mm >>8)&0xff; //#09
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -104,14 +104,13 @@ void MX_TOF_Process(void)
|
|||
|
||||
#ifdef STS_USE_TOF_VL53L0X
|
||||
STS_SENSOR_Power_ON(1);
|
||||
HAL_Delay(100);
|
||||
|
||||
#if defined(TOF_1)||defined(TOF_2)
|
||||
STS_TOF_VL53L0X_Range_Process();
|
||||
#endif
|
||||
#ifdef TOF_3
|
||||
STS_TOF250_Range_Process();
|
||||
#endif
|
||||
|
||||
STS_SENSOR_Power_OFF(1);
|
||||
#endif
|
||||
|
||||
|
@ -127,9 +126,7 @@ void MX_TOF_Process(void)
|
|||
#if defined(YUNHORN_STS_R0_ENABLED)
|
||||
void STS_R0_SENSOR_Read(STS_R0_SensorDataTypeDef *r0_data)
|
||||
{
|
||||
r0_data->distance_mm =0;
|
||||
r0_data->distance1_mm =0;
|
||||
r0_data->distance2_mm =0;
|
||||
|
||||
r0_data->distance_mm = (uint16_t)sts_tof_distance_data[0];
|
||||
r0_data->distance1_mm = (uint16_t)sts_tof_distance_data[1];
|
||||
r0_data->distance2_mm = (uint16_t)sts_tof_distance_data[2];
|
||||
|
@ -141,23 +138,6 @@ void STS_R0_SENSOR_Read(STS_R0_SensorDataTypeDef *r0_data)
|
|||
}
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
STS_TOF_SHORT_RANGE=0,
|
||||
STS_TOF_LONG_RANGE,
|
||||
STS_TOF_LOW_POWER_RANGE,
|
||||
STS_TOF_PP_RANGE
|
||||
} range_mode_t;
|
||||
typedef enum {
|
||||
STS_TOF_VL53L0X=0,
|
||||
STS_TOF_VL53L1X,
|
||||
STS_TOF_VL53L2X,
|
||||
STS_TOF_VL53L3X,
|
||||
STS_TOF_VL53L4X,
|
||||
STS_TOF_VL53L5X,
|
||||
STS_TOF_VL53L6X,
|
||||
STS_TOF_VL53L7X
|
||||
} vl53lx_model;
|
||||
|
||||
uint8_t STS_SENSOR_MEMS_Get_ID(uint8_t *mems_Dev_ID)
|
||||
{
|
||||
uint16_t Id = 0xEEAA; //0xeeaa for VL53L0X
|
||||
|
|
|
@ -354,10 +354,7 @@ void STS_TOF_VL53L0X_Range_Process(void)
|
|||
nSensorPresent = sts_tof_vl53l0x_DetectSensors(); // confirm sensor online
|
||||
APP_LOG(TS_OFF, VLEVEL_H, "\r\n %u pcs sensor(s) online \r\n", nSensorPresent);
|
||||
}
|
||||
sts_tof_distance_data[0] = 666;
|
||||
sts_tof_distance_data[1] = 666;
|
||||
//sts_tof_distance_data[2] = nSensorPresent|(nDevMask<<4);
|
||||
sts_tof_distance_data[2] = nDevMask<<4;
|
||||
|
||||
#ifdef TOF_3
|
||||
sts_tof_distance_data[2] = 0;
|
||||
#endif
|
||||
|
@ -372,7 +369,7 @@ void STS_TOF_VL53L0X_Range_Process(void)
|
|||
{
|
||||
if (VL53L0XDevs[i].Present ==1)
|
||||
{
|
||||
uint8_t rep=0;
|
||||
//uint8_t rep=0;
|
||||
//do {
|
||||
// rep++;
|
||||
status = VL53L0X_PerformSingleRangingMeasurement(&VL53L0XDevs[i], &RangingMeasurementData);
|
||||
|
@ -409,9 +406,9 @@ void STS_TOF_VL53L0X_Range_Process(void)
|
|||
|
||||
} else {
|
||||
// nSensorPresent >0
|
||||
sts_tof_distance_data[0] = 888;
|
||||
sts_tof_distance_data[1] = 888;
|
||||
sts_tof_distance_data[2] = 888;
|
||||
sts_tof_distance_data[0] = 1000;
|
||||
sts_tof_distance_data[1] = 1000;
|
||||
sts_tof_distance_data[2] = 1000;
|
||||
}
|
||||
|
||||
// reset for next ranging
|
||||
|
|
Loading…
Reference in New Issue