|
|
|
@ -905,25 +905,31 @@ static void SendTxData(void)
|
|
|
|
|
|
|
|
|
|
UTIL_TIMER_Time_t nextTxIn = 0;
|
|
|
|
|
uint8_t i = 0;
|
|
|
|
|
APP_LOG(TS_OFF, VLEVEL_L, "\r\n\n\n**** heart_beat timer =%2u \r\n**** sensor_data_ready=%2u\r\n",
|
|
|
|
|
heart_beat_timer, sensor_data_ready);
|
|
|
|
|
|
|
|
|
|
if (LmHandlerIsBusy() == false)
|
|
|
|
|
if (LmHandlerIsBusy() != false){
|
|
|
|
|
APP_LOG(TS_OFF, VLEVEL_L, "\r\n\n\n** ** LmHandlerIsBusy ** **\r\n\n\n");
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
AppData.Port = LORAWAN_USER_APP_PORT;
|
|
|
|
|
//AppData.Buffer[i++] = AppLedStateOn; //#01
|
|
|
|
|
STS_PRESENCE_SENSOR_Prepare_Send_Data();
|
|
|
|
|
|
|
|
|
|
if ((heart_beat_timer != 0L)) // sensor data OVERWRITE heart-beat message, 2024-05-12
|
|
|
|
|
{
|
|
|
|
|
heart_beat_timer=0;
|
|
|
|
|
AppData.Port = sts_sendhtbtport; //LORAWAN_USER_APP_PORT+1;
|
|
|
|
|
AppData.Buffer[i++]= AppLedStateOn|0x80;
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(99*batteryLevel/254)&0xff; //#05
|
|
|
|
|
|
|
|
|
|
} else if ((upload_message_timer != 0U)||(sensor_data_ready!= 0U)) //sensor_data_ready for manual push button-1 trigger)
|
|
|
|
|
{
|
|
|
|
|
//AppData.Buffer[i++] = AppLedStateOn;
|
|
|
|
|
|
|
|
|
|
sensor_data_ready =0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AppData.Buffer[i++] = AppLedStateOn;
|
|
|
|
|
//i = PrepareSendTxData();
|
|
|
|
|
STS_PRESENCE_SENSOR_Prepare_Send_Data();
|
|
|
|
|
//STS_PRESENCE_SENSOR_Prepare_Send_Data();
|
|
|
|
|
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sts_o7_sensorData.lamp_bar_color)&0xff; //01
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sts_o7_sensorData.workmode)&0xff; //02 WORK MODE
|
|
|
|
@ -934,21 +940,34 @@ static void SendTxData(void)
|
|
|
|
|
#if 1
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sts_o7_sensorData.state_sensor4_on_off)&0xff; //06 Sensor head #4 status
|
|
|
|
|
#endif
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sts_o7_sensorData.state_sensor4_on_off)&0xff; //06 Sensor head #4 status
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sts_o7_sensorData.state_sensor4_on_off)&0xff; //06 Sensor head #4 status
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sts_o7_sensorData.state_sensor4_on_off)&0xff; //06 Sensor head #4 status
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sts_o7_sensorData.state_sensor1_on_off)&0xff; //06 Sensor head #4 status
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sts_o7_sensorData.state_sensor2_on_off)&0xff; //06 Sensor head #4 status
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sts_o7_sensorData.state_sensor3_on_off)&0xff; //06 Sensor head #4 status
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sts_o7_sensorData.state_sensor4_on_off)&0xff; //06 Sensor head #4 status
|
|
|
|
|
//if (o7_data.state_sensor2_on_off != 0)
|
|
|
|
|
// REF: AppData.Buffer[i++] = (uint8_t)(r0_data.distance_mm >>8)&0xff; //#05
|
|
|
|
|
// REF: AppData.Buffer[i++] = (uint8_t)(r0_data.distance_mm)&0xff;
|
|
|
|
|
//{
|
|
|
|
|
#if 0
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sts_o7_sensorData.state_sensor1_on_off)&0xff; //06 Sensor head #4 status
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sts_o7_sensorData.state_sensor2_on_off)&0xff; //06 Sensor head #4 status
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sts_o7_sensorData.state_sensor3_on_off)&0xff; //06 Sensor head #4 status
|
|
|
|
|
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sts_o7_sensorData.state_sensor4_on_off)&0xff; //06 Sensor head #4 status
|
|
|
|
|
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sts_o7_sensorData.state_sensor1_on_off)&0xff; //06 Sensor head #4 status
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sts_o7_sensorData.state_sensor2_on_off)&0xff; //06 Sensor head #4 status
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sts_o7_sensorData.state_sensor3_on_off)&0xff; //06 Sensor head #4 status
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sts_o7_sensorData.state_sensor4_on_off)&0xff; //06 Sensor head #4 status
|
|
|
|
|
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sts_o7_sensorData.fall_state)&0xff; //06 Sensor head #4 status
|
|
|
|
|
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sts_o7_sensorData.rss_presence_distance>>8)&0xff; //07 MSB distance
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sts_o7_sensorData.rss_presence_distance)&0xff; //08 LSB distance
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sts_o7_sensorData.rss_presence_distance)&0xff; //08 LSB distance
|
|
|
|
|
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sts_o7_sensorData.rss_presence_score>>8)&0xff; //09 MSB score
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sts_o7_sensorData.rss_presence_score>>8)&0xff; //09 MSB score
|
|
|
|
|
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sts_o7_sensorData.rss_presence_score)&0xff; //10 LSB score
|
|
|
|
|
AppData.Buffer[i++] = (uint8_t)(sts_o7_sensorData.rss_presence_score)&0xff; //10 LSB score
|
|
|
|
|
//}
|
|
|
|
|
#endif
|
|
|
|
|
#if 0
|
|
|
|
@ -972,10 +991,6 @@ static void SendTxData(void)
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
heart_beat_timer=0;
|
|
|
|
|
sensor_data_ready =0;
|
|
|
|
|
upload_message_timer =0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AppData.BufferSize = (sts_service_mask > STS_SERVICE_MASK_L1? 0:i);
|
|
|
|
|
|
|
|
|
|