diff --git a/Core/Inc/main.h b/Core/Inc/main.h index d91145d..e8c2fa6 100644 --- a/Core/Inc/main.h +++ b/Core/Inc/main.h @@ -60,17 +60,22 @@ void Error_Handler(void); #define RTC_N_PREDIV_S 10 #define RTC_PREDIV_S ((1<BufferSize == 1) @@ -555,7 +556,7 @@ static void OnRxData(LmHandlerAppData_t *appData, LmHandlerRxParams_t *params) } } break; - case LORAWAN_USER_APP_CTRL_PORT: + case YUNHORN_STS_USER_APP_CTRL_PORT: if (appData->BufferSize != 1) { if (appData->BufferSize < 128) { @@ -594,7 +595,7 @@ void STS_SENSOR_Upload_Message(uint8_t appDataPort, uint8_t appBufferSize, uint8 } AppData.Port = appDataPort; - AppData.BufferSize = (sts_service_mask >1?0:appBufferSize); + AppData.BufferSize = appBufferSize; if ((JoinLedTimer.IsRunning) && (LmHandlerJoinStatus() == LORAMAC_HANDLER_SET)) { diff --git a/LoRaWAN/App/lora_app.h b/LoRaWAN/App/lora_app.h index 30fb5b4..9cea185 100644 --- a/LoRaWAN/App/lora_app.h +++ b/LoRaWAN/App/lora_app.h @@ -57,7 +57,7 @@ extern "C" { * LoRaWAN User application port * @note do not use 224. It is reserved for certification */ -#define LORAWAN_USER_APP_PORT 2 +#define LORAWAN_USER_APP_PORT 106 /*! * LoRaWAN Switch class application port diff --git a/STS/Core/Src/yunhorn_sts_process.c b/STS/Core/Src/yunhorn_sts_process.c index 15c08e8..ac90b55 100644 --- a/STS/Core/Src/yunhorn_sts_process.c +++ b/STS/Core/Src/yunhorn_sts_process.c @@ -487,6 +487,7 @@ void STS_O5_SENSOR_Read(STS_OO_SensorDataTypeDef *oo_data) void USER_APP_Parse_CMD_P(uint8_t *parse_buffer, uint8_t parse_buffer_size) { uint8_t pbuf[128]={0x0}, i=0, pbuf_size=parse_buffer_size&0x7F; + uint8_t invalid_flag = 1; UTIL_MEM_cpy_8((void*)pbuf,(void*)parse_buffer, pbuf_size); /* 127 BYTES MAX */ if (((char)pbuf[CFG_CMD1] == 'P') && (pbuf_size >= 3)) // BEGIN OF PARAMETER CONFIG @@ -503,7 +504,7 @@ void USER_APP_Parse_CMD_P(uint8_t *parse_buffer, uint8_t parse_buffer_size) case '0': //default sensor head or MEMS component case '1': //first sensor head or MEMS component - mems_ver = (uint8_t)(pbuf[CFG_CMD3]-0x30); + uint8_t mems_ver = (uint8_t)(pbuf[CFG_CMD3]-0x30); uint8_t j=0; if (mems_ver == sts_version) diff --git a/STS/TOF/App/app_tof.c b/STS/TOF/App/app_tof.c index f92c8a0..3e1c49b 100644 --- a/STS/TOF/App/app_tof.c +++ b/STS/TOF/App/app_tof.c @@ -47,8 +47,9 @@ volatile uint8_t ToF_EventDetected = 0; /* Private function prototypes -----------------------------------------------*/ +uint8_t sts_vl53lx_ranging(uint16_t *ranged_distance, uint8_t range_mode, uint16_t distance_threshold_mm, + uint16_t inter_measurement_ms, uint16_t macro_timing,uint16_t roi_width, uint16_t sigma_mm, uint16_t signal_kcps); -uint8_t sts_vl53lx_ranging(uint8_t vl_model, uint8_t range_mode, uint16_t distance_threshold_mm, uint16_t inter_measurement_ms, uint16_t macro_timing,uint16_t roi_width, uint16_t sigma_mm, uint16_t signal_kcps); uint8_t IsInterruptDetected(uint16_t dev); void STS_TOF_VL53LX_Range_Process(uint8_t range_mode, uint16_t *range_distance); @@ -117,11 +118,11 @@ uint8_t IsInterruptDetected(uint16_t dev) void STS_TOF_VL53LX_Range_Process(uint8_t range_mode, uint16_t *range_distance) { - uint8_t vl53lx_model = STS_TOF_VL53L1X; + //uint8_t vl53lx_model = STS_TOF_VL53L1X; //uint8_t range_mode = STS_TOF_SHORT_RANGE; uint16_t i_distance_measured = 0; uint16_t i_distance_threshold_mm = 800; - uint16_t i_inter_measurement_ms, i_macro_timing; + uint16_t i_inter_measurement_ms=100, i_macro_timing=33; uint16_t i_roi_width=16, i_sigma_mm=30, i_signal_kcps=2000; switch (range_mode) diff --git a/STS/TOF/App/app_tof.h b/STS/TOF/App/app_tof.h index 290fb10..89c3c10 100644 --- a/STS/TOF/App/app_tof.h +++ b/STS/TOF/App/app_tof.h @@ -27,7 +27,7 @@ #endif /* Includes ------------------------------------------------------------------*/ - +#include "main.h" /* Exported defines ----------------------------------------------------------*/ /* Exported functions --------------------------------------------------------*/