[update] インストーラに lgpioを追加

This commit is contained in:
ocogeclub 2021-09-09 17:41:39 +09:00
parent 99fd55d53a
commit f768a4024e
3 changed files with 42 additions and 13 deletions

View File

@ -1,9 +1,21 @@
#!/bin/bash -x
# Usage: bash install.sh
NODEJS=14.17.0
# install lgpio (and python3)
sudo apt update
sudo apt install python3 swig python3-dev python3-setuptools -y
wget http://abyz.me.uk/lg/lg.zip
unzip lg.zip
rm lg.zip
cd lg
make
sudo make install
# 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
sudo bash n 14.17.0
sudo bash n $NODEJS
# install python code formatter
python3 -m pip install black
# install desktop entry

View File

@ -2677,18 +2677,26 @@ Blockly.JavaScript['ugj_blackboard_content'] = function (block) {
/************* */
/** Soft Sleep */
/************* */
var ugjSleepDefinition = {
"type": "ugj_sleep",
"message0": "%{BKY_UGJ_SLEEP_TITLE}",
"args0": [
{
"type": "input_value",
"name": "sec",
"check": "Number"
}
],
"inputsInline": true,
"previousStatement": null,
"nextStatement": null,
"tooltip": "%{BKY_UGJ_SLEEP_TOOLTIP}",
"helpUrl": "",
"style": "special_blocks"
};
Blockly.Blocks['ugj_sleep'] = {
init: function () {
this.appendValueInput("sec")
.setCheck("Number");
this.appendDummyInput()
.appendField("秒待つ");
this.setInputsInline(true);
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setStyle('special_blocks')
this.setTooltip("指定した秒数だけ処理を中断します。");
this.setHelpUrl("");
this.jsonInit(ugjSleepDefinition);
}
};
Blockly.JavaScript['ugj_sleep'] = function (block) {
@ -2698,10 +2706,17 @@ Blockly.JavaScript['ugj_sleep'] = function (block) {
['const ' + Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_ + ' = milisec =>',
'new Promise(r => setTimeout(r, milisec));']
);
var code = `await ${functionName}(${value_sec}*1000);`;
var code = `await ${functionName}(${value_sec}*1000);\n`;
return code;
};
Blockly.Python['ugj_sleep'] = function(block) {
var value_sec = Blockly.Python.valueToCode(block, 'sec', Blockly.Python.ORDER_ATOMIC);
Blockly.Python.provideFunction_(
'import_sleep', ['from time import sleep']
)
var code = `sleep(${value_sec})\n`;
return code;
};
/********************* */
/** Carriage Return ** */
/********************* */

View File

@ -123,6 +123,8 @@ Blockly.Msg["UGJ_DECTOHEX_TOOLTIP"] = "10進数を16進数に変換します。"
Blockly.Msg["UGJ_CANVAS_INIT_TITLE"] = "キャンバスを表示";
Blockly.Msg["UGJ_CANVAS_INIT_TOOLTIP"] = "キャンバスを表示し、使用できるようにします。";
Blockly.Msg["UGJ_SLEEP_TITLE"] = "%1 秒待つ";
Blockly.Msg["UGJ_SLEEP_TOOLTIP"] = "指定した秒数だけ処理を中断します。";
// Customize Toolbox
class CustomCategory extends Blockly.ToolboxCategory {