From 19fdbd04406cd6760904f9ef21e799916f7584c2 Mon Sep 17 00:00:00 2001 From: YunHorn Technology Date: Wed, 30 Oct 2024 18:50:44 +0800 Subject: [PATCH] refine STS_R5 --- LoRaWAN/App/lora_app.c | 21 +- STM32CubeIDE/.cproject | 2 +- .../Release/Application/User/Core/subdir.mk | 40 +- .../Application/User/LoRaWAN/App/subdir.mk | 8 +- .../Application/User/LoRaWAN/Target/subdir.mk | 2 +- .../Application/User/STS/Core/Src/subdir.mk | 6 +- .../Application/User/STS/TOF/App/subdir.mk | 6 +- .../Application/User/STS/TOF/Target/subdir.mk | 2 +- .../User/STS/TOF/vl53l0x/subdir.mk | 14 +- STM32CubeIDE/Release/Drivers/CMSIS/subdir.mk | 2 +- .../Drivers/STM32WLxx_HAL_Driver/subdir.mk | 48 +- .../Release/Middlewares/LoRaWAN/subdir.mk | 66 +- .../Release/Middlewares/SubGHz_Phy/subdir.mk | 6 +- STM32CubeIDE/Release/Utilities/subdir.mk | 16 +- STM32CubeIDE/Release/WLE5CC_NODE_STS.elf | Bin 168204 -> 168204 bytes STS/Core/Src/yunhorn_sts_process.c | 4 +- STS/TOF/App/app_tof_vl53l0x_range.c | 10 +- hk_as923_decoder.js | 1398 +++++++++++------ 18 files changed, 1029 insertions(+), 622 deletions(-) diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c index 3836561..957c9af 100644 --- a/LoRaWAN/App/lora_app.c +++ b/LoRaWAN/App/lora_app.c @@ -45,7 +45,7 @@ /* External variables ---------------------------------------------------------*/ /* USER CODE BEGIN EV */ uint8_t outbuf[128]={0x0}; -extern volatile uint8_t sts_ac_code[20]; +extern volatile uint8_t sts_ac_code[20], sts_service_mask; extern volatile sts_cfg_nvm_t sts_cfg_nvm; extern volatile uint32_t rfac_timer; extern volatile uint32_t STS_TOFScanPeriod_msec, STS_TxPeriod_sec, STS_HeartBeatTimerPeriod_sec; @@ -807,9 +807,9 @@ static void SendTxData(void) #endif #ifdef VL53L0 - STS_YunhornSTSEventP4_Process(); + //STS_YunhornSTSEventP4_Process(); STS_RR_Sensor_Read(&sts_rr_sensor_data); - APP_LOG(TS_OFF, VLEVEL_M, "\r\n VL53L0 sensor data read \r\n"); + APP_LOG(TS_OFF, VLEVEL_H, "\r\n VL53L0 sensor data read \r\n"); #ifdef STS_R1 AppData.Port = YUNHORN_STS_R1_LORA_APP_DATA_PORT; /* STS-R1 Data Port */ @@ -836,7 +836,7 @@ static void SendTxData(void) AppData.Buffer[i++] = (uint8_t) sts_hardware_ver; AppData.Buffer[i++] = (uint8_t) 99*batteryLevel/254; -#if 1 +#if 0 APP_LOG(TS_ON, VLEVEL_M, "VDDA: %d\r\n", batteryLevel); APP_LOG(TS_ON, VLEVEL_M, "temp: %d\r\n", (int16_t)(sensor_data.temperature)); @@ -985,7 +985,8 @@ static void SendTxData(void) AppData.Buffer[i++] = (uint8_t)(sts_m1_sensor_data.on_off_event & 0xFF); #endif //STS_M1 - AppData.BufferSize = i; + + AppData.BufferSize = i&(~sts_service_mask); if ((JoinLedTimer.IsRunning) && (LmHandlerJoinStatus() == LORAMAC_HANDLER_SET)) { @@ -1029,7 +1030,7 @@ static void OnTxTimerEvent(void *context) #elif defined(STS_M1) UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), CFG_SEQ_Prio_0); #elif (defined(STS_R1D)||defined(STS_R5)||defined(STS_R1)) - APP_LOG(TS_OFF, VLEVEL_M, "\nSET TASK P4\r\n"); + APP_LOG(TS_OFF, VLEVEL_H, "\nSET TASK P4\r\n"); UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP4), CFG_SEQ_Prio_0); #endif @@ -1109,10 +1110,14 @@ static void OnJoinRequest(LmHandlerJoinParams_t *joinParams) APP_LOG(TS_OFF, VLEVEL_M, "OTAA =====================\r\n"); } AppData.Port = 1; - AppData.BufferSize = 10; + AppData.BufferSize = 16; //AppData.Buffer[0]=0x38; //AppData.Buffer[1]=0x38; - UTIL_MEM_cpy_8((uint8_t*)AppData.Buffer, "YUNHORN168", 10); + //UTIL_MEM_cpy_8((uint8_t*)AppData.Buffer, (uint8_t *)"YUNHORN " + (uint8_t*)YUNHORN_STS_PRD_STRING, 16); + //UTIL_MEM_cpy_8((uint8_t*)AppData.Buffer, (uint8_t *)"YUNHORN ", 8); + UTIL_MEM_cpy_8((uint8_t*)AppData.Buffer, (uint8_t *)"YUNHORN168", 10); + UTIL_MEM_cpy_8((uint8_t*)AppData.Buffer+10, (uint8_t *)(uint8_t*)YUNHORN_STS_PRD_STRING, sizeof(YUNHORN_STS_PRD_STRING)); + AppData.BufferSize = sizeof(YUNHORN_STS_PRD_STRING)+10; LmHandlerParams.IsTxConfirmed = true; LmHandlerErrorStatus_t status = LmHandlerSend(&AppData, LmHandlerParams.IsTxConfirmed, false); if (status ==LORAMAC_HANDLER_SUCCESS ) LmHandlerParams.IsTxConfirmed = false; diff --git a/STM32CubeIDE/.cproject b/STM32CubeIDE/.cproject index f6d209d..43ffa57 100644 --- a/STM32CubeIDE/.cproject +++ b/STM32CubeIDE/.cproject @@ -134,8 +134,8 @@