Skip to content

Commit ee1f0e3

Browse files
committed
Fix: grammatical error in the comment block.
Added: block for bmp280 and mpu9250.
1 parent b8ee12d commit ee1f0e3

File tree

5 files changed

+301
-7
lines changed

5 files changed

+301
-7
lines changed

source/blocks/adam_common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2007,7 +2007,7 @@ Blockly.defineBlocksWithJsonArray([
20072007
*/
20082008
{
20092009
"type": "common_comment",
2010-
"message0": "коментарий %1",
2010+
"message0": "комментарий %1",
20112011
"args0": [
20122012
{
20132013
"type": "field_input",

source/blocks/adam_three.js

Lines changed: 232 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,4 +894,235 @@ Blockly.defineBlocksWithJsonArray([
894894
"colour": 220,
895895
"tooltip": "",
896896
"helpUrl": ""
897-
}]);
897+
},
898+
899+
/**
900+
* adam_two_seven_sensor_temperature
901+
*
902+
*/
903+
{
904+
"type": "adam_two_seven_sensor_temperature",
905+
"message0": "датчик температуры %1 переменная класса датчика %2",
906+
"args0": [
907+
{
908+
"type": "input_dummy"
909+
},
910+
{
911+
"type": "field_variable",
912+
"name": "sensor_variable",
913+
"variable": "item"
914+
}
915+
],
916+
"output": null,
917+
"colour": 160,
918+
"tooltip": "",
919+
"helpUrl": ""
920+
},
921+
922+
/**
923+
* adam_two_seven_sensor_acceleration
924+
*
925+
*/
926+
{
927+
"type": "adam_two_seven_sensor_acceleration",
928+
"message0": "датчик ускорения %1 переменная класса датчика %2",
929+
"args0": [
930+
{
931+
"type": "input_dummy"
932+
},
933+
{
934+
"type": "field_variable",
935+
"name": "sensor_variable",
936+
"variable": "item"
937+
}
938+
],
939+
"output": null,
940+
"colour": 160,
941+
"tooltip": "",
942+
"helpUrl": ""
943+
},
944+
945+
/**
946+
* adam_two_seven_sensor_gyro
947+
*
948+
*/
949+
{
950+
"type": "adam_two_seven_sensor_gyro",
951+
"message0": "гироскоп %1 переменная класса датчика %2",
952+
"args0": [
953+
{
954+
"type": "input_dummy"
955+
},
956+
{
957+
"type": "field_variable",
958+
"name": "sensor_variable",
959+
"variable": "item"
960+
}
961+
],
962+
"output": null,
963+
"colour": 160,
964+
"tooltip": "",
965+
"helpUrl": ""
966+
},
967+
968+
/**
969+
* adam_two_seven_sensor_magnetometer
970+
*
971+
*/
972+
{
973+
"type": "adam_two_seven_sensor_magnetometer",
974+
"message0": "магнитометр %1 переменная класса датчика %2",
975+
"args0": [
976+
{
977+
"type": "input_dummy"
978+
},
979+
{
980+
"type": "field_variable",
981+
"name": "sensor_variable",
982+
"variable": "item"
983+
}
984+
],
985+
"output": null,
986+
"colour": 160,
987+
"tooltip": "",
988+
"helpUrl": ""
989+
},
990+
991+
/**
992+
* adam_two_seven_sensor_pressure
993+
*
994+
*/
995+
{
996+
"type": "adam_two_seven_sensor_pressure",
997+
"message0": "давление %1 переменная класса датчика %2",
998+
"args0": [
999+
{
1000+
"type": "input_dummy"
1001+
},
1002+
{
1003+
"type": "field_variable",
1004+
"name": "sensor_variable",
1005+
"variable": "item"
1006+
}
1007+
],
1008+
"output": null,
1009+
"colour": 160,
1010+
"tooltip": "",
1011+
"helpUrl": ""
1012+
},
1013+
1014+
/**
1015+
* adam_two_seven_sensor_altitude
1016+
*
1017+
*/
1018+
{
1019+
"type": "adam_two_seven_sensor_altitude",
1020+
"message0": "высота над уровнем моря %1 переменная класса датчика %2",
1021+
"args0": [
1022+
{
1023+
"type": "input_dummy"
1024+
},
1025+
{
1026+
"type": "field_variable",
1027+
"name": "sensor_variable",
1028+
"variable": "item"
1029+
}
1030+
],
1031+
"output": null,
1032+
"colour": 160,
1033+
"tooltip": "",
1034+
"helpUrl": ""
1035+
},
1036+
1037+
/**
1038+
* adam_two_seven_sensor_declaration_extended
1039+
*
1040+
*/
1041+
{
1042+
"type": "adam_two_seven_sensor_declaration_extended",
1043+
"message0": "инициализация датчика bmp280 %1 переменная шины i2c %2 %3 адрес устройства i2c %4",
1044+
"args0": [
1045+
{
1046+
"type": "input_dummy"
1047+
},
1048+
{
1049+
"type": "field_variable",
1050+
"name": "i2c_variable",
1051+
"variable": "item"
1052+
},
1053+
{
1054+
"type": "input_dummy"
1055+
},
1056+
{
1057+
"type": "input_value",
1058+
"name": "sensor_address"
1059+
}
1060+
],
1061+
"output": null,
1062+
"colour": 160,
1063+
"tooltip": "",
1064+
"helpUrl": ""
1065+
},
1066+
1067+
{
1068+
"type": "adam_two_seven_bmp280_addr_const",
1069+
"message0": "адрес датчика bmp280 %1",
1070+
"args0": [
1071+
{
1072+
"type": "field_dropdown",
1073+
"name": "addr_variable",
1074+
"options": [
1075+
[
1076+
"0x76",
1077+
"0x76"
1078+
],
1079+
[
1080+
"0x77",
1081+
"0x77"
1082+
]
1083+
]
1084+
}
1085+
],
1086+
"output": null,
1087+
"colour": 160,
1088+
"tooltip": "",
1089+
"helpUrl": ""
1090+
},
1091+
1092+
{
1093+
"type": "adam_two_seven_sensor_set_pressure",
1094+
"message0": "поправка для атмосферного давления %1 переменная класса датчика %2 %3 текущее атмосферное давление %4",
1095+
"args0": [
1096+
{
1097+
"type": "input_dummy"
1098+
},
1099+
{
1100+
"type": "field_variable",
1101+
"name": "sensor_variable",
1102+
"variable": "item"
1103+
},
1104+
{
1105+
"type": "input_dummy"
1106+
},
1107+
{
1108+
"type": "field_number",
1109+
"name": "current_atmospheric_pressure_variable",
1110+
"value": 1000
1111+
}
1112+
],
1113+
"previousStatement": null,
1114+
"nextStatement": null,
1115+
"colour": 160,
1116+
"tooltip": "",
1117+
"helpUrl": ""
1118+
},
1119+
1120+
{
1121+
"type": "adam_two_seven_sensor_mpu_9250_declaration",
1122+
"message0": "инициализация датчика mpu9250",
1123+
"output": null,
1124+
"colour": 160,
1125+
"tooltip": "",
1126+
"helpUrl": ""
1127+
}
1128+
]);

source/generators/python/adam_common.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,6 @@ Blockly.Python['common_music_mixer_init'] = function(block) {
299299
*/
300300
Blockly.Python['common_music_mixer_load'] = function(block) {
301301
var value_path = Blockly.Python.valueToCode(block, 'path', Blockly.Python.ORDER_NONE);
302-
// TODO: Assemble Python into code variable.
303302
var code = 'pygame.mixer.music.load(' + value_path + ')\n';
304303
return code;
305304
};
@@ -399,7 +398,6 @@ Blockly.Python['common_music_fraction'] = function(block) {
399398
Blockly.Python['common_say_native'] = function(block) {
400399
Blockly.Python.definitions_['import_subprocess'] = 'import subprocess';
401400
var value_text = Blockly.Python.valueToCode(block, 'text', Blockly.Python.ORDER_ATOMIC);
402-
// TODO: Assemble Python into code variable.
403401
var code = 'subprocess.call("echo ' + value_text + ' | RHVoice-test --profile \'aleksandr-hq\' 2>/dev/null", shell=True)';
404402
return code;
405403
};
@@ -412,7 +410,6 @@ Blockly.Python['common_say_native_with_voice_param'] = function(block) {
412410
Blockly.Python.definitions_['import_subprocess'] = 'import subprocess';
413411
var value_text = Blockly.Python.valueToCode(block, 'text', Blockly.Python.ORDER_ATOMIC);
414412
var value_voice = Blockly.Python.valueToCode(block, 'voice', Blockly.Python.ORDER_ATOMIC);
415-
// TODO: Assemble Python into code variable.
416413
var code = 'subprocess.call("echo ' + value_text + ' | RHVoice-test --profile ' + value_voice + ' 2>/dev/null", shell=True)';
417414
return code;
418415
};

source/generators/python/adam_three.js

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,4 +265,69 @@ Blockly.Python['controller_const_left_foot'] = function(block) {
265265
Blockly.Python['controller_const_right_foot'] = function(block) {
266266
var code = "'right_foot'";
267267
return [code, Blockly.Python.ORDER_ATOMIC];
268-
};
268+
};
269+
270+
Blockly.Python['adam_two_seven_sensor_temperature'] = function(block) {
271+
var variable_sensor_variable = Blockly.Python.nameDB_.getName(block.getFieldValue('sensor_variable'), Blockly.Variables.NAME_TYPE);
272+
var code = variable_sensor_variable + '.temperature';
273+
return [code, Blockly.Python.ORDER_NONE];
274+
};
275+
276+
Blockly.Python['adam_two_seven_sensor_pressure'] = function(block) {
277+
var variable_sensor_variable = Blockly.Python.nameDB_.getName(block.getFieldValue('sensor_variable'), Blockly.Variables.NAME_TYPE);
278+
var code = variable_sensor_variable + '.pressure';
279+
return [code, Blockly.Python.ORDER_NONE];
280+
};
281+
282+
Blockly.Python['adam_two_seven_sensor_altitude'] = function(block) {
283+
var variable_sensor_variable = Blockly.Python.nameDB_.getName(block.getFieldValue('sensor_variable'), Blockly.Variables.NAME_TYPE);
284+
var code = variable_sensor_variable + '.altitude';
285+
return [code, Blockly.Python.ORDER_NONE];
286+
};
287+
Blockly.Python['adam_two_seven_sensor_acceleration'] = function(block) {
288+
var variable_sensor_variable = Blockly.Python.nameDB_.getName(block.getFieldValue('sensor_variable'), Blockly.Variables.NAME_TYPE);
289+
var code = variable_sensor_variable + '.readAccel()';
290+
return [code, Blockly.Python.ORDER_NONE];
291+
};
292+
293+
Blockly.Python['adam_two_seven_sensor_gyro'] = function(block) {
294+
var variable_sensor_variable = Blockly.Python.nameDB_.getName(block.getFieldValue('sensor_variable'), Blockly.Variables.NAME_TYPE);
295+
var code = variable_sensor_variable + '.readGyro()';
296+
return [code, Blockly.Python.ORDER_NONE];
297+
};
298+
299+
Blockly.Python['adam_two_seven_sensor_magnetometer'] = function(block) {
300+
var variable_sensor_variable = Blockly.Python.nameDB_.getName(block.getFieldValue('sensor_variable'), Blockly.Variables.NAME_TYPE);
301+
var code = variable_sensor_variable + '.readMagnet()';
302+
return [code, Blockly.Python.ORDER_NONE];
303+
};
304+
305+
306+
Blockly.Python['adam_two_seven_sensor_declaration_extended'] = function(block) {
307+
Blockly.Python.definitions_['import_adafruit_bmp280'] = 'import adafruit_bmp280';
308+
var variable_i2c_variable = Blockly.Python.nameDB_.getName(block.getFieldValue('i2c_variable'), Blockly.Variables.NAME_TYPE);
309+
var value_sensor_address = Blockly.Python.valueToCode(block, 'sensor_address', Blockly.Python.ORDER_NONE);
310+
var code = 'adafruit_bmp280.Adafruit_BMP280_I2C(' + variable_i2c_variable + ', ' + value_sensor_address + ')';
311+
return [code, Blockly.Python.ORDER_NONE];
312+
};
313+
314+
Blockly.Python['adam_two_seven_bmp280_addr_const'] = function(block) {
315+
var dropdown_addr_variable = block.getFieldValue('addr_variable');
316+
var code = dropdown_addr_variable;
317+
return [code, Blockly.Python.ORDER_NONE];
318+
};
319+
320+
Blockly.Python['adam_two_seven_sensor_set_pressure'] = function(block) {
321+
var variable_sensor_variable = Blockly.Python.nameDB_.getName(block.getFieldValue('sensor_variable'), Blockly.Variables.NAME_TYPE);
322+
var number_current_atmospheric_pressure_variable = block.getFieldValue('current_atmospheric_pressure_variable');
323+
var code = variable_sensor_variable + '.sea_level_pressure = ' + number_current_atmospheric_pressure_variable + '\n';
324+
return code;
325+
};
326+
327+
Blockly.Python['adam_two_seven_sensor_mpu_9250_declaration'] = function(block) {
328+
Blockly.Python.definitions_['import_FaBo9Axis_MPU9250'] = 'import FaBo9Axis_MPU9250';
329+
var code = 'FaBo9Axis_MPU9250.MPU9250()';
330+
return [code, Blockly.Python.ORDER_NONE];
331+
};
332+
333+

source/generators/python/adam_two.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,4 +662,5 @@ Blockly.Python['common_sensor_gravity'] = function(block) {
662662
var variable_sensor_variable = Blockly.Python.nameDB_.getName(block.getFieldValue('sensor_variable'), Blockly.Variables.NAME_TYPE);
663663
var code = variable_sensor_variable + '.gravity';
664664
return [code, Blockly.Python.ORDER_NONE];
665-
};
665+
};
666+

0 commit comments

Comments
 (0)