remove hour, add advanced section
This commit is contained in:
parent
8275fefd08
commit
db4711fd26
@ -55,7 +55,46 @@
|
|||||||
"Gesture.TiltLeft|block": "tilt left",
|
"Gesture.TiltLeft|block": "tilt left",
|
||||||
"Gesture.TiltRight": "Raised when the screen is pointing right",
|
"Gesture.TiltRight": "Raised when the screen is pointing right",
|
||||||
"Gesture.TiltRight|block": "tilt right",
|
"Gesture.TiltRight|block": "tilt right",
|
||||||
|
"IconNames.Angry|block": "angry",
|
||||||
|
"IconNames.Asleep|block": "asleep",
|
||||||
|
"IconNames.Butterfly|block": "butterfly",
|
||||||
|
"IconNames.Chessboard|block": "chess board",
|
||||||
|
"IconNames.Confused|block": "confused",
|
||||||
|
"IconNames.Cow|block": "cow",
|
||||||
|
"IconNames.Diamond|block": "diamond",
|
||||||
|
"IconNames.Duck|block": "duck",
|
||||||
|
"IconNames.EigthNote|block": "eigth note",
|
||||||
|
"IconNames.Fabulous|block": "fabulous",
|
||||||
|
"IconNames.Ghost|block": "ghost",
|
||||||
|
"IconNames.Giraffe|block": "giraffe",
|
||||||
|
"IconNames.Happy|block": "happy",
|
||||||
"IconNames.Heart|block": "heart",
|
"IconNames.Heart|block": "heart",
|
||||||
|
"IconNames.House|block": "house",
|
||||||
|
"IconNames.LeftTriangle|block": "left triangle",
|
||||||
|
"IconNames.Meh|block": "meh",
|
||||||
|
"IconNames.No|block": "no",
|
||||||
|
"IconNames.Pacman|block": "pac man",
|
||||||
|
"IconNames.Pitchfork|block": "pitchfork",
|
||||||
|
"IconNames.QuarterNote|block": "quarter note",
|
||||||
|
"IconNames.Rabbit|block": "rabbit",
|
||||||
|
"IconNames.Rollerskate|block": "roller skate",
|
||||||
|
"IconNames.Sad|block": "sad",
|
||||||
|
"IconNames.Silly|block": "silly",
|
||||||
|
"IconNames.Skull|block": "skull",
|
||||||
|
"IconNames.SmallDiamond|block": "small diamond",
|
||||||
|
"IconNames.SmallHeart|block": "small heart",
|
||||||
|
"IconNames.SmallSquare|block": "small square",
|
||||||
|
"IconNames.Snake|block": "snake",
|
||||||
|
"IconNames.Square|block": "square",
|
||||||
|
"IconNames.StickFigure|block": "stick figure",
|
||||||
|
"IconNames.Surprised|block": "surprised",
|
||||||
|
"IconNames.Sword|block": "sword",
|
||||||
|
"IconNames.TShirt|block": "t-shirt",
|
||||||
|
"IconNames.Target|block": "target",
|
||||||
|
"IconNames.Tortoise|block": "tortoise",
|
||||||
|
"IconNames.Triangle|block": "triangle",
|
||||||
|
"IconNames.Umbrella|block": "umbrella",
|
||||||
|
"IconNames.Yes|block": "yes",
|
||||||
"LedSpriteProperty.Blink|block": "blink",
|
"LedSpriteProperty.Blink|block": "blink",
|
||||||
"LedSpriteProperty.Brightness|block": "brightness",
|
"LedSpriteProperty.Brightness|block": "brightness",
|
||||||
"LedSpriteProperty.Direction|block": "direction",
|
"LedSpriteProperty.Direction|block": "direction",
|
||||||
|
@ -75,6 +75,7 @@ namespace basic {
|
|||||||
//% help=basic/clear-screen weight=79
|
//% help=basic/clear-screen weight=79
|
||||||
//% blockId=device_clear_display block="clear screen"
|
//% blockId=device_clear_display block="clear screen"
|
||||||
//% parts="ledmatrix"
|
//% parts="ledmatrix"
|
||||||
|
//% advanced=true
|
||||||
void clearScreen() {
|
void clearScreen() {
|
||||||
uBit.display.image.clear();
|
uBit.display.image.clear();
|
||||||
}
|
}
|
||||||
|
@ -28,49 +28,83 @@ THE SOFTWARE.
|
|||||||
enum IconNames {
|
enum IconNames {
|
||||||
//% enumval=0 block="heart" blockImage=1
|
//% enumval=0 block="heart" blockImage=1
|
||||||
Heart = 0,
|
Heart = 0,
|
||||||
|
//% block="small heart"
|
||||||
SmallHeart,
|
SmallHeart,
|
||||||
|
//% block="yes"
|
||||||
Yes,
|
Yes,
|
||||||
|
//% block="no"
|
||||||
No,
|
No,
|
||||||
|
//% block="happy"
|
||||||
Happy,
|
Happy,
|
||||||
|
//% block="sad"
|
||||||
Sad,
|
Sad,
|
||||||
|
//% block="confused"
|
||||||
Confused,
|
Confused,
|
||||||
|
//% block="angry"
|
||||||
Angry,
|
Angry,
|
||||||
|
//% block="asleep"
|
||||||
Asleep,
|
Asleep,
|
||||||
|
//% block="surprised"
|
||||||
Surprised,
|
Surprised,
|
||||||
|
//% block="silly"
|
||||||
Silly,
|
Silly,
|
||||||
|
//% block="fabulous"
|
||||||
Fabulous,
|
Fabulous,
|
||||||
|
//% block="meh"
|
||||||
Meh,
|
Meh,
|
||||||
|
//% block="t-shirt"
|
||||||
TShirt,
|
TShirt,
|
||||||
|
//% block="roller skate"
|
||||||
Rollerskate,
|
Rollerskate,
|
||||||
|
//% block="duck"
|
||||||
Duck,
|
Duck,
|
||||||
|
//% block="house"
|
||||||
House,
|
House,
|
||||||
|
//% block="tortoise"
|
||||||
Tortoise,
|
Tortoise,
|
||||||
|
//% block="butterfly"
|
||||||
Butterfly,
|
Butterfly,
|
||||||
|
//% block="stick figure"
|
||||||
StickFigure,
|
StickFigure,
|
||||||
|
//% block="ghost"
|
||||||
Ghost,
|
Ghost,
|
||||||
|
//% block="sword"
|
||||||
Sword,
|
Sword,
|
||||||
|
//% block="giraffe"
|
||||||
Giraffe,
|
Giraffe,
|
||||||
|
//% block="skull"
|
||||||
Skull,
|
Skull,
|
||||||
|
//% block="umbrella"
|
||||||
Umbrella,
|
Umbrella,
|
||||||
|
//% block="snake"
|
||||||
Snake,
|
Snake,
|
||||||
|
//% block="rabbit"
|
||||||
Rabbit,
|
Rabbit,
|
||||||
|
//% block="cow"
|
||||||
Cow,
|
Cow,
|
||||||
|
//% block="quarter note"
|
||||||
QuarterNote,
|
QuarterNote,
|
||||||
|
//% block="eigth note"
|
||||||
EigthNote,
|
EigthNote,
|
||||||
|
//% block="pitchfork"
|
||||||
Pitchfork,
|
Pitchfork,
|
||||||
|
//% block="pac man"
|
||||||
Pacman,
|
Pacman,
|
||||||
|
//% block="target"
|
||||||
Target,
|
Target,
|
||||||
|
//% block="triangle"
|
||||||
Triangle,
|
Triangle,
|
||||||
|
//% block="left triangle"
|
||||||
LeftTriangle,
|
LeftTriangle,
|
||||||
|
//% block="chess board"
|
||||||
Chessboard,
|
Chessboard,
|
||||||
|
//% block="diamond"
|
||||||
Diamond,
|
Diamond,
|
||||||
|
//% block="small diamond"
|
||||||
SmallDiamond,
|
SmallDiamond,
|
||||||
|
//% block="square"
|
||||||
Square,
|
Square,
|
||||||
|
//% block="small square"
|
||||||
SmallSquare
|
SmallSquare
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,51 +122,39 @@ namespace basic {
|
|||||||
res.showImage(0)
|
res.showImage(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
//% weight=50
|
//% weight=50 blockGap=8
|
||||||
//% blockId=basic_show_arrow block="show arrow %i=device_arrow"
|
//% blockId=basic_show_arrow
|
||||||
|
//% block="show arrow %i=device_arrow"
|
||||||
|
//% parts="ledmatrix"
|
||||||
|
//% advanced=true
|
||||||
export function showArrow(i: number) {
|
export function showArrow(i: number) {
|
||||||
let res = images.arrowImage(i)
|
let res = images.arrowImage(i)
|
||||||
res.showImage(0)
|
res.showImage(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
//% weight=50
|
|
||||||
//% blockId=basic_show_hour block="show hour %i=device_hour"
|
|
||||||
export function showHour(i: number) {
|
|
||||||
let res = images.hourImage(i)
|
|
||||||
res.showImage(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace images {
|
namespace images {
|
||||||
|
|
||||||
export enum ArrowNames {
|
export enum ArrowNames {
|
||||||
|
//% blockIdentity=images.arrowNumber
|
||||||
North = 0,
|
North = 0,
|
||||||
|
//% blockIdentity=images.arrowNumber
|
||||||
NorthEast,
|
NorthEast,
|
||||||
|
//% blockIdentity=images.arrowNumber
|
||||||
East,
|
East,
|
||||||
|
//% blockIdentity=images.arrowNumber
|
||||||
SouthEast,
|
SouthEast,
|
||||||
|
//% blockIdentity=images.arrowNumber
|
||||||
South,
|
South,
|
||||||
|
//% blockIdentity=images.arrowNumber
|
||||||
SouthWest,
|
SouthWest,
|
||||||
|
//% blockIdentity=images.arrowNumber
|
||||||
West,
|
West,
|
||||||
|
//% blockIdentity=images.arrowNumber
|
||||||
NorthWest,
|
NorthWest,
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum HourNames {
|
|
||||||
Hour12 = 0,
|
|
||||||
Hour1,
|
|
||||||
Hour2,
|
|
||||||
Hour3,
|
|
||||||
Hour4,
|
|
||||||
Hour5,
|
|
||||||
Hour6,
|
|
||||||
Hour7,
|
|
||||||
Hour8,
|
|
||||||
Hour9,
|
|
||||||
Hour10,
|
|
||||||
Hour11
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const heart = `
|
const heart = `
|
||||||
. # . # .
|
. # . # .
|
||||||
@ -227,94 +249,6 @@ export enum HourNames {
|
|||||||
. # . # .
|
. # . # .
|
||||||
# . . . #`
|
# . . . #`
|
||||||
|
|
||||||
// clock hands
|
|
||||||
|
|
||||||
const hour12 = `
|
|
||||||
. . # . .
|
|
||||||
. . # . .
|
|
||||||
. . # . .
|
|
||||||
. . . . .
|
|
||||||
. . . . .`
|
|
||||||
|
|
||||||
const hour1 = `
|
|
||||||
. . . # .
|
|
||||||
. . . # .
|
|
||||||
. . # . .
|
|
||||||
. . . . .
|
|
||||||
. . . . .`
|
|
||||||
|
|
||||||
const hour2 = `
|
|
||||||
. . . . .
|
|
||||||
. . . # #
|
|
||||||
. . # . .
|
|
||||||
. . . . .
|
|
||||||
. . . . .`
|
|
||||||
|
|
||||||
|
|
||||||
const hour3 = `
|
|
||||||
. . . . .
|
|
||||||
. . . . .
|
|
||||||
. . # # #
|
|
||||||
. . . . .
|
|
||||||
. . . . .`
|
|
||||||
|
|
||||||
const hour4 = `
|
|
||||||
. . . . .
|
|
||||||
. . . . .
|
|
||||||
. . # . .
|
|
||||||
. . . # #
|
|
||||||
. . . . .`
|
|
||||||
|
|
||||||
const hour5 = `
|
|
||||||
. . . . .
|
|
||||||
. . . . .
|
|
||||||
. . # . .
|
|
||||||
. . . # .
|
|
||||||
. . . # .`
|
|
||||||
|
|
||||||
const hour6 = `
|
|
||||||
. . . . .
|
|
||||||
. . . . .
|
|
||||||
. . # . .
|
|
||||||
. . # . .
|
|
||||||
. . # . .`
|
|
||||||
|
|
||||||
|
|
||||||
const hour7 = `
|
|
||||||
. . . . .
|
|
||||||
. . . . .
|
|
||||||
. . # . .
|
|
||||||
. # . . .
|
|
||||||
. # . . .`
|
|
||||||
|
|
||||||
const hour8 = `
|
|
||||||
. . . . .
|
|
||||||
. . . . .
|
|
||||||
. . # . .
|
|
||||||
# # . . .
|
|
||||||
. . . . .`
|
|
||||||
|
|
||||||
const hour9 = `
|
|
||||||
. . . . .
|
|
||||||
. . . . .
|
|
||||||
# # # . .
|
|
||||||
. . . . .
|
|
||||||
. . . . .`
|
|
||||||
|
|
||||||
const hour10 = `
|
|
||||||
. . . . .
|
|
||||||
# # . . .
|
|
||||||
. . # . .
|
|
||||||
. . . . .
|
|
||||||
. . . . .`
|
|
||||||
|
|
||||||
const hour11 = `
|
|
||||||
. # . . .
|
|
||||||
. # . . .
|
|
||||||
. . # . .
|
|
||||||
. . . . .
|
|
||||||
. . . . .`
|
|
||||||
|
|
||||||
// compass directions
|
// compass directions
|
||||||
|
|
||||||
const arrow_n = `
|
const arrow_n = `
|
||||||
@ -572,21 +506,14 @@ export enum HourNames {
|
|||||||
. # # # .
|
. # # # .
|
||||||
. . # . .`
|
. . # . .`
|
||||||
|
|
||||||
//% weight=50
|
//% weight=50 blockGap=8
|
||||||
//% blockId=device_arrow block="%arrow"
|
//% blockId=device_arrow block="%arrow"
|
||||||
//% shim=TD_ID
|
//% shim=TD_ID
|
||||||
export function arrowNumber(arrow: ArrowNames): number {
|
export function arrowNumber(arrow: ArrowNames): number {
|
||||||
return arrow;
|
return arrow;
|
||||||
}
|
}
|
||||||
|
|
||||||
//% weight=50
|
//% weight=50 blockGap=8
|
||||||
//% blockId=device_hour block="%hour"
|
|
||||||
//% shim=TD_ID
|
|
||||||
export function hourNumber(hour: HourNames): number {
|
|
||||||
return hour;
|
|
||||||
}
|
|
||||||
|
|
||||||
//% weight=50
|
|
||||||
//% blockId=builtin_arrow_image block="arrow image %i=device_arrow"
|
//% blockId=builtin_arrow_image block="arrow image %i=device_arrow"
|
||||||
export function arrowImage(i: ArrowNames): Image {
|
export function arrowImage(i: ArrowNames): Image {
|
||||||
let res = images.createImage(`
|
let res = images.createImage(`
|
||||||
@ -609,40 +536,13 @@ export enum HourNames {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
//% weight=50
|
//% weight=50 blockGap=8
|
||||||
//% blockId=builtin_hour_image block="hour image %i=device_hour"
|
|
||||||
export function hourImage(i: HourNames): Image {
|
|
||||||
let res = images.createImage(`
|
|
||||||
. . . . .
|
|
||||||
. . . . .
|
|
||||||
. . . . .
|
|
||||||
. . . . .
|
|
||||||
. . . . .
|
|
||||||
`)
|
|
||||||
switch (i) {
|
|
||||||
case HourNames.Hour12: return set(res, hour12)
|
|
||||||
case HourNames.Hour1: return set(res, hour1)
|
|
||||||
case HourNames.Hour2: return set(res, hour2)
|
|
||||||
case HourNames.Hour3: return set(res, hour3)
|
|
||||||
case HourNames.Hour4: return set(res, hour4)
|
|
||||||
case HourNames.Hour5: return set(res, hour5)
|
|
||||||
case HourNames.Hour6: return set(res, hour6)
|
|
||||||
case HourNames.Hour7: return set(res, hour7)
|
|
||||||
case HourNames.Hour8: return set(res, hour8)
|
|
||||||
case HourNames.Hour9: return set(res, hour9)
|
|
||||||
case HourNames.Hour10: return set(res, hour10)
|
|
||||||
case HourNames.Hour11: return set(res, hour11)
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
//% weight=50
|
|
||||||
//% blockId=builtin_image block="icon image %i"
|
//% blockId=builtin_image block="icon image %i"
|
||||||
export function iconImage(i: IconNames): Image {
|
export function iconImage(i: IconNames): Image {
|
||||||
let res = images.createImage(`
|
let res = images.createImage(`
|
||||||
. . . . .
|
. . . . .
|
||||||
. . . . .
|
. . . . .
|
||||||
. . # . .
|
. . . . .
|
||||||
. . . . .
|
. . . . .
|
||||||
. . . . .
|
. . . . .
|
||||||
`)
|
`)
|
||||||
|
3
libs/core/shims.d.ts
vendored
3
libs/core/shims.d.ts
vendored
@ -171,7 +171,8 @@ declare namespace basic {
|
|||||||
*/
|
*/
|
||||||
//% help=basic/clear-screen weight=79
|
//% help=basic/clear-screen weight=79
|
||||||
//% blockId=device_clear_display block="clear screen"
|
//% blockId=device_clear_display block="clear screen"
|
||||||
//% parts="ledmatrix" shim=basic::clearScreen
|
//% parts="ledmatrix"
|
||||||
|
//% advanced=true shim=basic::clearScreen
|
||||||
function clearScreen(): void;
|
function clearScreen(): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user