diff --git a/Core/Src/sts_lamp_bar.c b/Core/Src/sts_lamp_bar.c index d666eca..6c031fc 100644 --- a/Core/Src/sts_lamp_bar.c +++ b/Core/Src/sts_lamp_bar.c @@ -288,7 +288,7 @@ static void STS_Lamp_Bar_Set_RGB_Color_FadeIn(uint8_t red, uint8_t green, uint8_ { if (idx >= start_position) { // the most far tail end, the darker, the most head/first, the brighter - uint8_t rev = idx - fade_len+1; + uint8_t rev = idx - start_position + 1; uint8_t lin = (rev * 0xFF / fade_len); uint8_t bri = (lin * lin) >> 8; @@ -302,7 +302,7 @@ static void STS_Lamp_Bar_Set_RGB_Color_FadeIn(uint8_t red, uint8_t green, uint8_ } - } else { + } else if ((idx < start_position)||(idx > (start_position+fade_len))){ // shorter than tail, set to dark //STS_WS2812B_Set_RGB(red, green, blue, idx); //STS_WS2812B_Set_RGB(0, 0, 0, idx); diff --git a/Core/Src/yunhorn_sts_process.c b/Core/Src/yunhorn_sts_process.c index 38a19e2..184f371 100644 --- a/Core/Src/yunhorn_sts_process.c +++ b/Core/Src/yunhorn_sts_process.c @@ -137,8 +137,8 @@ char sts_presence_fall_detection_message[10][20]={ #endif -//#define STS_COLOR_DEFAULT_VACANT (sts_color_occupy_vacant&0x0f) -//#define STS_COLOR_DEFAULT_OCCUPY ((sts_color_occupy_vacant>>4)&0x0f) +#define STS_COLOR_DEFAULT_VACANT (sts_color_occupy_vacant&0x0f) +#define STS_COLOR_DEFAULT_OCCUPY ((sts_color_occupy_vacant>>4)&0x0f) /* diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c index 20250da..a927b6f 100644 --- a/LoRaWAN/App/lora_app.c +++ b/LoRaWAN/App/lora_app.c @@ -1281,10 +1281,12 @@ if (last_sts_lamp_bar_color != sts_lamp_bar_color) { #if defined(FADEOUT) - if ((sts_rss_result == STS_RESULT_MOTION)||(sts_reed_hall_result == STS_Status_Door_Close )) { + if ((sts_rss_result == STS_RESULT_MOTION)) //||(sts_reed_hall_result == STS_Status_Door_Close )) + { STS_Lamp_Bar_Set_STS_RGB_Color_FadeOut(sts_lamp_bar_color, luminance_level, LED_COUNT/2); - } else if ((sts_rss_result == STS_RESULT_NO_MOTION)||(sts_reed_hall_result == STS_Status_Door_Open )){ + } else //if ((sts_rss_result == STS_RESULT_NO_MOTION)||(sts_reed_hall_result == STS_Status_Door_Open )){ + { STS_Lamp_Bar_Set_STS_RGB_Color_FadeIn(sts_lamp_bar_color, luminance_level, LED_COUNT/2); } #else diff --git a/STM32CubeIDE/.cproject b/STM32CubeIDE/.cproject index e7876b0..68a2ceb 100644 --- a/STM32CubeIDE/.cproject +++ b/STM32CubeIDE/.cproject @@ -154,6 +154,7 @@