Skip to content

Commit 436957c

Browse files
authored
Convert types and indices in special sensor specification to lists (#169)
This allows to correctly work with modes that have several values. See ddemidov/ev3dev-lang-cpp/issues#10
1 parent 9cbda18 commit 436957c

File tree

1 file changed

+43
-34
lines changed

1 file changed

+43
-34
lines changed

spec.json

Lines changed: 43 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,8 +1008,8 @@
10081008
"sensorValueMappings": [
10091009
{
10101010
"name": "Is Pressed",
1011-
"sourceValue": 0,
1012-
"type": "boolean",
1011+
"sourceValue": [0],
1012+
"type": ["boolean"],
10131013
"requiredMode": "TOUCH",
10141014
"description": [
10151015
"A boolean indicating whether the current touch sensor is being",
@@ -1069,26 +1069,26 @@
10691069
"sensorValueMappings": [
10701070
{
10711071
"name": "Reflected Light Intensity",
1072-
"sourceValue": 0,
1073-
"type": "int",
1072+
"sourceValue": [0],
1073+
"type": ["int"],
10741074
"requiredMode": "COL-REFLECT",
10751075
"description": [
10761076
"Reflected light intensity as a percentage. Light on sensor is red."
10771077
]
10781078
},
10791079
{
10801080
"name": "Ambient Light Intensity",
1081-
"sourceValue": 0,
1082-
"type": "int",
1081+
"sourceValue": [0],
1082+
"type": ["int"],
10831083
"requiredMode": "COL-AMBIENT",
10841084
"description": [
10851085
"Ambient light intensity. Light on sensor is dimly lit blue."
10861086
]
10871087
},
10881088
{
10891089
"name": "Color",
1090-
"sourceValue": 0,
1091-
"type": "int",
1090+
"sourceValue": [0],
1091+
"type": ["int"],
10921092
"requiredMode": "COL-COLOR",
10931093
"description": [
10941094
"Color detected by the sensor, categorized by overall value.",
@@ -1104,26 +1104,26 @@
11041104
},
11051105
{
11061106
"name": "Red",
1107-
"sourceValue": 0,
1108-
"type": "int",
1107+
"sourceValue": [0],
1108+
"type": ["int"],
11091109
"requiredMode": "RGB-RAW",
11101110
"description": [
11111111
"Red component of the detected color, in the range 0-1020."
11121112
]
11131113
},
11141114
{
11151115
"name": "Green",
1116-
"sourceValue": 1,
1117-
"type": "int",
1116+
"sourceValue": [1],
1117+
"type": ["int"],
11181118
"requiredMode": "RGB-RAW",
11191119
"description": [
11201120
"Green component of the detected color, in the range 0-1020."
11211121
]
11221122
},
11231123
{
11241124
"name": "Blue",
1125-
"sourceValue": 2,
1126-
"type": "int",
1125+
"sourceValue": [2],
1126+
"type": ["int"],
11271127
"requiredMode": "RGB-RAW",
11281128
"description": [
11291129
"Blue component of the detected color, in the range 0-1020."
@@ -1177,8 +1177,8 @@
11771177
"sensorValueMappings": [
11781178
{
11791179
"name": "Distance Centimeters",
1180-
"sourceValue": 0,
1181-
"type": "float",
1180+
"sourceValue": [0],
1181+
"type": ["float"],
11821182
"requiredMode": "US-DIST-CM",
11831183
"description": [
11841184
"Measurement of the distance detected by the sensor,",
@@ -1187,8 +1187,8 @@
11871187
},
11881188
{
11891189
"name": "Distance Inches",
1190-
"sourceValue": 0,
1191-
"type": "float",
1190+
"sourceValue": [0],
1191+
"type": ["float"],
11921192
"requiredMode": "US-DIST-IN",
11931193
"description": [
11941194
"Measurement of the distance detected by the sensor,",
@@ -1197,8 +1197,8 @@
11971197
},
11981198
{
11991199
"name": "Other Sensor Present",
1200-
"sourceValue": 0,
1201-
"type": "boolean",
1200+
"sourceValue": [0],
1201+
"type": ["boolean"],
12021202
"requiredMode": "US-LISTEN",
12031203
"description": [
12041204
"Value indicating whether another ultrasonic sensor could",
@@ -1257,8 +1257,8 @@
12571257
"sensorValueMappings": [
12581258
{
12591259
"name": "Angle",
1260-
"sourceValue": 0,
1261-
"type": "int",
1260+
"sourceValue": [0],
1261+
"type": ["int"],
12621262
"requiredMode": "GYRO-ANG",
12631263
"description": [
12641264
"The number of degrees that the sensor has been rotated",
@@ -1267,12 +1267,21 @@
12671267
},
12681268
{
12691269
"name": "Rate",
1270-
"sourceValue": 0,
1271-
"type": "int",
1270+
"sourceValue": [0],
1271+
"type": ["int"],
12721272
"requiredMode": "GYRO-RATE",
12731273
"description": [
12741274
"The rate at which the sensor is rotating, in degrees/second."
12751275
]
1276+
},
1277+
{
1278+
"name": "Rate and Angle",
1279+
"sourceValue": [0, 1],
1280+
"type": ["int", "int"],
1281+
"requiredMode": "GYRO-G&A",
1282+
"description": [
1283+
"Angle (degrees) and Rotational Speed (degrees/second)."
1284+
]
12761285
}
12771286
]
12781287
},
@@ -1348,8 +1357,8 @@
13481357
"sensorValueMappings": [
13491358
{
13501359
"name": "Proximity",
1351-
"sourceValue": 0,
1352-
"type": "int",
1360+
"sourceValue": [0],
1361+
"type": ["int"],
13531362
"requiredMode": "IR-PROX",
13541363
"description": [
13551364
"A measurement of the distance between the sensor and the remote,",
@@ -1388,8 +1397,8 @@
13881397
"sensorValueMappings": [
13891398
{
13901399
"name": "Sound Pressure",
1391-
"sourceValue": 0,
1392-
"type": "float",
1400+
"sourceValue": [0],
1401+
"type": ["float"],
13931402
"requiredMode": "DB",
13941403
"description": [
13951404
"A measurement of the measured sound pressure level, as a",
@@ -1398,8 +1407,8 @@
13981407
},
13991408
{
14001409
"name": "Sound Pressure Low",
1401-
"sourceValue": 0,
1402-
"type": "float",
1410+
"sourceValue": [0],
1411+
"type": ["float"],
14031412
"requiredMode": "DBA",
14041413
"description": [
14051414
"A measurement of the measured sound pressure level, as a",
@@ -1438,17 +1447,17 @@
14381447
"sensorValueMappings": [
14391448
{
14401449
"name": "Reflected Light Intensity",
1441-
"sourceValue": 0,
1442-
"type": "float",
1450+
"sourceValue": [0],
1451+
"type": ["float"],
14431452
"requiredMode": "REFLECT",
14441453
"description": [
14451454
"A measurement of the reflected light intensity, as a percentage."
14461455
]
14471456
},
14481457
{
14491458
"name": "Ambient Light Intensity",
1450-
"sourceValue": 0,
1451-
"type": "float",
1459+
"sourceValue": [0],
1460+
"type": ["float"],
14521461
"requiredMode": "AMBIENT",
14531462
"description": [
14541463
"A measurement of the ambient light intensity, as a percentage."

0 commit comments

Comments
 (0)