feat: 优化mcu中led灯的状态存储逻辑
This commit is contained in:
parent
2d22309695
commit
d082f72b1a
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*/.idea
|
||||
*/.vscode
|
@ -133,8 +133,12 @@ void ledSave(int ledNum, uint8_t r, uint8_t g, uint8_t b, uint8_t lig, int statu
|
||||
leds[ledNum - 1].ledNumber = ledNum;
|
||||
leds[ledNum - 1].status = status;
|
||||
if (lig == 0) {
|
||||
// 关灯
|
||||
leds[ledNum - 1].color = strip.Color(0, 0, 0);
|
||||
} if(lig==100){
|
||||
// 正常
|
||||
leds[ledNum - 1].color = strip.Color(r, g, b);
|
||||
} else {
|
||||
}else {
|
||||
// 使用亮度换算rgb颜色
|
||||
leds[ledNum - 1].color = strip.Color((r * lig) / 255, (g * lig) / 255, (b * lig));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user