[fix] pigpio.cppのタイポを修正 ブラウザ上で全く動作しなくなっていたのを修正

This commit is contained in:
ocogeclub 2021-11-26 22:50:52 +09:00
parent e6fe8e303d
commit 4680afcd95
5 changed files with 45 additions and 34 deletions

View File

@ -80,7 +80,8 @@ Blockly.Msg["VARIABLES_SET"] = "変数 %1 を %2 にする";
Blockly.Msg["LOGIC_BOOLEAN_FALSE"] = "偽"; Blockly.Msg["LOGIC_BOOLEAN_FALSE"] = "偽";
Blockly.Msg["LOGIC_BOOLEAN_TOOLTIP"] = "真 または 偽 を返します。"; Blockly.Msg["LOGIC_BOOLEAN_TOOLTIP"] = "真 または 偽 を返します。";
Blockly.Msg["LOGIC_BOOLEAN_TRUE"] = "真"; Blockly.Msg["LOGIC_BOOLEAN_TRUE"] = "真";
// ローカライズ対応の準備
// ローカライズ対応しといた方がいいかと思ってやってみたけど面倒になってきた
Blockly.Msg["UGJ_CONTROL_FOR_TITLE"] = "%1 %2 を %3 から %4 まで %5 ずつ %6 %7 %8"; Blockly.Msg["UGJ_CONTROL_FOR_TITLE"] = "%1 %2 を %3 から %4 まで %5 ずつ %6 %7 %8";
Blockly.Msg["UGJ_CONTROL_FOR_INDEX"] = "番号"; Blockly.Msg["UGJ_CONTROL_FOR_INDEX"] = "番号";
Blockly.Msg["UGJ_CONTROL_FOR_INCREASE"] = "増やして"; Blockly.Msg["UGJ_CONTROL_FOR_INCREASE"] = "増やして";
@ -409,7 +410,7 @@ const ugj_runCode = async () => {
// await eval(code).catch(e => { alert(e); }); // await eval(code).catch(e => { alert(e); });
let AsyncFunction = Object.getPrototypeOf(async function () { }).constructor let AsyncFunction = Object.getPrototypeOf(async function () { }).constructor
let ocogeFunc = new AsyncFunction(ugj_createCode({})); let ocogeFunc = new AsyncFunction(ugj_createCode({}));
await ocogeFunc(); await ocogeFunc().catch(e => { alert(e); });
console.log('Code Execution done.'); console.log('Code Execution done.');
} }

View File

@ -4,7 +4,6 @@
// 定数 // 定数
const ugj_const = { const ugj_const = {
doc_root: process.env["HOME"] + '/Documents',
app_name: 'ocoge', app_name: 'ocoge',
mascot_path: './img/', mascot_path: './img/',
mascot_defname: 'tamachee.png', mascot_defname: 'tamachee.png',
@ -13,7 +12,7 @@ const ugj_const = {
localStorage_fname: 'ocoge.json', localStorage_fname: 'ocoge.json',
error_ja_all: 'エラーが発生しました。\n『おこげ倶楽部』までお問い合わせください。', error_ja_all: 'エラーが発生しました。\n『おこげ倶楽部』までお問い合わせください。',
pig: 'pigpio', pig: 'pigpio',
lg: 'lgpio', // lgpioがハードウェアPWMを実装してRPiOSにプリインストールされるようになったら切り替え予 lg: 'lgpio', // 対応未
i2c_defbus: '6', // 文字列リテラルで指定 i2c_defbus: '6', // 文字列リテラルで指定
dev_hash: '4e9205f9b7e571bec1aa52ab7871f420684fcf96149672a4d550a95863d6b072' dev_hash: '4e9205f9b7e571bec1aa52ab7871f420684fcf96149672a4d550a95863d6b072'
} }
@ -32,7 +31,7 @@ class elUtil {
this.children = []; this.children = [];
this.gpio_backend = ugj_const.pig; this.gpio_backend = ugj_const.pig;
this.i2c_bus = ugj_const.i2c_defbus; this.i2c_bus = ugj_const.i2c_defbus;
this.doc_current = ugj_const.doc_root; this.doc_current = process.env["HOME"] + '/Documents';
} }
// 0で数値の桁合わせ : NUM=値 LEN=桁数 // 0で数値の桁合わせ : NUM=値 LEN=桁数
zeroPadding(NUM, LEN) { zeroPadding(NUM, LEN) {
@ -255,6 +254,10 @@ class elUtil {
} }
// ブラウザ動作用 // ブラウザ動作用
class brUtil { class brUtil {
// GPIOブロック使用時エラーダイアログ対応
constructor() {
this.gpio_backend = ugj_const.pig;
}
// マスコット // マスコット
getMascotFilePath() { return `./img/${ugj_const.mascot_defname}`; } getMascotFilePath() { return `./img/${ugj_const.mascot_defname}`; }
//ワークスペースのダウンロード //ワークスペースのダウンロード
@ -326,12 +329,18 @@ if (!is_el) {
case 'nodemailer': case 'nodemailer':
block = 'メール送信'; block = 'メール送信';
break; break;
case '@ocogeclub/gpio': case '@ocogeclub/pigpio':
block = 'GPIO'; block = 'GPIO';
break; break;
case '@ocogeclub/bme280': case '@ocogeclub/bme280':
block = 'BME280'; block = 'BME280';
break; break;
case '@ocogeclub/amg8833':
block = '赤外線アレイセンサ';
break;
case '@ocogeclub/paj7620':
block = 'ジェスチャーセンサー';
break;
case 'fs': case 'fs':
block = 'ファイル'; block = 'ファイル';
break; break;

View File

@ -331,7 +331,7 @@ Promise _serialWrite(const CallbackInfo &info)
auto buf = info[2].As<Buffer<char>>(); auto buf = info[2].As<Buffer<char>>();
int count = buf.Length(); int count = buf.Length();
deferred.Resolve(Number::New(env, serial_write(pi, handle, buf.Data(), count));); deferred.Resolve(Number::New(env, serial_write(pi, handle, buf.Data(), count)));
} }
return deferred.Promise(); return deferred.Promise();
} }

49
package-lock.json generated
View File

@ -18,12 +18,12 @@
"@tensorflow/tfjs-node": "^3.11.0", "@tensorflow/tfjs-node": "^3.11.0",
"@vladmandic/face-api": "^1.5.7", "@vladmandic/face-api": "^1.5.7",
"axios": "^0.24.0", "axios": "^0.24.0",
"nodemailer": "^6.7.0", "nodemailer": "^6.7.1",
"tensorset": "^1.2.9" "tensorset": "^1.2.9"
}, },
"devDependencies": { "devDependencies": {
"electron": "^15.3.0", "electron": "^16.0.2",
"electron-rebuild": "^3.2.3" "electron-rebuild": "^3.2.5"
} }
}, },
"local_modules/@ocogeclub/amg8833": { "local_modules/@ocogeclub/amg8833": {
@ -49,7 +49,6 @@
}, },
"local_modules/@ocogeclub/pigpio": { "local_modules/@ocogeclub/pigpio": {
"version": "0.0.1", "version": "0.0.1",
"hasInstallScript": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"bindings": "^1.5.0", "bindings": "^1.5.0",
@ -1200,9 +1199,9 @@
"dev": true "dev": true
}, },
"node_modules/electron": { "node_modules/electron": {
"version": "15.3.1", "version": "16.0.2",
"resolved": "https://registry.npmjs.org/electron/-/electron-15.3.1.tgz", "resolved": "https://registry.npmjs.org/electron/-/electron-16.0.2.tgz",
"integrity": "sha512-6/qp3Dor7HSGq28qhJEVD1zBFZoWicmo3/ZLvo7rhXPPZFwEMSJGPMEZM9WYSfWW4t/OozpWNuuDe970cF7g2Q==", "integrity": "sha512-kT746yVMztrP4BbT3nrFNcUcfgFu2yelUw6TWBVTy0pju+fBISaqcvoiMrq+8U0vRpoXSu2MJYygOf4T0Det7g==",
"dev": true, "dev": true,
"hasInstallScript": true, "hasInstallScript": true,
"dependencies": { "dependencies": {
@ -1218,9 +1217,9 @@
} }
}, },
"node_modules/electron-rebuild": { "node_modules/electron-rebuild": {
"version": "3.2.4", "version": "3.2.5",
"resolved": "https://registry.npmjs.org/electron-rebuild/-/electron-rebuild-3.2.4.tgz", "resolved": "https://registry.npmjs.org/electron-rebuild/-/electron-rebuild-3.2.5.tgz",
"integrity": "sha512-9Si+pehS1h9Oo0SxJxWkkgvcYm0XrPx3ZzT3Ai7tVjT1ZK5v8v0FrKhER3I4/Hg5lmS5iPmKbCYK4sbW+Y6q7Q==", "integrity": "sha512-U9dKi10V9w/BdIVB8a8dTKYLK3Q1d2WZ+Yo5qfM3XX/O4jI7KpnwgvWgGoVv0jTWPC2NlebF00ffWS/8NfUAtA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@malept/cross-spawn-promise": "^2.0.0", "@malept/cross-spawn-promise": "^2.0.0",
@ -1232,8 +1231,9 @@
"lzma-native": "^8.0.1", "lzma-native": "^8.0.1",
"node-abi": "^3.0.0", "node-abi": "^3.0.0",
"node-api-version": "^0.1.4", "node-api-version": "^0.1.4",
"node-gyp": "^8.1.0", "node-gyp": "^8.4.0",
"ora": "^5.1.0", "ora": "^5.1.0",
"semver": "^7.3.5",
"tar": "^6.0.5", "tar": "^6.0.5",
"yargs": "^17.0.1" "yargs": "^17.0.1"
}, },
@ -2583,9 +2583,9 @@
} }
}, },
"node_modules/nodemailer": { "node_modules/nodemailer": {
"version": "6.7.0", "version": "6.7.1",
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.7.0.tgz", "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.7.1.tgz",
"integrity": "sha512-AtiTVUFHLiiDnMQ43zi0YgkzHOEWUkhDgPlBXrsDzJiJvB29Alo4OKxHQ0ugF3gRqRQIneCLtZU3yiUo7pItZw==", "integrity": "sha512-E1C8G3rnXrGjznwGP1k+OrW5k4rl0XtqTEB19f7vtJAMYwfxZVSsAu2iY5xJkrZsbVYr6PwwAwRmFlakPoFC0A==",
"engines": { "engines": {
"node": ">=6.0.0" "node": ">=6.0.0"
} }
@ -4521,9 +4521,9 @@
"dev": true "dev": true
}, },
"electron": { "electron": {
"version": "15.3.1", "version": "16.0.2",
"resolved": "https://registry.npmjs.org/electron/-/electron-15.3.1.tgz", "resolved": "https://registry.npmjs.org/electron/-/electron-16.0.2.tgz",
"integrity": "sha512-6/qp3Dor7HSGq28qhJEVD1zBFZoWicmo3/ZLvo7rhXPPZFwEMSJGPMEZM9WYSfWW4t/OozpWNuuDe970cF7g2Q==", "integrity": "sha512-kT746yVMztrP4BbT3nrFNcUcfgFu2yelUw6TWBVTy0pju+fBISaqcvoiMrq+8U0vRpoXSu2MJYygOf4T0Det7g==",
"dev": true, "dev": true,
"requires": { "requires": {
"@electron/get": "^1.13.0", "@electron/get": "^1.13.0",
@ -4540,9 +4540,9 @@
} }
}, },
"electron-rebuild": { "electron-rebuild": {
"version": "3.2.4", "version": "3.2.5",
"resolved": "https://registry.npmjs.org/electron-rebuild/-/electron-rebuild-3.2.4.tgz", "resolved": "https://registry.npmjs.org/electron-rebuild/-/electron-rebuild-3.2.5.tgz",
"integrity": "sha512-9Si+pehS1h9Oo0SxJxWkkgvcYm0XrPx3ZzT3Ai7tVjT1ZK5v8v0FrKhER3I4/Hg5lmS5iPmKbCYK4sbW+Y6q7Q==", "integrity": "sha512-U9dKi10V9w/BdIVB8a8dTKYLK3Q1d2WZ+Yo5qfM3XX/O4jI7KpnwgvWgGoVv0jTWPC2NlebF00ffWS/8NfUAtA==",
"dev": true, "dev": true,
"requires": { "requires": {
"@malept/cross-spawn-promise": "^2.0.0", "@malept/cross-spawn-promise": "^2.0.0",
@ -4554,8 +4554,9 @@
"lzma-native": "^8.0.1", "lzma-native": "^8.0.1",
"node-abi": "^3.0.0", "node-abi": "^3.0.0",
"node-api-version": "^0.1.4", "node-api-version": "^0.1.4",
"node-gyp": "^8.1.0", "node-gyp": "^8.4.0",
"ora": "^5.1.0", "ora": "^5.1.0",
"semver": "^7.3.5",
"tar": "^6.0.5", "tar": "^6.0.5",
"yargs": "^17.0.1" "yargs": "^17.0.1"
}, },
@ -5589,9 +5590,9 @@
"dev": true "dev": true
}, },
"nodemailer": { "nodemailer": {
"version": "6.7.0", "version": "6.7.1",
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.7.0.tgz", "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.7.1.tgz",
"integrity": "sha512-AtiTVUFHLiiDnMQ43zi0YgkzHOEWUkhDgPlBXrsDzJiJvB29Alo4OKxHQ0ugF3gRqRQIneCLtZU3yiUo7pItZw==" "integrity": "sha512-E1C8G3rnXrGjznwGP1k+OrW5k4rl0XtqTEB19f7vtJAMYwfxZVSsAu2iY5xJkrZsbVYr6PwwAwRmFlakPoFC0A=="
}, },
"nopt": { "nopt": {
"version": "5.0.0", "version": "5.0.0",

View File

@ -19,8 +19,8 @@
}, },
"homepage": "https://github.com/ocogeclub/ocoge#readme", "homepage": "https://github.com/ocogeclub/ocoge#readme",
"devDependencies": { "devDependencies": {
"electron": "^15.3.0", "electron": "^16.0.2",
"electron-rebuild": "^3.2.3" "electron-rebuild": "^3.2.5"
}, },
"dependencies": { "dependencies": {
"@ocogeclub/amg8833": "file:local_modules/@ocogeclub/amg8833", "@ocogeclub/amg8833": "file:local_modules/@ocogeclub/amg8833",
@ -32,7 +32,7 @@
"@tensorflow/tfjs-node": "^3.11.0", "@tensorflow/tfjs-node": "^3.11.0",
"@vladmandic/face-api": "^1.5.7", "@vladmandic/face-api": "^1.5.7",
"axios": "^0.24.0", "axios": "^0.24.0",
"nodemailer": "^6.7.0", "nodemailer": "^6.7.1",
"tensorset": "^1.2.9" "tensorset": "^1.2.9"
} }
} }