diff --git a/Core/Src/main.c b/Core/Src/main.c index 0514649..6393797 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -27,9 +27,10 @@ #include "dma.h" #include "usart.h" #include "sys_app.h" +#ifdef STS_P2 #include "app_tof.h" #include "app_tof_peoplecount.h" - +#endif /* USER CODE END Includes */ /* Private typedef -----------------------------------------------------------*/ @@ -103,7 +104,6 @@ int main(void) MX_LoRaWAN_Init(); /* USER CODE BEGIN 2 */ - APP_LOG(TS_OFF, VLEVEL_M, "\n\n --- STS_RR --- APP LOG --- \n\n"); /* USER CODE END 2 */ /* Infinite loop */ diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c index 81d71ef..d99f177 100644 --- a/LoRaWAN/App/lora_app.c +++ b/LoRaWAN/App/lora_app.c @@ -734,8 +734,7 @@ static void SendTxData(void) UTIL_TIMER_Time_t nextTxIn = 0; #ifdef STS_P2 sts_people_count_sensor_data_t sts_p2_sensor_data={0x0}; -#endif -#if defined(STS_R1)||defined(STS_R1D)||defined(STS_R2)||defined(STS_R5) +#elif defined(STS_R1)||defined(STS_R1D)||defined(STS_R2)||defined(STS_R5) sts_tof_range_data_t sts_rr_sensor_data={0x0,0x0,0x0}; #endif @@ -756,9 +755,11 @@ static void SendTxData(void) #endif /* CAYENNE_LPP */ EnvSensors_Read(&sensor_data); + #ifdef VL53LX STS_people_count_sensor_Read(&sts_p2_sensor_data); #endif + #ifdef VL53L0 STS_YunhornSTSEventP4_Process(); STS_RR_Sensor_Read(&sts_rr_sensor_data); @@ -772,7 +773,7 @@ static void SendTxData(void) AppData.Port = YUNHORN_STS_R5_LORA_APP_DATA_PORT; /* STS-R5 Data Port */ #endif -#endif +#endif //VL53L0 AppData.Buffer[i++] = AppLedStateOn; AppData.Buffer[i++] = (uint8_t) sts_mtmcode1; @@ -790,6 +791,7 @@ static void SendTxData(void) #ifdef STS_P2 AppData.Port = 106; /* STS-P2 Data Port */ #endif + #ifdef CAYENNE_LPP CayenneLppReset(); CayenneLppAddBarometricPressure(channel++, sensor_data.pressure); @@ -842,27 +844,24 @@ static void SendTxData(void) AppData.Buffer[i++] = (uint8_t)((altitudeGps >> 8) & 0xFF); AppData.Buffer[i++] = (uint8_t)(altitudeGps & 0xFF); } -#endif + +#endif //if 0 + +#endif /* CAYENNE_LPP */ #ifdef VL53L0 //VL53L0 -#if defined(STS_R1)||defined(STS_R5) + +#if (defined(STS_R1)||defined(STS_R5)) AppData.Buffer[i++] = 2; AppData.Buffer[i++] = (uint8_t)(sts_rr_sensor_data.tof_1_distance_mm >>8 & 0xFF); AppData.Buffer[i++] = (uint8_t)(sts_rr_sensor_data.tof_1_distance_mm & 0xFF); -#else ifdef STS_R1D +#elif defined(STS_R1D) AppData.Buffer[i++] = 4; AppData.Buffer[i++] = (uint8_t)(sts_rr_sensor_data.tof_1_distance_mm >>8 & 0xFF); AppData.Buffer[i++] = (uint8_t)(sts_rr_sensor_data.tof_1_distance_mm & 0xFF); AppData.Buffer[i++] = (uint8_t)(sts_rr_sensor_data.tof_2_distance_mm >>8 & 0xFF); AppData.Buffer[i++] = (uint8_t)(sts_rr_sensor_data.tof_2_distance_mm & 0xFF); -#endif - -#ifdef STS_R5_EXT - AppData.Buffer[i++] = (uint8_t)(sts_rr_sensor_data.tof_3_distance_mm >>8 & 0xFF); - AppData.Buffer[i++] = (uint8_t)(sts_rr_sensor_data.tof_3_distance_mm & 0xFF); -#endif - -#if defined(STS_R5_EXT) +#elif defined(STS_R5_EXT) AppData.Buffer[i++] = (uint8_t)(sts_rr_sensor_data.tof_3_distance_mm >>8 & 0xFF); AppData.Buffer[i++] = (uint8_t)(sts_rr_sensor_data.tof_3_distance_mm & 0xFF); #endif @@ -897,7 +896,7 @@ static void SendTxData(void) AppData.BufferSize = i; -#endif /* CAYENNE_LPP */ + if ((JoinLedTimer.IsRunning) && (LmHandlerJoinStatus() == LORAMAC_HANDLER_SET)) { diff --git a/STM32CubeIDE/.cproject b/STM32CubeIDE/.cproject index b4652aa..70b80db 100644 --- a/STM32CubeIDE/.cproject +++ b/STM32CubeIDE/.cproject @@ -134,8 +134,7 @@