|
|
|
@ -592,10 +592,7 @@ void LoRaWAN_Init(void)
|
|
|
|
|
STS_REBOOT_CONFIG_Init();
|
|
|
|
|
|
|
|
|
|
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventRFAC), UTIL_SEQ_RFU, STS_YunhornSTSEventRFAC_Process);
|
|
|
|
|
#ifdef STS_O7
|
|
|
|
|
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), UTIL_SEQ_RFU, STS_YunhornSTSEventP1_Process);
|
|
|
|
|
#endif
|
|
|
|
|
#if 0
|
|
|
|
|
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP2), UTIL_SEQ_RFU, STS_YunhornSTSEventP2_Process);
|
|
|
|
|
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP3), UTIL_SEQ_RFU, STS_YunhornSTSEventP3_Process);
|
|
|
|
|
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP4), UTIL_SEQ_RFU, STS_YunhornSTSEventP4_Process);
|
|
|
|
@ -603,7 +600,7 @@ void LoRaWAN_Init(void)
|
|
|
|
|
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP6), UTIL_SEQ_RFU, STS_YunhornSTSEventP6_Process);
|
|
|
|
|
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP7), UTIL_SEQ_RFU, STS_YunhornSTSEventP7_Process);
|
|
|
|
|
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP8), UTIL_SEQ_RFU, STS_YunhornSTSEventP8_Process);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef YUNHORN_STS_O7_ENABLED
|
|
|
|
|
UTIL_TIMER_Create(&YunhornSTSRSSWakeUpTimer,
|
|
|
|
|
YUNHORN_STS_RSS_WAKEUP_CHECK_TIME,
|
|
|
|
@ -645,7 +642,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
|
|
|
|
|
|
|
|
|
case HALL2_Pin:
|
|
|
|
|
sts_hall2_read = HALL2_STATE;
|
|
|
|
|
// UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), CFG_SEQ_Prio_0);
|
|
|
|
|
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), CFG_SEQ_Prio_0);
|
|
|
|
|
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
@ -785,7 +782,7 @@ static uint8_t PrepareSendTxData(void)
|
|
|
|
|
uint16_t batteryLevelmV = SYS_GetBatteryLevel();
|
|
|
|
|
SysTime_t occupy_check_time = SysTimeGetMcuTime();
|
|
|
|
|
//sensor_t sensor_data;
|
|
|
|
|
STS_OO_SensorStatusDataTypeDef o7_data;
|
|
|
|
|
//STS_OO_SensorStatusDataTypeDef o7_data;
|
|
|
|
|
|
|
|
|
|
STS_PRESENCE_SENSOR_Prepare_Send_Data();
|
|
|
|
|
//STS_PRESENCE_SENSOR_Read(&o7_data);
|
|
|
|
@ -823,7 +820,7 @@ static uint8_t PrepareSendTxData(void)
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.battery_Pct); //02 Battery Level %
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(0xFF & batteryLevelmV >>8); //03 Battery mV MSB
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(0xFF & batteryLevelmV ); //04 Battery mV LSB
|
|
|
|
|
APP_LOG(TS_OFF, VLEVEL_L,"\r\n######| Mode S1 BAT % BAT mV |"
|
|
|
|
|
APP_LOG(TS_OFF, VLEVEL_L,"\r\n######| Mode S1-Open BAT % BAT mV |"
|
|
|
|
|
"\r\n######| %1d | %1d | %2d% | %4d mV|\r\n",
|
|
|
|
|
(char*)sts_work_mode_code[(uint8_t)sts_work_mode], AppData.Buffer[2], AppData.Buffer[3], batteryLevelmV);
|
|
|
|
|
|
|
|
|
@ -838,7 +835,7 @@ static uint8_t PrepareSendTxData(void)
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.state_sensor3_on_off); //05 Sensor head #3 status
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.state_sensor4_on_off); //06 Sensor head #4 status
|
|
|
|
|
APP_LOG(TS_OFF, VLEVEL_L,
|
|
|
|
|
"\r\n######| Color | Mode | S1 | S2 | S3 | S4 |"
|
|
|
|
|
"\r\n######| Color | Mode | S1-Open | S2-Motion | S3-Open | S4 |"
|
|
|
|
|
"\r\n######|%10s | %15s | %1d | %1d | %1d | %1d |\r\n",
|
|
|
|
|
(char*)sts_lamp_color_code[(uint8_t)(AppData.Buffer[0])], (char*)sts_work_mode_code[(uint8_t)AppData.Buffer[1]], AppData.Buffer[2],AppData.Buffer[3], AppData.Buffer[4],AppData.Buffer[5]);
|
|
|
|
|
break;
|
|
|
|
@ -852,8 +849,8 @@ static uint8_t PrepareSendTxData(void)
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(0xFF & batteryLevelmV >>8); //03 Battery mV MSB
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(0xFF & batteryLevelmV ); //04 Battery mV LSB
|
|
|
|
|
APP_LOG(TS_OFF, VLEVEL_L,
|
|
|
|
|
"\r\n######| Color | Mode | S1 | VBAT in mV|"
|
|
|
|
|
"\r\n######|%10s | %15s | %1d | %2d% | %4d mV|\r\n",
|
|
|
|
|
"\r\n######| Color | Mode | S1-Open | VBAT in mV|"
|
|
|
|
|
"\r\n######|%10s | %15s | %1d | %2d% | %4d mV|\r\n",
|
|
|
|
|
(char*)sts_lamp_color_code[(uint8_t)(AppData.Buffer[0])], (char*)sts_work_mode_code[(uint8_t)AppData.Buffer[1]], AppData.Buffer[2],AppData.Buffer[3], batteryLevelmV);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
@ -870,8 +867,8 @@ static uint8_t PrepareSendTxData(void)
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_o7_sensorData.rss_presence_score); //07 LSB score
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_occupancy_overtime_state); //08 occupancy over time or not
|
|
|
|
|
APP_LOG(TS_OFF, VLEVEL_L,
|
|
|
|
|
"\r\n######| Color | Mode | S2 | |Distance(mm) | MotionScore|"
|
|
|
|
|
"\r\n######|%10s | %15s | %1d | %04d | %04d |\r\n",
|
|
|
|
|
"\r\n######| Color | Mode | S2-Motion | |Distance(mm) | MotionScore|"
|
|
|
|
|
"\r\n######|%10s | %15s | %1d | %04d | %04d |\r\n",
|
|
|
|
|
(char*)sts_lamp_color_code[(uint8_t)(AppData.Buffer[0])], (char*)sts_work_mode_code[(uint8_t)AppData.Buffer[1]], AppData.Buffer[2], (uint16_t)sts_o7_sensorData.rss_presence_distance,(uint16_t)sts_o7_sensorData.rss_presence_score);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -893,8 +890,8 @@ static uint8_t PrepareSendTxData(void)
|
|
|
|
|
}
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_occupancy_overtime_state); //11 occupancy over time or not
|
|
|
|
|
APP_LOG(TS_OFF, VLEVEL_L,
|
|
|
|
|
"\r\n######| Color | Mode | S1 | S2 | S3 | S4 |Distance(mm) | MotionScore|"
|
|
|
|
|
"\r\n######|%10s | %15s | %1d | %1d | %1d | %1d | %04d | %04d |\r\n",
|
|
|
|
|
"\r\n######| Color | Mode | S1-Open | S2-Motion | S3-Open | S4 |Distance(mm) | MotionScore|"
|
|
|
|
|
"\r\n######|%10s | %15s | %1d | %1d | %1d | %1d | %04d | %04d |\r\n",
|
|
|
|
|
(char *)sts_lamp_color_code[(uint8_t)(AppData.Buffer[0])], (char*)sts_work_mode_code[AppData.Buffer[1]],AppData.Buffer[2], AppData.Buffer[3],AppData.Buffer[4], AppData.Buffer[5], (uint16_t)sts_o7_sensorData.rss_presence_distance,(uint16_t)sts_o7_sensorData.rss_presence_score);
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|