diff --git a/Core/Inc/main.h b/Core/Inc/main.h index 2ce8c2d..6835a52 100644 --- a/Core/Inc/main.h +++ b/Core/Inc/main.h @@ -141,7 +141,7 @@ void Error_Handler(void); /* * STM32WL55, STM32WLE5 Clock=48Mhz 48,000,000/800khz = 60 */ -#define STS_LAMP_BAR_PWM_TIM_PERIOD (240 - 1) +#define STS_LAMP_BAR_PWM_TIM_PERIOD (120 - 1) #define STS_LAMP_BAR_HTIM htim1 #define STS_LAMP_BAR_LED_NUM (60) //60 for 46CM length LED strip #define LED_COUNT 18 // for 30 cm lamp bar diff --git a/Core/Src/sts_lamp_bar.c b/Core/Src/sts_lamp_bar.c index 35b99bf..041eacf 100644 --- a/Core/Src/sts_lamp_bar.c +++ b/Core/Src/sts_lamp_bar.c @@ -33,7 +33,7 @@ #define LED_DATA_LEN 24 #define WS2812B_DATA_LEN (LED_DATA_LEN * (STS_LAMP_BAR_LED_NUM)) -#define RESET_PULSE (24) //(80) TO FIX DARK_COLOR AND SM2 +#define RESET_PULSE (150) //(80) TO FIX DARK_COLOR AND SM2 typedef struct ws2812b_e { @@ -132,9 +132,10 @@ void STS_Lamp_Bar_Scoller(uint8_t color, uint8_t lum_level) { STS_Lamp_Bar_Set_Dark(); - for(uint8_t i = 0; i= start_position) { // the most far tail end, the darker, the most head/first, the brighter - uint8_t rev = idx - fade_len ; + uint8_t rev = idx - fade_len+1; uint8_t lin = (rev * 0xFF / fade_len); uint8_t bri = (lin * lin) >> 8; @@ -364,24 +364,30 @@ void STS_Lamp_Bar_Self_Test_Fade(void) for (color=STS_GREEN; color < STS_COLOR_MAX; color++) { - lum_level = 10; - do { + lum_level = 250; + //do { + APP_LOG(TS_OFF, VLEVEL_M, "\rFade Out %04d\r", lum_level); STS_Lamp_Bar_Set_STS_RGB_Color_FadeOut(color, lum_level, LED_COUNT/2); - HAL_Delay(100); - lum_level += 10; - } while (lum_level < 99); - STS_Lamp_Bar_Set_Dark(); + + HAL_Delay(2000); + //lum_level += 5; + //} while (lum_level < 200); + //STS_Lamp_Bar_Set_Dark(); + STS_Lamp_Bar_Refresh(); } APP_LOG(TS_OFF, VLEVEL_M, "\r\n [#1] RGB Space Fade In Testing Start\r\n"); for (color=STS_GREEN; color < STS_COLOR_MAX; color++) { - lum_level = 10; - do { + lum_level = 250; + // do { + APP_LOG(TS_OFF, VLEVEL_M, "\rFade In %04d\r", lum_level); STS_Lamp_Bar_Set_STS_RGB_Color_FadeIn(color, lum_level, LED_COUNT/2); - HAL_Delay(100); - lum_level += 10; - } while (lum_level < 99); - STS_Lamp_Bar_Set_Dark(); + + HAL_Delay(2000); + //lum_level += 5; + //} while (lum_level < 200); + //STS_Lamp_Bar_Set_Dark(); + STS_Lamp_Bar_Refresh(); } APP_LOG(TS_OFF, VLEVEL_M, "\r\n [#1] RGB Space Fade Out Fade In Testing Finished\r\n"); @@ -393,16 +399,18 @@ void STS_Lamp_Bar_Self_Test(void) uint8_t color=0, lum_level=DEFAULT_LUMINANCE_LEVEL; APP_LOG(TS_OFF, VLEVEL_H, "\r\n YunHorn STS Indicative Lamp Self Test\r\n"); -/* + STS_Lamp_Bar_Self_Test_Simple(); APP_LOG(TS_OFF, VLEVEL_H, "\r\n [#2] Scoller Testing\r\n"); - lum_level=50; for (color = STS_GREEN; color < STS_COLOR_MAX; color++) { - STS_Lamp_Bar_Scoller(color, lum_level); + //for (lum_level=1; lum_level<250; lum_level+=50) + { + STS_Lamp_Bar_Scoller(color, lum_level); + } } -*/ + STS_Lamp_Bar_Self_Test_Fade(); APP_LOG(TS_OFF, VLEVEL_H, "\r\n [##] YunHorn STS Indicative Lamp Self Test Finished\r\n"); @@ -424,7 +432,7 @@ void sts_rgb_unit_test(void) STS_Lamp_Bar_Set_Dark(); - STS_Lamp_Bar_Full_Color_Gradient(); + //STS_Lamp_Bar_Full_Color_Gradient(); STS_Lamp_Bar_Self_Test(); diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c index d65bf64..b4494ca 100644 --- a/LoRaWAN/App/lora_app.c +++ b/LoRaWAN/App/lora_app.c @@ -129,7 +129,7 @@ volatile sts_cfg_nvm_t sts_cfg_nvm = { 0x6E, //P[18] RSS_CFG_BG_MOTION_NOISE 2025-04-14 0x8C, //P[19] RSS SLIDING WINDOW CFG: 0x08 AS threshold, 0x0C as window size }, // above 20 bytes -#ifdef ATAL +#if defined(ATAL) 0x20, // 0x20 occupy(red:2) | color vacant (dark:0) for ATAL-HK 20241230 #elif defined(FADEOUT) 0x27, // 0x20 occupy(red:2) | color vacant (white:7) for SWIRE INDIGO1 BEIJING diff --git a/STM32CubeIDE/Release/STS_O7.bin b/STM32CubeIDE/Release/STS_O7.bin index 7172559..6869593 100644 Binary files a/STM32CubeIDE/Release/STS_O7.bin and b/STM32CubeIDE/Release/STS_O7.bin differ