diff --git a/index.html b/index.html
index 6324495..c84cb51 100644
--- a/index.html
+++ b/index.html
@@ -255,6 +255,13 @@
+
+
+
+ 97
+
+
+
diff --git a/installer/install.sh b/installer/install.sh
index 9213c8b..fdeb3ad 100644
--- a/installer/install.sh
+++ b/installer/install.sh
@@ -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
diff --git a/ugj_blocks.js b/ugj_blocks.js
index 4bf0879..41043fa 100644
--- a/ugj_blocks.js
+++ b/ugj_blocks.js
@@ -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 ** */
/*************** */
diff --git a/ugj_script.js b/ugj_script.js
index 25c7565..0a688f5 100644
--- a/ugj_script.js
+++ b/ugj_script.js
@@ -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";