diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c index 98893dd..41eacca 100644 --- a/LoRaWAN/App/lora_app.c +++ b/LoRaWAN/App/lora_app.c @@ -64,6 +64,7 @@ volatile uint8_t PIRValue =0, prev_sts_pir_state=0, sts_pir_state_changed=0; extern volatile uint8_t sts_tof_presence_state; uint32_t lowIn=0; volatile bool lockLow = true, takeLowTime; +extern volatile int sts_tof_init_status; #endif static uint32_t sts_warm_up_count = 0; @@ -1282,11 +1283,12 @@ static void SendTxData(void) sensor_data_ready = 0; #if defined(STS_T6) - AppData.Buffer[i++] = 4; + AppData.Buffer[i++] = 5; AppData.Buffer[i++] = (uint8_t)((sts_t6_sensor_data.tof_range_presence_state & 0xFF)); AppData.Buffer[i++] = (uint8_t)((sts_t6_sensor_data.pir_motion_sensor_state & 0xFF)); AppData.Buffer[i++] = (uint8_t)((sts_t6_sensor_data.lamp_bar_color & 0xFF)); AppData.Buffer[i++] = (uint8_t)((sts_t6_sensor_data.tof_presence_distance_dm & 0xFF)); + AppData.Buffer[i++] = (uint8_t)((int16_t)(sensor_data.temperature) & 0xFF); #endif //STS_T6 @@ -1821,10 +1823,15 @@ static void OnYunhornSTSHeartBeatTimerEvent(void *context) appHeartBeatDataPort = YUNHORN_STS_M1_LORA_APP_HTBT_PORT; #endif - appHeartBeatBufferSize = 2; + appHeartBeatBufferSize = 3; appHeartBeatDataBuffer[0]=(uint8_t)(0x80|AppLedStateOn); appHeartBeatDataBuffer[1]=(uint8_t)(SYS_GetBatteryLevel()/100); //TODO XXX change to battery level in mV - //APP_LOG(TS_OFF, VLEVEL_M, "\n\n HEART-BEAT TIMER = %d\n\n", rfac_timer); + + float TEMPERATURE_Value = (SYS_GetTemperatureLevel() >> 8); + APP_LOG(TS_OFF, VLEVEL_M, "\r\n\n ### ### ### BOARD TEMPERATURE = %3d C\r\n", (int16_t)(TEMPERATURE_Value)); + appHeartBeatDataBuffer[2]=(uint8_t)((int16_t)TEMPERATURE_Value)&0xff; + + STS_SENSOR_Upload_Message(appHeartBeatDataPort, appHeartBeatBufferSize, (uint8_t*)appHeartBeatDataBuffer); #endif diff --git a/STM32CubeIDE/.cproject b/STM32CubeIDE/.cproject index d3e8e63..11de623 100644 --- a/STM32CubeIDE/.cproject +++ b/STM32CubeIDE/.cproject @@ -126,6 +126,7 @@