mirror of
https://github.com/ocogeclub/ocoge.git
synced 2024-11-21 23:29:48 +00:00
i2c ブロックが生成するコードが間違っていたのを修正
This commit is contained in:
parent
f768a4024e
commit
ba1fadf4c2
@ -255,6 +255,13 @@
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="ugj_codechar">
|
||||
<value name="code">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">97</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
</category>
|
||||
<category name="リスト" css-icon="customIcon fas fa-list-ol" categorystyle="list_category">
|
||||
<block type="lists_create_with">
|
||||
|
@ -12,6 +12,7 @@ rm lg.zip
|
||||
cd lg
|
||||
make
|
||||
sudo make install
|
||||
cd ..
|
||||
|
||||
# install node.js (=electron node version) via n (https://github.com/tj/n)
|
||||
curl -L https://raw.githubusercontent.com/tj/n/master/bin/n -o n
|
||||
|
@ -144,6 +144,38 @@ Blockly.Python['ugj_controls_forEach'] = function (block) {
|
||||
};
|
||||
|
||||
/** Additional Basic Blocks********************************************************************************* */
|
||||
var ugjCodecharDefinition = {
|
||||
"type": "ugj_codechar",
|
||||
"message0": "%{BKY_UGJ_CODECHAR_TITLE}",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "code",
|
||||
"check": "Number"
|
||||
}
|
||||
],
|
||||
"inputsInline": true,
|
||||
"output": "String",
|
||||
"tooltip": "%{BKY_UGJ_CODECHAR_TOOLTIP}",
|
||||
"helpUrl": "",
|
||||
"style": "text_blocks"
|
||||
};
|
||||
Blockly.Blocks['ugj_codechar'] = {
|
||||
init: function () {
|
||||
this.jsonInit(ugjCodecharDefinition);
|
||||
}
|
||||
};
|
||||
Blockly.JavaScript['ugj_codechar'] = function(block) {
|
||||
var value_code = Blockly.JavaScript.valueToCode(block, 'code', Blockly.JavaScript.ORDER_ATOMIC);
|
||||
var code = `String.fromCharCode(${value_code})`;
|
||||
return [code, Blockly.JavaScript.ORDER_NONE];
|
||||
};
|
||||
Blockly.Python['ugj_codechar'] = function(block) {
|
||||
var value_code = Blockly.Python.valueToCode(block, 'code', Blockly.Python.ORDER_ATOMIC);
|
||||
var code = `chr(${value_code})`;
|
||||
return [code, Blockly.Python.ORDER_NONE];
|
||||
};
|
||||
|
||||
var ugjCharcodeDefinition = {
|
||||
"type": "ugj_charcode",
|
||||
"message0": "%{BKY_UGJ_CHARCODE_TITLE}",
|
||||
@ -812,12 +844,12 @@ Blockly.Blocks['ugj_i2c_write_byte'] = {
|
||||
};
|
||||
Blockly.JavaScript['ugj_i2c_write_byte'] = function(block) {
|
||||
var value_byte_val = Blockly.JavaScript.valueToCode(block, 'byte_val', Blockly.JavaScript.ORDER_ATOMIC);
|
||||
var code = `i2c_write_byte(i2c_hand);\n`;
|
||||
var code = `pi.i2c_write_byte(i2c_hand, ${value_byte_val});\n`;
|
||||
return code;
|
||||
};
|
||||
Blockly.Python['ugj_i2c_write_byte'] = function(block) {
|
||||
var value_byte_val = Blockly.Python.valueToCode(block, 'byte_val', Blockly.Python.ORDER_ATOMIC);
|
||||
var code = `i2c_write_byte(i2c_hand);\n`;
|
||||
var code = `pi.i2c_write_byte(i2c_hand, ${value_byte_val});\n`;
|
||||
return code;
|
||||
};
|
||||
|
||||
@ -839,11 +871,11 @@ Blockly.Blocks['ugj_i2c_read_byte'] = {
|
||||
}
|
||||
};
|
||||
Blockly.JavaScript['ugj_i2c_read_byte'] = function(block) {
|
||||
var code = `i2c_read_byte(i2c_hand)`;
|
||||
var code = `pi.i2c_read_byte(i2c_hand)`;
|
||||
return [code, Blockly.JavaScript.ORDER_NONE];
|
||||
};
|
||||
Blockly.Python['ugj_i2c_read_byte'] = function(block) {
|
||||
var code = `i2c_read_byte(i2c_hand)`;
|
||||
var code = `pi.i2c_read_byte(i2c_hand)`;
|
||||
return [code, Blockly.Python.ORDER_NONE];
|
||||
};
|
||||
|
||||
@ -2735,6 +2767,10 @@ Blockly.JavaScript['ugj_text_cr'] = function (block) {
|
||||
var code = "'\\r'";
|
||||
return [code, Blockly.JavaScript.ORDER_ATOMIC];
|
||||
};
|
||||
Blockly.Python['ugj_text_cr'] = function (block) {
|
||||
var code = "'\\r'";
|
||||
return [code, Blockly.Python.ORDER_ATOMIC];
|
||||
};
|
||||
/*************** */
|
||||
/** Line Feed ** */
|
||||
/*************** */
|
||||
|
@ -114,6 +114,8 @@ Blockly.Msg["I2C_WRITE_BYTE_DATA_TOOLTIP"] = "デバイスの指定されたレ
|
||||
Blockly.Msg["I2C_READ_BYTE_DATA_TITLE"] = "レジスタ %1 の値";
|
||||
Blockly.Msg["I2C_READ_BYTE_DATA_TOOLTIP"] = "デバイスの指定されたレジスタから1バイトを読み込みます。";
|
||||
|
||||
Blockly.Msg["UGJ_CODECHAR_TITLE"] = "コード %1 の文字";
|
||||
Blockly.Msg["UGJ_CODECHAR_TOOLTIP"] = "文字コードを文字に変換します。";
|
||||
Blockly.Msg["UGJ_CHARCODE_TITLE"] = "%1 の文字コード";
|
||||
Blockly.Msg["UGJ_CHARCODE_TOOLTIP"] = "入力テキストの1文字目の文字コードを返します。";
|
||||
Blockly.Msg["UGJ_HEXTODEC_TITLE"] = "0x %1";
|
||||
|
Loading…
Reference in New Issue
Block a user