Skip to content

Commit

Permalink
Fix: grammatical error in the comment block.
Browse files Browse the repository at this point in the history
Added: block for bmp280 and mpu9250.
  • Loading branch information
vertigra committed Jul 20, 2023
1 parent b8ee12d commit ee1f0e3
Show file tree
Hide file tree
Showing 5 changed files with 301 additions and 7 deletions.
2 changes: 1 addition & 1 deletion source/blocks/adam_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -2007,7 +2007,7 @@ Blockly.defineBlocksWithJsonArray([
*/
{
"type": "common_comment",
"message0": "коментарий %1",
"message0": "комментарий %1",
"args0": [
{
"type": "field_input",
Expand Down
233 changes: 232 additions & 1 deletion source/blocks/adam_three.js
Original file line number Diff line number Diff line change
Expand Up @@ -894,4 +894,235 @@ Blockly.defineBlocksWithJsonArray([
"colour": 220,
"tooltip": "",
"helpUrl": ""
}]);
},

/**
* adam_two_seven_sensor_temperature
*
*/
{
"type": "adam_two_seven_sensor_temperature",
"message0": "датчик температуры %1 переменная класса датчика %2",
"args0": [
{
"type": "input_dummy"
},
{
"type": "field_variable",
"name": "sensor_variable",
"variable": "item"
}
],
"output": null,
"colour": 160,
"tooltip": "",
"helpUrl": ""
},

/**
* adam_two_seven_sensor_acceleration
*
*/
{
"type": "adam_two_seven_sensor_acceleration",
"message0": "датчик ускорения %1 переменная класса датчика %2",
"args0": [
{
"type": "input_dummy"
},
{
"type": "field_variable",
"name": "sensor_variable",
"variable": "item"
}
],
"output": null,
"colour": 160,
"tooltip": "",
"helpUrl": ""
},

/**
* adam_two_seven_sensor_gyro
*
*/
{
"type": "adam_two_seven_sensor_gyro",
"message0": "гироскоп %1 переменная класса датчика %2",
"args0": [
{
"type": "input_dummy"
},
{
"type": "field_variable",
"name": "sensor_variable",
"variable": "item"
}
],
"output": null,
"colour": 160,
"tooltip": "",
"helpUrl": ""
},

/**
* adam_two_seven_sensor_magnetometer
*
*/
{
"type": "adam_two_seven_sensor_magnetometer",
"message0": "магнитометр %1 переменная класса датчика %2",
"args0": [
{
"type": "input_dummy"
},
{
"type": "field_variable",
"name": "sensor_variable",
"variable": "item"
}
],
"output": null,
"colour": 160,
"tooltip": "",
"helpUrl": ""
},

/**
* adam_two_seven_sensor_pressure
*
*/
{
"type": "adam_two_seven_sensor_pressure",
"message0": "давление %1 переменная класса датчика %2",
"args0": [
{
"type": "input_dummy"
},
{
"type": "field_variable",
"name": "sensor_variable",
"variable": "item"
}
],
"output": null,
"colour": 160,
"tooltip": "",
"helpUrl": ""
},

/**
* adam_two_seven_sensor_altitude
*
*/
{
"type": "adam_two_seven_sensor_altitude",
"message0": "высота над уровнем моря %1 переменная класса датчика %2",
"args0": [
{
"type": "input_dummy"
},
{
"type": "field_variable",
"name": "sensor_variable",
"variable": "item"
}
],
"output": null,
"colour": 160,
"tooltip": "",
"helpUrl": ""
},

/**
* adam_two_seven_sensor_declaration_extended
*
*/
{
"type": "adam_two_seven_sensor_declaration_extended",
"message0": "инициализация датчика bmp280 %1 переменная шины i2c %2 %3 адрес устройства i2c %4",
"args0": [
{
"type": "input_dummy"
},
{
"type": "field_variable",
"name": "i2c_variable",
"variable": "item"
},
{
"type": "input_dummy"
},
{
"type": "input_value",
"name": "sensor_address"
}
],
"output": null,
"colour": 160,
"tooltip": "",
"helpUrl": ""
},

{
"type": "adam_two_seven_bmp280_addr_const",
"message0": "адрес датчика bmp280 %1",
"args0": [
{
"type": "field_dropdown",
"name": "addr_variable",
"options": [
[
"0x76",
"0x76"
],
[
"0x77",
"0x77"
]
]
}
],
"output": null,
"colour": 160,
"tooltip": "",
"helpUrl": ""
},

{
"type": "adam_two_seven_sensor_set_pressure",
"message0": "поправка для атмосферного давления %1 переменная класса датчика %2 %3 текущее атмосферное давление %4",
"args0": [
{
"type": "input_dummy"
},
{
"type": "field_variable",
"name": "sensor_variable",
"variable": "item"
},
{
"type": "input_dummy"
},
{
"type": "field_number",
"name": "current_atmospheric_pressure_variable",
"value": 1000
}
],
"previousStatement": null,
"nextStatement": null,
"colour": 160,
"tooltip": "",
"helpUrl": ""
},

{
"type": "adam_two_seven_sensor_mpu_9250_declaration",
"message0": "инициализация датчика mpu9250",
"output": null,
"colour": 160,
"tooltip": "",
"helpUrl": ""
}
]);
3 changes: 0 additions & 3 deletions source/generators/python/adam_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,6 @@ Blockly.Python['common_music_mixer_init'] = function(block) {
*/
Blockly.Python['common_music_mixer_load'] = function(block) {
var value_path = Blockly.Python.valueToCode(block, 'path', Blockly.Python.ORDER_NONE);
// TODO: Assemble Python into code variable.
var code = 'pygame.mixer.music.load(' + value_path + ')\n';
return code;
};
Expand Down Expand Up @@ -399,7 +398,6 @@ Blockly.Python['common_music_fraction'] = function(block) {
Blockly.Python['common_say_native'] = function(block) {
Blockly.Python.definitions_['import_subprocess'] = 'import subprocess';
var value_text = Blockly.Python.valueToCode(block, 'text', Blockly.Python.ORDER_ATOMIC);
// TODO: Assemble Python into code variable.
var code = 'subprocess.call("echo ' + value_text + ' | RHVoice-test --profile \'aleksandr-hq\' 2>/dev/null", shell=True)';
return code;
};
Expand All @@ -412,7 +410,6 @@ Blockly.Python['common_say_native_with_voice_param'] = function(block) {
Blockly.Python.definitions_['import_subprocess'] = 'import subprocess';
var value_text = Blockly.Python.valueToCode(block, 'text', Blockly.Python.ORDER_ATOMIC);
var value_voice = Blockly.Python.valueToCode(block, 'voice', Blockly.Python.ORDER_ATOMIC);
// TODO: Assemble Python into code variable.
var code = 'subprocess.call("echo ' + value_text + ' | RHVoice-test --profile ' + value_voice + ' 2>/dev/null", shell=True)';
return code;
};
Expand Down
67 changes: 66 additions & 1 deletion source/generators/python/adam_three.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,4 +265,69 @@ Blockly.Python['controller_const_left_foot'] = function(block) {
Blockly.Python['controller_const_right_foot'] = function(block) {
var code = "'right_foot'";
return [code, Blockly.Python.ORDER_ATOMIC];
};
};

Blockly.Python['adam_two_seven_sensor_temperature'] = function(block) {
var variable_sensor_variable = Blockly.Python.nameDB_.getName(block.getFieldValue('sensor_variable'), Blockly.Variables.NAME_TYPE);
var code = variable_sensor_variable + '.temperature';
return [code, Blockly.Python.ORDER_NONE];
};

Blockly.Python['adam_two_seven_sensor_pressure'] = function(block) {
var variable_sensor_variable = Blockly.Python.nameDB_.getName(block.getFieldValue('sensor_variable'), Blockly.Variables.NAME_TYPE);
var code = variable_sensor_variable + '.pressure';
return [code, Blockly.Python.ORDER_NONE];
};

Blockly.Python['adam_two_seven_sensor_altitude'] = function(block) {
var variable_sensor_variable = Blockly.Python.nameDB_.getName(block.getFieldValue('sensor_variable'), Blockly.Variables.NAME_TYPE);
var code = variable_sensor_variable + '.altitude';
return [code, Blockly.Python.ORDER_NONE];
};
Blockly.Python['adam_two_seven_sensor_acceleration'] = function(block) {
var variable_sensor_variable = Blockly.Python.nameDB_.getName(block.getFieldValue('sensor_variable'), Blockly.Variables.NAME_TYPE);
var code = variable_sensor_variable + '.readAccel()';
return [code, Blockly.Python.ORDER_NONE];
};

Blockly.Python['adam_two_seven_sensor_gyro'] = function(block) {
var variable_sensor_variable = Blockly.Python.nameDB_.getName(block.getFieldValue('sensor_variable'), Blockly.Variables.NAME_TYPE);
var code = variable_sensor_variable + '.readGyro()';
return [code, Blockly.Python.ORDER_NONE];
};

Blockly.Python['adam_two_seven_sensor_magnetometer'] = function(block) {
var variable_sensor_variable = Blockly.Python.nameDB_.getName(block.getFieldValue('sensor_variable'), Blockly.Variables.NAME_TYPE);
var code = variable_sensor_variable + '.readMagnet()';
return [code, Blockly.Python.ORDER_NONE];
};


Blockly.Python['adam_two_seven_sensor_declaration_extended'] = function(block) {
Blockly.Python.definitions_['import_adafruit_bmp280'] = 'import adafruit_bmp280';
var variable_i2c_variable = Blockly.Python.nameDB_.getName(block.getFieldValue('i2c_variable'), Blockly.Variables.NAME_TYPE);
var value_sensor_address = Blockly.Python.valueToCode(block, 'sensor_address', Blockly.Python.ORDER_NONE);
var code = 'adafruit_bmp280.Adafruit_BMP280_I2C(' + variable_i2c_variable + ', ' + value_sensor_address + ')';
return [code, Blockly.Python.ORDER_NONE];
};

Blockly.Python['adam_two_seven_bmp280_addr_const'] = function(block) {
var dropdown_addr_variable = block.getFieldValue('addr_variable');
var code = dropdown_addr_variable;
return [code, Blockly.Python.ORDER_NONE];
};

Blockly.Python['adam_two_seven_sensor_set_pressure'] = function(block) {
var variable_sensor_variable = Blockly.Python.nameDB_.getName(block.getFieldValue('sensor_variable'), Blockly.Variables.NAME_TYPE);
var number_current_atmospheric_pressure_variable = block.getFieldValue('current_atmospheric_pressure_variable');
var code = variable_sensor_variable + '.sea_level_pressure = ' + number_current_atmospheric_pressure_variable + '\n';
return code;
};

Blockly.Python['adam_two_seven_sensor_mpu_9250_declaration'] = function(block) {
Blockly.Python.definitions_['import_FaBo9Axis_MPU9250'] = 'import FaBo9Axis_MPU9250';
var code = 'FaBo9Axis_MPU9250.MPU9250()';
return [code, Blockly.Python.ORDER_NONE];
};


3 changes: 2 additions & 1 deletion source/generators/python/adam_two.js
Original file line number Diff line number Diff line change
Expand Up @@ -662,4 +662,5 @@ Blockly.Python['common_sensor_gravity'] = function(block) {
var variable_sensor_variable = Blockly.Python.nameDB_.getName(block.getFieldValue('sensor_variable'), Blockly.Variables.NAME_TYPE);
var code = variable_sensor_variable + '.gravity';
return [code, Blockly.Python.ORDER_NONE];
};
};

0 comments on commit ee1f0e3

Please sign in to comment.