Use enum initializers not enumval= where possible

This commit is contained in:
Michal Moskal 2016-04-01 09:17:41 -07:00
parent a3b2682cc1
commit 68143500da
3 changed files with 105 additions and 141 deletions

View File

@ -9,21 +9,21 @@ enum Button {
} }
enum Dimension { enum Dimension {
//% enumval=0 block=x //% block=x
X, X = 0,
//% enumval=1 block=y //% block=y
Y, Y = 1,
//% enumval=2 block=z //% block=z
Z, Z = 2,
//% enumval=3 block=strength //% block=strength
Strength, Strength = 3,
} }
enum Rotation { enum Rotation {
//% enumval=0 block=pitch //% block=pitch
Pitch, Pitch = 0,
//% enumval=1 block=roll //% block=roll
Roll, Roll = 1,
} }
enum TouchPin { enum TouchPin {
@ -39,23 +39,23 @@ enum AcceleratorRange {
/** /**
* The accelerator measures forces up to 1 gravity * The accelerator measures forces up to 1 gravity
*/ */
//% block="1g" enumval=1 //% block="1g"
OneG, OneG = 1,
/** /**
* The accelerator measures forces up to 2 gravity * The accelerator measures forces up to 2 gravity
*/ */
//% block="2g" enumval=2 //% block="2g"
TwoG, TwoG = 2,
/** /**
* The accelerator measures forces up to 4 gravity * The accelerator measures forces up to 4 gravity
*/ */
//% block="4g" enumval=4 //% block="4g"
FourG, FourG = 4,
/** /**
* The accelerator measures forces up to 8 gravity * The accelerator measures forces up to 8 gravity
*/ */
//% block="8g" enumval=8 //% block="8g"
EightG EightG = 8
} }
/* /*
@ -80,43 +80,43 @@ enum Gesture {
/** /**
* Raised when shaken * Raised when shaken
*/ */
//% block=shake enumval=11 //% block=shake
Shake, Shake = 11,
/** /**
* Raised when the logo is upward and the screen is vertical * Raised when the logo is upward and the screen is vertical
*/ */
//% block="logo up" enumval=1 //% block="logo up"
LogoUp, LogoUp = 1,
/** /**
* Raised when the logo is downward and the screen is vertical * Raised when the logo is downward and the screen is vertical
*/ */
//% block="logo down" enumval=2 //% block="logo down"
LogoDown, LogoDown = 2,
/** /**
* Raised when the screen is pointing down and the board is horizontal * Raised when the screen is pointing down and the board is horizontal
*/ */
//% block="screen up" enumval=5 //% block="screen up"
ScreenUp, ScreenUp = 5,
/** /**
* Raised when the screen is pointing up and the board is horizontal * Raised when the screen is pointing up and the board is horizontal
*/ */
//% block="screen down" enumval=6 //% block="screen down"
ScreenDown, ScreenDown = 6,
/** /**
* Raised when the screen is pointing left * Raised when the screen is pointing left
*/ */
//% block="tilt left" enumval=3 //% block="tilt left"
TiltLeft, TiltLeft = 3,
/** /**
* Raised when the screen is pointing right * Raised when the screen is pointing right
*/ */
//% block="tilt right" enumval=4 //% block="tilt right"
TiltRight, TiltRight = 4,
/** /**
* Raised when the board is falling! * Raised when the board is falling!
*/ */
//% block="free fall" enumval=7 //% block="free fall"
FreeFall FreeFall = 7
} }
//% color=300 weight=99 //% color=300 weight=99

View File

@ -1,8 +1,8 @@
enum DisplayMode { enum DisplayMode {
//% enumval=0 block="black and white" //% block="black and white"
BackAndWhite, BackAndWhite = 0,
//% enumval=1 block="greyscale" //% block="greyscale"
Greyscale, Greyscale = 1,
} }
//% color=3 weight=35 //% color=3 weight=35

View File

@ -1,112 +1,76 @@
enum Note { enum Note {
//% enumval=262 C = 262,
C, //% block=C#
//% enumval=277 block=C# CSharp = 277,
CSharp, D = 294,
//% enumval=294 Eb = 311,
D, E = 330,
//% enumval=311 F = 349,
Eb, //% block=F#
//% enumval=330 FSharp = 370,
E, G = 392,
//% enumval=349 //% block=G#
F, GSharp = 415,
//% enumval=370 block=F# A = 440,
FSharp, Bb = 466,
//% enumval=392 B = 494,
G, C3 = 131,
//% enumval=415 block=G# //% block=C#3
GSharp, CSharp3 = 139,
//% enumval=440 D3 = 147,
A, Eb3 = 156,
//% enumval=466 E3 = 165,
Bb, F3 = 175,
//% enumval=494 //% block=F#3
B, FSharp3 = 185,
//% enumval=131 G3 = 196,
C3, //% block=G#3
//% enumval=139 block=C#3 GSharp3 = 208,
CSharp3, A3 = 220,
//% enumval=147 Bb3 = 233,
D3, B3 = 247,
//% enumval=156 C4 = 262,
Eb3, //% block=C#4
//% enumval=165 CSharp4 = 277,
E3, D4 = 294,
//% enumval=175 Eb4 = 311,
F3, E4 = 330,
//% enumval=185 block=F#3 F4 = 349,
FSharp3, //% block=F#3
//% enumval=196 FSharp4 = 370,
G3, G4 = 392,
//% enumval=208 block=G#3 //% block=G#3
GSharp3, GSharp4 = 415,
//% enumval=220 A4 = 440,
A3, Bb4 = 466,
//% enumval=233 B4 = 494,
Bb3, C5 = 523,
//% enumval=247 //% block=C#5
B3, CSharp5 = 555,
//% enumval=262 D5 = 587,
C4, Eb5 = 622,
//% enumval=277 block=C#4 E5 = 659,
CSharp4, F5 = 698,
//% enumval=294 //% block=F#5
D4, FSharp5 = 740,
//% enumval=311 G5 = 784,
Eb4, //% block=G#5
//% enumval=330 GSharp5 = 831,
E4, A5 = 880,
//% enumval=349 Bb5 = 932,
F4, B5 = 989,
//% enumval=370 block=F#3
FSharp4,
//% enumval=392
G4,
//% enumval=415 block=G#3
GSharp4,
//% enumval=440
A4,
//% enumval=466
Bb4,
//% enumval=494
B4,
//% enumval=523
C5,
//% enumval=555 block=C#5
CSharp5,
//% enumval=587
D5,
//% enumval=622
Eb5,
//% enumval=659
E5,
//% enumval=698
F5,
//% enumval=740 block=F#5
FSharp5,
//% enumval=784
G5,
//% enumval=831 block=G#5
GSharp5,
//% enumval=880
A5,
//% enumval=932
Bb5,
//% enumval=989
B5,
} }
enum BeatFraction { enum BeatFraction {
//% enumval=1 block=1 //% block=1
Whole = 1, Whole = 1,
//% enumval=2 block="1/2" //% block="1/2"
Half = 2, Half = 2,
//% enumval=4 block="1/4" //% block="1/4"
Quater = 4, Quater = 4,
//% enumval=8 block="1/8" //% block="1/8"
Eighth = 8, Eighth = 8,
//% enumval=16 block="1/16" //% block="1/16"
Sixteenth = 16 Sixteenth = 16
} }