From 8ee3ed85966cedf8943c6a540e669f01aedb4d04 Mon Sep 17 00:00:00 2001 From: YunHorn Technology Date: Tue, 23 Jul 2024 16:38:16 +0800 Subject: [PATCH] --- revised zero pulse and one pulse --- Core/Src/sts_lamp_bar.c | 8 +++++--- LoRaWAN/App/lora_app.c | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Core/Src/sts_lamp_bar.c b/Core/Src/sts_lamp_bar.c index 500bc9f..afdf6d9 100644 --- a/Core/Src/sts_lamp_bar.c +++ b/Core/Src/sts_lamp_bar.c @@ -28,11 +28,11 @@ #include "yunhorn_sts_sensors.h" -#define ONE_PULSE (36) +#define ONE_PULSE (40) //36 #define ZERO_PULSE (20) #define LED_DATA_LEN 24 -#define WS2812B_DATA_LEN (24 * STS_LAMP_BAR_LED_NUM+1) +#define WS2812B_DATA_LEN (24 * (STS_LAMP_BAR_LED_NUM+1)) #define RESET_PULSE (24) //(80) TO FIX DARK_COLOR AND SM2 @@ -101,8 +101,10 @@ void STS_Lamp_Bar_Set_Dark(void) void STS_WS2812B_Refresh(void) { + STS_WS2812B_Set_RGB(0,0,0,STS_LAMP_BAR_LED_NUM ); + __disable_irq(); - HAL_TIM_PWM_Start_DMA(&STS_LAMP_BAR_HTIM, STS_LAMP_BAR_TIM_CHANNEL, (uint32_t *)&rgb_buf, (uint16_t)(sizeof(rgb_buf))); + HAL_TIM_PWM_Start_DMA(&STS_LAMP_BAR_HTIM, STS_LAMP_BAR_TIM_CHANNEL, (uint32_t *)rgb_buf.GRB, (uint16_t)(sizeof(rgb_buf.GRB))); __enable_irq(); //HAL_TIM_PWM_Start_IT(&STS_LAMP_BAR_HTIM, STS_LAMP_BAR_TIM_CHANNEL); } diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c index 32c96bb..7ede9d4 100644 --- a/LoRaWAN/App/lora_app.c +++ b/LoRaWAN/App/lora_app.c @@ -72,7 +72,7 @@ extern volatile uint32_t event_start_time, event_stop_time; extern volatile uint16_t sts_unconscious_threshold; volatile uint8_t sts_occupancy_overtime_state = 0; volatile uint8_t sts_presence_fall_detection=TRUE; -volatile uint32_t SamplingPeriodicity = 2000; //unit ms +volatile uint32_t SamplingPeriodicity = 1000; //unit ms volatile uint32_t HeartBeatPeriodicity = 120000; //unit ms volatile uint8_t STS_LoRa_WAN_Joined = 0; volatile uint8_t mems_int1_detected = 0;