Skip to content

Commit

Permalink
更新 maqueen.ts, _locales/zh-cn/maqueen-strings.json
Browse files Browse the repository at this point in the history
  • Loading branch information
LinDong88 committed Nov 8, 2024
1 parent 669ab23 commit bbc15ce
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
4 changes: 2 additions & 2 deletions _locales/zh-cn/maqueen-strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
"Maqueen_V5.NeoPixelColors.White|block": "",
"Maqueen_V5.NeoPixelColors.Black|block": "",
"Maqueen_V5.bottomSetBrightness|block": "设置底部RGB亮度为|%brightness",
"Maqueen_V5.bottomShowColor|block": "底部RGB显示颜色|%rgb",
"Maqueen_V5.bottomSetColor|block": "底部RGB 灯|%index 显示颜色|%rgb",
"Maqueen_V5.bottomShowColor|block": "底部RGB显示颜色|%rgb=neopixel_colors",
"Maqueen_V5.bottomSetColor|block": "底部RGB 灯|%index 显示颜色|%rgb=neopixel_colors",
"Maqueen_V5.bottomLedRange|block": "底部RGB范围从|%from 到|%to",
"Maqueen_V5.bottomRgb|block": "红|%r绿|%g蓝|%b",
"Maqueen_V5.bottomLedRainbow|block": "设置底部RGB显示彩虹色从|%startHue 到|%endHue",
Expand Down
22 changes: 15 additions & 7 deletions maqueen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1176,17 +1176,25 @@ namespace Maqueen_V5 {
export function bottomLedRange(from: number, to: number): number {
return ((from) << 16) + (2 << 8) + (to);
}

/**
* Gets the RGB value of a known color
*/
//% weight=2 blockGap=8
//% blockId="neopixel_colors" block="%color"
//% advanced=true
export function colors(color: NeoPixelColors): number {
return color;
}
/**
* Set the color of the specified LEDs
* @param index , eg: 1
* @param index , eg: 0
*/

//% weight=60
//% index.min=0 index.max=3
//% block="RGB light |%index show color|%rgb"
//% index.min=0 index.max=3 index.defl=0
//% block="RGB light |%index show color|%rgb=neopixel_colors"
//% group="Maqueen_v5"
export function bottomSetColor(index: number, rgb: NeoPixelColors) {
export function bottomSetColor(index: number, rgb: number) {
let f = index;
let t = index;
let r = (rgb >> 16) * (_brightness / 255);
Expand Down Expand Up @@ -1216,9 +1224,9 @@ namespace Maqueen_V5 {
*/

//% weight=60
//% block=" RGB show color |%rgb"
//% block=" RGB show color |%rgb=neopixel_colors"
//% group="Maqueen_v5"
export function bottomShowColor(rgb: NeoPixelColors) {
export function bottomShowColor(rgb: number) {
let r = (rgb >> 16) * (_brightness / 255);
let g = ((rgb >> 8) & 0xFF) * (_brightness / 255);
let b = ((rgb) & 0xFF) * (_brightness / 255);
Expand Down

0 comments on commit bbc15ce

Please sign in to comment.