diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c index b41c8c6..f4e4058 100644 --- a/LoRaWAN/App/lora_app.c +++ b/LoRaWAN/App/lora_app.c @@ -672,7 +672,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) { case BUT1_Pin: /* Note: when "EventType == TX_ON_TIMER" this GPIO is not initialized */ - HAL_Delay(250); + HAL_Delay(100); __HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin); //__HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin); sts_hall1_read = HALL1_STATE; diff --git a/STM32CubeIDE/Release/WLE5CC_NODE_STS.bin b/STM32CubeIDE/Release/WLE5CC_NODE_STS.bin index 7a2b48d..7eb9c00 100644 Binary files a/STM32CubeIDE/Release/WLE5CC_NODE_STS.bin and b/STM32CubeIDE/Release/WLE5CC_NODE_STS.bin differ diff --git a/STM32CubeIDE/Release/WLE5CC_NODE_STS.elf b/STM32CubeIDE/Release/WLE5CC_NODE_STS.elf index e6a5efc..02eb09f 100644 Binary files a/STM32CubeIDE/Release/WLE5CC_NODE_STS.elf and b/STM32CubeIDE/Release/WLE5CC_NODE_STS.elf differ diff --git a/STS/Core/Src/yunhorn_sts_process.c b/STS/Core/Src/yunhorn_sts_process.c index 4ea72e3..ade1f3c 100644 --- a/STS/Core/Src/yunhorn_sts_process.c +++ b/STS/Core/Src/yunhorn_sts_process.c @@ -231,7 +231,7 @@ volatile uint8_t sts_water_leakage_changed_flag=0; volatile uint8_t sts_reed_hall_1_result=STS_Status_Door_Open, sts_reed_hall_2_result=STS_Status_SOS_Release; volatile uint8_t sts_reed_hall_3_result, sts_reed_hall_4_result; volatile uint8_t sts_fhmos_result=STS_FHMOS_FALL_STATE_NO_OCCUPY; -volatile uint8_t sts_fhmos_bitmap_pending=0; +volatile uint8_t sts_fhmos_bitmap_pending=FHMOS_BITMAP_BLANK; #endif @@ -559,7 +559,7 @@ void STS_YunhornSTSEventP5_Process(void) } #if 1 - if (sts_fhmos_bitmap_pending == 1) + if (sts_fhmos_bitmap_pending == FHMOS_BITMAP_GENERATED) { APP_LOG(TS_OFF, VLEVEL_M, "\r\n Upload Fall Gesture Type 2 \r\n"); STS_FHMOS_sensor_upload_map(0x02); @@ -2040,7 +2040,7 @@ void STS_FHMOS_sensor_upload_map(uint8_t map_index) APP_LOG(TS_OFF, VLEVEL_M, "\r\n Bitmap uploading, size=%02x\r\n", i); STS_SENSOR_Upload_Message(YUNHORN_STS_L8_LORA_APP_DATA_PORT, i, (uint8_t *)tstbuf); - sts_fhmos_bitmap_pending = 2; + sts_fhmos_bitmap_pending = FHMOS_BITMAP_FINISHED; // 2; APP_LOG(TS_OFF, VLEVEL_M, "\r\n +++++++++++++++++++++++ \r\nBitmap Pending uploaded\r\n"); } #endif @@ -2544,7 +2544,7 @@ void YunhornSTSDurationCheckTimer(void) over_threshold |= 1<<6; // upload state confirm message - if (sts_fhmos_bitmap_pending == 0) + if (sts_fhmos_bitmap_pending == FHMOS_BITMAP_BLANK) { //APP_LOG(TS_OFF, VLEVEL_M, "\r\nGenerate Fall Gesture Map\r\n"); UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0); @@ -2596,7 +2596,7 @@ void YunhornSTSDurationCheckTimer(void) if (STS_Status_Door_Close == sts_hall1_read) fhmos_data.state_fall = STS_FHMOS_FALL_STATE_NORMAL; // 2025 04 18 fhmos_data.state_fall_released = 1; - sts_fhmos_bitmap_pending = 0; + sts_fhmos_bitmap_pending = FHMOS_BITMAP_BLANK; over_threshold &= ~0x40; over_threshold &= ~0x80; diff --git a/STS/TOF/App/app_tof.c b/STS/TOF/App/app_tof.c index 99e8697..89f15e8 100644 --- a/STS/TOF/App/app_tof.c +++ b/STS/TOF/App/app_tof.c @@ -425,7 +425,7 @@ void sts_generate_fall_gesture_map(void) printf("%02X\r\n",fhmos_gesture_bitmap[i]); #endif - sts_fhmos_bitmap_pending = 1; + sts_fhmos_bitmap_pending = FHMOS_BITMAP_GENERATED; APP_LOG(TS_OFF, VLEVEL_L, "\r\n Fall Gesture bitmap Generated\r\n"); } uint16_t MX_TOF_Ranging_Process(void) @@ -716,7 +716,7 @@ static void print_result(RANGING_SENSOR_Result_t *Result) } else if ((head_distance_from_ceiling < (factor2_head_level_from_floor - 150))) // TODO XXX 50mm gap to avoid flapping back and forth { sts_head_level_low = 0; - sts_fhmos_bitmap_pending = 0; + sts_fhmos_bitmap_pending = FHMOS_BITMAP_BLANK; to_confirm = 0; } diff --git a/STS/TOF/App/app_tof.h b/STS/TOF/App/app_tof.h index fd86d1e..3da9110 100644 --- a/STS/TOF/App/app_tof.h +++ b/STS/TOF/App/app_tof.h @@ -55,6 +55,11 @@ typedef enum { STS_TOF_VL53L7X } vl53lx_model; +typedef enum { + FHMOS_BITMAP_BLANK=0, + FHMOS_BITMAP_GENERATED, + FHMOS_BITMAP_FINISHED +} fhmos_bitmap_state; #ifdef __cplusplus }