[update] Web Demo でもセンサーブロックが表示されるようにした

This commit is contained in:
ocogeclub 2023-01-10 21:46:36 +09:00
parent 49f3712704
commit ef8f659468
15 changed files with 416 additions and 398 deletions

View File

@ -9,9 +9,9 @@ const ugj_const = {
mascot_defname: 'tamachee.png', mascot_defname: 'tamachee.png',
library_dirname: 'lib', library_dirname: 'lib',
document_root: 'Documents', document_root: 'Documents',
tmp_dir: '.ocogeclub/tmp', tmp_dir: '.ocogeclub/tmp', //ホームディレクトリからのパス
executable_path: '.ocogeclub/apps/', executable_path: '.ocogeclub/apps/', //ホームディレクトリからのパス
blocks_sensors_dir: 'blocks/sensors/', blocks_dir: './blocks', // 動作するコードを web demo で生成するためには「./」をつける
localStorage_fname: 'ocoge.json', localStorage_fname: 'ocoge.json',
error_ja_all: 'エラーが発生しました。\n『おこげ倶楽部』までお問い合わせください。', error_ja_all: 'エラーが発生しました。\n『おこげ倶楽部』までお問い合わせください。',
pig: 'pigpio', pig: 'pigpio',
@ -38,7 +38,7 @@ class appTool {
this.doc_root = this.path.join(process.env["HOME"], ugj_const.document_root); this.doc_root = this.path.join(process.env["HOME"], ugj_const.document_root);
this.doc_current = this.path.join(process.env["HOME"], ugj_const.document_root); this.doc_current = this.path.join(process.env["HOME"], ugj_const.document_root);
this.executable_path = this.path.join(process.env["HOME"], ugj_const.executable_path); this.executable_path = this.path.join(process.env["HOME"], ugj_const.executable_path);
// this.blocks_sensors_dir = this.path.join(process.env["HOME"], ugj_const.blocks_sensors_dir); // this.blocks_dir = this.path.join(process.env["HOME"], ugj_const.blocks_dir);
this.tmp_dir = this.path.join(process.env["HOME"], ugj_const.tmp_dir); this.tmp_dir = this.path.join(process.env["HOME"], ugj_const.tmp_dir);
const EventEmitter = require('events'); const EventEmitter = require('events');
this.ugjEmitter = new EventEmitter(); this.ugjEmitter = new EventEmitter();
@ -51,44 +51,44 @@ class appTool {
this.app_path = await this.ipcRenderer.invoke('get_app_path'); this.app_path = await this.ipcRenderer.invoke('get_app_path');
this.mascotFilePath = this.path.join(this.app_path, ugj_const.mascot_dirname, ugj_const.mascot_defname); this.mascotFilePath = this.path.join(this.app_path, ugj_const.mascot_dirname, ugj_const.mascot_defname);
this.library_path = this.path.join(this.app_path, ugj_const.library_dirname); this.library_path = this.path.join(this.app_path, ugj_const.library_dirname);
this.blocks_sensors_dir = this.path.join(this.app_path, ugj_const.blocks_sensors_dir); this.blocks_dir = this.path.join(this.app_path, ugj_const.blocks_dir);
this.loadSensorblocks(); // this.loadSensorblocks();
} }
// センサーブロックのロード // センサーブロックのロード
loadSensorblocks() { // loadSensorblocks() {
// ディレクトリの有無 // // ディレクトリの有無
if (!this.fs.existsSync(this.blocks_sensors_dir)) return; // if (!this.fs.existsSync(this.blocks_dir)) return;
// ブロックデータ格納ディレクトリのリスト // // ブロックデータ格納ディレクトリのリスト
const allDirents = this.fs.readdirSync(this.blocks_sensors_dir, { withFileTypes: true }); // const allDirents = this.fs.readdirSync(this.blocks_dir, { withFileTypes: true });
const blocks_list = allDirents.filter(dirent => dirent.isDirectory()).map(({ name }) => name); // const blocks_list = allDirents.filter(dirent => dirent.isDirectory()).map(({ name }) => name);
// センサーカテゴリのインスタンス // // センサーカテゴリのインスタンス
let category_sensors = workspace.getToolbox().getToolboxItemById('category_sensors'); // let category_sensors = workspace.getToolbox().getToolboxItemById('category_sensors');
let flyout_contents = []; // フライアウトのjsonのリスト // let flyout_contents = []; // フライアウトのjsonのリスト
for (let sensor_dir of blocks_list) { //ディレクトリ巡り // for (let sensor_dir of blocks_list) { //ディレクトリ巡り
if (sensor_dir.charAt(0) == '.') continue; //隠しディレクトリをスキップ // if (sensor_dir.charAt(0) == '.') continue; //隠しディレクトリをスキップ
// フライアウトのjsonを取得してパース、リストに追加 // // フライアウトのjsonを取得してパース、リストに追加
let fname = this.path.join(this.blocks_sensors_dir, sensor_dir, 'index.json'); // let fname = this.path.join(this.blocks_dir, sensor_dir, 'index.json');
let json_text = this.fs.readFileSync(fname); // let json_text = this.fs.readFileSync(fname);
let obj = JSON.parse(json_text); // let obj = JSON.parse(json_text);
flyout_contents = flyout_contents.concat(obj); // flyout_contents = flyout_contents.concat(obj);
// ブロック定義のスクリプト要素をbody要素の最後に追加 // // ブロック定義のスクリプト要素をbody要素の最後に追加
fname = this.path.join(this.blocks_sensors_dir, sensor_dir, 'index.js'); // fname = this.path.join(this.blocks_dir, sensor_dir, 'index.js');
let script = document.createElement('script'); // let script = document.createElement('script');
script.type = 'text/javascript'; // script.type = 'text/javascript';
script.src = fname; // script.src = fname;
document.body.appendChild(script); // document.body.appendChild(script);
} // }
let lastline = [{ // let lastline = [{
"kind": "label", // "kind": "label",
"text": " ", // "text": " ",
"web-line": "4.0", // "web-line": "4.0",
"web-line-width": "200" // "web-line-width": "200"
}]; // }];
flyout_contents = flyout_contents.concat(lastline); // flyout_contents = flyout_contents.concat(lastline);
// センサーカテゴリのフライアウトをアップデート // // センサーカテゴリのフライアウトをアップデート
category_sensors.updateFlyoutContents(flyout_contents); // category_sensors.updateFlyoutContents(flyout_contents);
} // }
// 0で数値の桁合わせ : NUM=値 LEN=桁数 // 0で数値の桁合わせ : NUM=値 LEN=桁数
@ -332,6 +332,7 @@ class webTool {
// GPIOブロックは使えません // GPIOブロックは使えません
this.gpio_backend = ugj_const.pig; this.gpio_backend = ugj_const.pig;
this.lang = 'js'; this.lang = 'js';
this.blocks_dir = ugj_const.blocks_dir;
} }
// マスコット // マスコット
@ -378,7 +379,12 @@ class webTool {
cleanupGPIO() { ; } cleanupGPIO() { ; }
path = { path = {
join: function (a = '', b = '', c = '', d = '', e = '') { join: function (a = '', b = '', c = '', d = '', e = '') {
return a + b + c + d + e; const removeTrailingSlash = path => path.endsWith('/') ? path.substr(0, path.length - 1) : path;
return removeTrailingSlash(a) +
(b ? '/' + removeTrailingSlash(b) : '') +
(c ? '/' + removeTrailingSlash(c) : '') +
(d ? '/' + removeTrailingSlash(d) : '') +
(e ? '/' + removeTrailingSlash(e) : '')
} }
} }
} }

20
blocks/index.js Normal file
View File

@ -0,0 +1,20 @@
var flyout_contents = [];
const registerCategory = (category_dir, subcategories) => {
for (let sbctgr of subcategories) {
let fname = ugj_const.blocks_dir + '/' + category_dir + "/" + sbctgr + "/index.js";
let script = document.createElement('script');
script.type = 'text/javascript';
script.src = fname;
script.async = false;
document.body.appendChild(script);
}
}
// センサーカテゴリ
registerCategory('sensors', [ // カテゴリディレクトリ名
"amg8833",
"paj7620",
"bme280",
"dht11",
"z-line" // フライアウト下端の不可視ライン。スクリプトにカテゴリ名を含むので注意
]);

View File

@ -25,7 +25,7 @@ Blockly.Msg["UGJ_TENSORSET_PARSE_TOOLTIP"] = "JSONテキストをパースして
/******************* */ /******************* */
/** Init Grid-Eye ** */ /** Init Grid-Eye ** */
/******************* */ /******************* */
var ugjGridEyeInitDefinition = { Blockly.defineBlocksWithJsonArray([{
"type": "ugj_grideye_init", "type": "ugj_grideye_init",
"message0": "%{BKY_UGJ_GRIDEYE_INIT_TITLE}", "message0": "%{BKY_UGJ_GRIDEYE_INIT_TITLE}",
"args0": [ "args0": [
@ -50,18 +50,13 @@ var ugjGridEyeInitDefinition = {
"tooltip": "%{BKY_UGJ_GRIDEYE_INIT_TOOLTIP}", "tooltip": "%{BKY_UGJ_GRIDEYE_INIT_TOOLTIP}",
"helpUrl": "", "helpUrl": "",
"style": "sensor_blocks" "style": "sensor_blocks"
}; }]);
Blockly.Blocks['ugj_grideye_init'] = {
init: function () {
this.jsonInit(ugjGridEyeInitDefinition);
}
};
Blockly.JavaScript['ugj_grideye_init'] = function (block) { Blockly.JavaScript['ugj_grideye_init'] = function (block) {
var dropdown_addr = block.getFieldValue('addr'); var dropdown_addr = block.getFieldValue('addr');
Blockly.JavaScript.provideFunction_( Blockly.JavaScript.provideFunction_(
'require_gpio', [`const _pi = require('@ocoge.club/` + apptool.gpio_backend + `');`] 'require_gpio', [`const _pi = require('@ocoge.club/` + apptool.gpio_backend + `');`]
); );
let modpath = apptool.path.join(apptool.blocks_sensors_dir, 'amg8833', 'AMG8833x.js'); let modpath = apptool.path.join(apptool.blocks_dir, 'sensors', 'amg8833', 'AMG8833x.js');
Blockly.JavaScript.provideFunction_( Blockly.JavaScript.provideFunction_(
'require_amg8833', [`const _amg8833 = require('${modpath}');`] 'require_amg8833', [`const _amg8833 = require('${modpath}');`]
); );
@ -71,19 +66,14 @@ Blockly.JavaScript['ugj_grideye_init'] = function (block) {
/********************** */ /********************** */
/** Grid-Eye 本体温度 ** */ /** Grid-Eye 本体温度 ** */
/********************** */ /********************** */
var ugjGridEyeThermistorDefinition = { Blockly.defineBlocksWithJsonArray([{
"type": "ugj_grideye_thermistor", "type": "ugj_grideye_thermistor",
"message0": "%{BKY_UGJ_GRIDEYE_THERMISTOR_TITLE}", "message0": "%{BKY_UGJ_GRIDEYE_THERMISTOR_TITLE}",
"output": "Number", "output": "Number",
"tooltip": "%{BKY_UGJ_GRIDEYE_THERMISTOR_TOOLTIP}", "tooltip": "%{BKY_UGJ_GRIDEYE_THERMISTOR_TOOLTIP}",
"helpUrl": "", "helpUrl": "",
"style": "sensor_blocks" "style": "sensor_blocks"
}; }]);
Blockly.Blocks['ugj_grideye_thermistor'] = {
init: function () {
this.jsonInit(ugjGridEyeThermistorDefinition);
}
};
Blockly.JavaScript['ugj_grideye_thermistor'] = function (block) { Blockly.JavaScript['ugj_grideye_thermistor'] = function (block) {
var code = `await _amg8833.read_thermistor()`; var code = `await _amg8833.read_thermistor()`;
return [code, Blockly.JavaScript.ORDER_NONE]; return [code, Blockly.JavaScript.ORDER_NONE];
@ -92,7 +82,7 @@ Blockly.JavaScript['ugj_grideye_thermistor'] = function (block) {
/**************************** */ /**************************** */
/** Read Temperature Array ** */ /** Read Temperature Array ** */
/**************************** */ /**************************** */
var ugjGridEyeReadDefinition = { Blockly.defineBlocksWithJsonArray([{
"type": "ugj_grideye_read", "type": "ugj_grideye_read",
"message0": "%{BKY_UGJ_GRIDEYE_READ_TITLE}", "message0": "%{BKY_UGJ_GRIDEYE_READ_TITLE}",
"inputsInline": true, "inputsInline": true,
@ -100,12 +90,7 @@ var ugjGridEyeReadDefinition = {
"tooltip": "%{BKY_UGJ_GRIDEYE_READ_TOOLTIP}", "tooltip": "%{BKY_UGJ_GRIDEYE_READ_TOOLTIP}",
"helpUrl": "", "helpUrl": "",
"style": "sensor_blocks" "style": "sensor_blocks"
}; }]);
Blockly.Blocks['ugj_grideye_read'] = {
init: function () {
this.jsonInit(ugjGridEyeReadDefinition);
}
};
Blockly.JavaScript['ugj_grideye_read'] = function (block) { Blockly.JavaScript['ugj_grideye_read'] = function (block) {
var code = 'await _amg8833.read_temp_array()'; var code = 'await _amg8833.read_temp_array()';
return [code, Blockly.JavaScript.ORDER_ATOMIC]; return [code, Blockly.JavaScript.ORDER_ATOMIC];
@ -113,7 +98,7 @@ Blockly.JavaScript['ugj_grideye_read'] = function (block) {
/******************* */ /******************* */
/** Stop Grid-Eye ** */ /** Stop Grid-Eye ** */
/******************* */ /******************* */
var ugjGridEyeStopDefinition = { Blockly.defineBlocksWithJsonArray([{
"type": "ugj_grideye_stop", "type": "ugj_grideye_stop",
"message0": "%{BKY_UGJ_GRIDEYE_STOP_TITLE}", "message0": "%{BKY_UGJ_GRIDEYE_STOP_TITLE}",
"inputsInline": true, "inputsInline": true,
@ -122,12 +107,7 @@ var ugjGridEyeStopDefinition = {
"tooltip": "%{BKY_UGJ_GRIDEYE_STOP_TOOLTIP}", "tooltip": "%{BKY_UGJ_GRIDEYE_STOP_TOOLTIP}",
"helpUrl": "", "helpUrl": "",
"style": "sensor_blocks" "style": "sensor_blocks"
}; }]);
Blockly.Blocks['ugj_grideye_stop'] = {
init: function () {
this.jsonInit(ugjGridEyeStopDefinition);
}
};
Blockly.JavaScript['ugj_grideye_stop'] = function (block) { Blockly.JavaScript['ugj_grideye_stop'] = function (block) {
var code = 'await _amg8833.stop();\n'; var code = 'await _amg8833.stop();\n';
return code; return code;
@ -137,7 +117,7 @@ Blockly.JavaScript['ugj_grideye_stop'] = function (block) {
/***************************** */ /***************************** */
/** GridEye 表示キャンバス作成 ** */ /** GridEye 表示キャンバス作成 ** */
/***************************** */ /***************************** */
var ugjGridEyeCanvasCreateDefinition = { Blockly.defineBlocksWithJsonArray([{
"type": "ugj_grideye_canvas_create", "type": "ugj_grideye_canvas_create",
"message0": "%{BKY_UGJ_GRIDEYE_CANVAS_CREATE_TITLE}", "message0": "%{BKY_UGJ_GRIDEYE_CANVAS_CREATE_TITLE}",
"inputsInline": true, "inputsInline": true,
@ -146,12 +126,7 @@ var ugjGridEyeCanvasCreateDefinition = {
"tooltip": "%{BKY_UGJ_GRIDEYE_CANVAS_CREATE_TOOLTIP}", "tooltip": "%{BKY_UGJ_GRIDEYE_CANVAS_CREATE_TOOLTIP}",
"helpUrl": "", "helpUrl": "",
"style": "multimedia_blocks" "style": "multimedia_blocks"
}; }]);
Blockly.Blocks['ugj_grideye_canvas_create'] = {
init: function () {
this.jsonInit(ugjGridEyeCanvasCreateDefinition);
}
};
Blockly.JavaScript['ugj_grideye_canvas_create'] = function (block) { Blockly.JavaScript['ugj_grideye_canvas_create'] = function (block) {
var code = `let _grideye_canvas = document.createElement('canvas'); var code = `let _grideye_canvas = document.createElement('canvas');
_grideye_canvas.setAttribute('width', 8); _grideye_canvas.setAttribute('width', 8);
@ -169,7 +144,8 @@ Blockly.JavaScript['ugj_grideye_canvas_create'] = function (block) {
/********************************************** */ /********************************************** */
/** Draw IR Array Data to Image Data ** */ /** Draw IR Array Data to Image Data ** */
/********************************************** */ /********************************************** */
var ugjDrawGrideyedataDefinition = {
Blockly.defineBlocksWithJsonArray([{
"type": "ugj_draw_grideyedata", "type": "ugj_draw_grideyedata",
"message0": "%{BKY_UGJ_DRAW_GRIDEYEDATA_TITLE}", "message0": "%{BKY_UGJ_DRAW_GRIDEYEDATA_TITLE}",
"args0": [ "args0": [
@ -211,12 +187,7 @@ var ugjDrawGrideyedataDefinition = {
"tooltip": "%{BKY_UGJ_DRAW_GRIDEYEDATA_TOOLTIP}", "tooltip": "%{BKY_UGJ_DRAW_GRIDEYEDATA_TOOLTIP}",
"helpUrl": "", "helpUrl": "",
"style": "multimedia_blocks" "style": "multimedia_blocks"
}; }]);
Blockly.Blocks['ugj_draw_grideyedata'] = {
init: function () {
this.jsonInit(ugjDrawGrideyedataDefinition);
}
};
Blockly.JavaScript['ugj_draw_grideyedata'] = function (block) { Blockly.JavaScript['ugj_draw_grideyedata'] = function (block) {
var value_amg8833data = Blockly.JavaScript.valueToCode(block, 'amg8833data', Blockly.JavaScript.ORDER_ATOMIC); var value_amg8833data = Blockly.JavaScript.valueToCode(block, 'amg8833data', Blockly.JavaScript.ORDER_ATOMIC);
var colour_color_high = block.getFieldValue('color_high'); var colour_color_high = block.getFieldValue('color_high');
@ -258,7 +229,7 @@ Blockly.JavaScript['ugj_draw_grideyedata'] = function (block) {
/**************************** */ /**************************** */
/** Teachable Machine を開始** */ /** Teachable Machine を開始** */
/**************************** */ /**************************** */
var ugjTeachableMachineDefinition = { Blockly.defineBlocksWithJsonArray([{
"type": "ugj_teachable_machine", "type": "ugj_teachable_machine",
"message0": "%{BKY_UGJ_TEACHABLE_MACHINE_TITLE}", "message0": "%{BKY_UGJ_TEACHABLE_MACHINE_TITLE}",
"inputsInline": true, "inputsInline": true,
@ -267,12 +238,7 @@ var ugjTeachableMachineDefinition = {
"tooltip": "%{BKY_UGJ_TEACHABLE_MACHINE_TOOLTIP}", "tooltip": "%{BKY_UGJ_TEACHABLE_MACHINE_TOOLTIP}",
"helpUrl": "", "helpUrl": "",
"style": "multimedia_blocks" "style": "multimedia_blocks"
}; }]);
Blockly.Blocks['ugj_teachable_machine'] = {
init: function () {
this.jsonInit(ugjTeachableMachineDefinition);
}
};
Blockly.JavaScript['ugj_teachable_machine'] = function (block) { Blockly.JavaScript['ugj_teachable_machine'] = function (block) {
Blockly.JavaScript.provideFunction_( Blockly.JavaScript.provideFunction_(
'require_ts', [`const _tf = require('@tensorflow/tfjs-node');`] 'require_ts', [`const _tf = require('@tensorflow/tfjs-node');`]
@ -292,7 +258,7 @@ Blockly.JavaScript['ugj_teachable_machine'] = function (block) {
/************************* */ /************************* */
/** GridEye で推論を行う ** */ /** GridEye で推論を行う ** */
/************************* */ /************************* */
var ugjGridEyePredictClassDefinition = { Blockly.defineBlocksWithJsonArray([{
"type": "ugj_grideye_predict_class", "type": "ugj_grideye_predict_class",
"message0": "%{BKY_UGJ_GRIDEYE_PREDICT_CLASS_TITLE}", "message0": "%{BKY_UGJ_GRIDEYE_PREDICT_CLASS_TITLE}",
"inputsInline": true, "inputsInline": true,
@ -300,12 +266,7 @@ var ugjGridEyePredictClassDefinition = {
"tooltip": "%{BKY_UGJ_GRIDEYE_PREDICT_CLASS_TOOLTIP}", "tooltip": "%{BKY_UGJ_GRIDEYE_PREDICT_CLASS_TOOLTIP}",
"helpUrl": "", "helpUrl": "",
"style": "multimedia_blocks" "style": "multimedia_blocks"
}; }]);
Blockly.Blocks['ugj_grideye_predict_class'] = {
init: function () {
this.jsonInit(ugjGridEyePredictClassDefinition);
}
};
Blockly.JavaScript['ugj_grideye_predict_class'] = function (block) { Blockly.JavaScript['ugj_grideye_predict_class'] = function (block) {
var functionName = Blockly.JavaScript.provideFunction_( // left output にするための関数化 var functionName = Blockly.JavaScript.provideFunction_( // left output にするための関数化
'_predictClass', '_predictClass',
@ -327,7 +288,7 @@ Blockly.JavaScript['ugj_grideye_predict_class'] = function (block) {
/******************************************** */ /******************************************** */
/** ラベルをつけて Example をデータセットに追加 ** */ /** ラベルをつけて Example をデータセットに追加 ** */
/******************************************** */ /******************************************** */
var ugjGridEyeAddExampleDefinition = { Blockly.defineBlocksWithJsonArray([{
"type": "ugj_grideye_add_example", "type": "ugj_grideye_add_example",
"message0": "%{BKY_UGJ_GRIDEYE_ADD_EXAMPLE_TITLE}", "message0": "%{BKY_UGJ_GRIDEYE_ADD_EXAMPLE_TITLE}",
"args0": [ "args0": [
@ -343,12 +304,7 @@ var ugjGridEyeAddExampleDefinition = {
"tooltip": "%{BKY_UGJ_GRIDEYE_ADD_EXAMPLE_TOOLTIP}", "tooltip": "%{BKY_UGJ_GRIDEYE_ADD_EXAMPLE_TOOLTIP}",
"helpUrl": "", "helpUrl": "",
"style": "multimedia_blocks" "style": "multimedia_blocks"
}; }]);
Blockly.Blocks['ugj_grideye_add_example'] = {
init: function () {
this.jsonInit(ugjGridEyeAddExampleDefinition);
}
};
Blockly.JavaScript['ugj_grideye_add_example'] = function (block) { Blockly.JavaScript['ugj_grideye_add_example'] = function (block) {
var value_class_id = Blockly.JavaScript.valueToCode(block, 'class_id', Blockly.JavaScript.ORDER_ATOMIC); var value_class_id = Blockly.JavaScript.valueToCode(block, 'class_id', Blockly.JavaScript.ORDER_ATOMIC);
var code = `_classifier.addExample (_net.infer(_grideye_canvas, true), ${value_class_id});`; var code = `_classifier.addExample (_net.infer(_grideye_canvas, true), ${value_class_id});`;
@ -357,19 +313,14 @@ Blockly.JavaScript['ugj_grideye_add_example'] = function (block) {
/*************************** */ /*************************** */
/** 学習したクラスを文字列化 ** */ /** 学習したクラスを文字列化 ** */
/*************************** */ /*************************** */
var ugjTensorsetStringifyDefinition = { Blockly.defineBlocksWithJsonArray([{
"type": "ugj_tensorset_stringify", "type": "ugj_tensorset_stringify",
"message0": "%{BKY_UGJ_TENSORSET_STRINGIFY_TITLE}", "message0": "%{BKY_UGJ_TENSORSET_STRINGIFY_TITLE}",
"output": null, "output": null,
"tooltip": "%{BKY_UGJ_TENSORSET_STRINGIFY_TOOLTIP}", "tooltip": "%{BKY_UGJ_TENSORSET_STRINGIFY_TOOLTIP}",
"helpUrl": "", "helpUrl": "",
"style": "multimedia_blocks" "style": "multimedia_blocks"
}; }]);
Blockly.Blocks['ugj_tensorset_stringify'] = {
init: function () {
this.jsonInit(ugjTensorsetStringifyDefinition);
}
};
Blockly.JavaScript['ugj_tensorset_stringify'] = function (block) { Blockly.JavaScript['ugj_tensorset_stringify'] = function (block) {
var code = `JSON.stringify( Object.entries(_classifier.getClassifierDataset()).map(([label, data])=>[label, Array.from(data.dataSync()), data.shape]) )`; var code = `JSON.stringify( Object.entries(_classifier.getClassifierDataset()).map(([label, data])=>[label, Array.from(data.dataSync()), data.shape]) )`;
return [code, Blockly.JavaScript.ORDER_NONE]; return [code, Blockly.JavaScript.ORDER_NONE];
@ -377,7 +328,7 @@ Blockly.JavaScript['ugj_tensorset_stringify'] = function (block) {
/***************************************** */ /***************************************** */
/** jsonをデータセットに戻して分類器にセット ** */ /** jsonをデータセットに戻して分類器にセット ** */
/***************************************** */ /***************************************** */
var ugjTensorsetParseDefinition = { Blockly.defineBlocksWithJsonArray([{
"type": "ugj_tensorset_parse", "type": "ugj_tensorset_parse",
"message0": "%{BKY_UGJ_TENSORSET_PARSE_TITLE}", "message0": "%{BKY_UGJ_TENSORSET_PARSE_TITLE}",
"args0": [ "args0": [
@ -392,17 +343,124 @@ var ugjTensorsetParseDefinition = {
"tooltip": "%{BKY_UGJ_TENSORSET_PARSE_TOOLTIP}", "tooltip": "%{BKY_UGJ_TENSORSET_PARSE_TOOLTIP}",
"helpUrl": "", "helpUrl": "",
"style": "multimedia_blocks" "style": "multimedia_blocks"
}; }]);
Blockly.Blocks['ugj_tensorset_parse'] = {
init: function () {
this.jsonInit(ugjTensorsetParseDefinition);
}
};
Blockly.JavaScript['ugj_tensorset_parse'] = function (block) { Blockly.JavaScript['ugj_tensorset_parse'] = function (block) {
var value_class_data_json = Blockly.JavaScript.valueToCode(block, 'class_data_json', Blockly.JavaScript.ORDER_ATOMIC); var value_class_data_json = Blockly.JavaScript.valueToCode(block, 'class_data_json', Blockly.JavaScript.ORDER_ATOMIC);
var code = `_classifier.setClassifierDataset( Object.fromEntries( JSON.parse(${value_class_data_json}).map(([label, data, shape])=>[label, _tf.tensor(data, shape)]) ) );`; var code = `_classifier.setClassifierDataset( Object.fromEntries( JSON.parse(${value_class_data_json}).map(([label, data, shape])=>[label, _tf.tensor(data, shape)]) ) );`;
return code; return code;
}; };
// 温度ブロック(ツールボックス上非表示)
Blockly.defineBlocksWithJsonArray([{
"type": "ugj_temp",
"message0": "%1",
"args0": [
{
"type": "field_slider",
"name": "temp",
"value": 15,
"min": 0,
"max": 40,
"precision": 1
}
],
"inputsInline": true,
"output": "Number",
"tooltip": "",
"helpUrl": "",
"style": "math_blocks"
}]);
Blockly.JavaScript['ugj_temp'] = function (block) {
var number_temp = block.getFieldValue('temp');
var code = `${number_temp}`;
return [code, Blockly.JavaScript.ORDER_NONE];
};
flyout_contents = flyout_contents.concat([
{
"kind": "label",
"text": "赤外線アレイセンサーサーマルカメラAMG8833",
"web-line": "4.0",
"web-line-width": "200"
},
{
"kind": "block",
"type": "ugj_grideye_init",
"fields": {
"addr": "0x69"
}
},
{
"kind": "block",
"type": "ugj_grideye_thermistor"
},
{
"kind": "block",
"type": "ugj_grideye_read"
},
{
"kind": "block",
"type": "ugj_grideye_stop"
},
{
"kind": "block",
"type": "ugj_grideye_canvas_create"
},
{
"kind": "block",
"type": "ugj_draw_grideyedata",
"fields": {
"color_high": "#ff0000",
"color_low": "#3333ff"
},
"inputs": {
"temp_high": {
"shadow": {
"type": "ugj_temp",
"fields": {
"temp": "28"
}
}
},
"temp_low": {
"shadow": {
"type": "ugj_temp",
"fields": {
"temp": "15"
}
}
}
}
},
{
"kind": "block",
"type": "ugj_teachable_machine"
},
{
"kind": "block",
"type": "ugj_grideye_predict_class"
},
{
"kind": "block",
"type": "ugj_grideye_add_example",
"inputs": {
"class_id": {
"shadow": {
"type": "math_number",
"fields": {
"NUM": "0"
}
}
}
}
},
{
"kind": "block",
"type": "ugj_tensorset_stringify"
},
{
"kind": "block",
"type": "ugj_tensorset_parse"
}
]);

View File

@ -1,87 +0,0 @@
[
{
"kind": "label",
"text": "赤外線アレイセンサーサーマルカメラAMG8833",
"web-line": "4.0",
"web-line-width": "200"
},
{
"kind": "block",
"type": "ugj_grideye_init",
"fields": {
"addr": "0x69"
}
},
{
"kind": "block",
"type": "ugj_grideye_thermistor"
},
{
"kind": "block",
"type": "ugj_grideye_read"
},
{
"kind": "block",
"type": "ugj_grideye_stop"
},
{
"kind": "block",
"type": "ugj_grideye_canvas_create"
},
{
"kind": "block",
"type": "ugj_draw_grideyedata",
"fields": {
"color_high": "#ff0000",
"color_low": "#3333ff"
},
"inputs": {
"temp_high": {
"shadow": {
"type": "math_number",
"fields": {
"NUM": "28"
}
}
},
"temp_low": {
"shadow": {
"type": "math_number",
"fields": {
"NUM": "15"
}
}
}
}
},
{
"kind": "block",
"type": "ugj_teachable_machine"
},
{
"kind": "block",
"type": "ugj_grideye_predict_class"
},
{
"kind": "block",
"type": "ugj_grideye_add_example",
"inputs": {
"class_id": {
"shadow": {
"type": "math_number",
"fields": {
"NUM": "0"
}
}
}
}
},
{
"kind": "block",
"type": "ugj_tensorset_stringify"
},
{
"kind": "block",
"type": "ugj_tensorset_parse"
}
]

View File

@ -20,7 +20,7 @@ Blockly.JavaScript['ugj_bme280'] = function (block) {
Blockly.JavaScript.provideFunction_( Blockly.JavaScript.provideFunction_(
'require_gpio', [`const _pi = require('@ocoge.club/` + apptool.gpio_backend + `');`] 'require_gpio', [`const _pi = require('@ocoge.club/` + apptool.gpio_backend + `');`]
); );
let modpath = apptool.path.join(apptool.blocks_sensors_dir, 'bme280', 'BME280x.js'); let modpath = apptool.path.join(ugj_const.blocks_dir, 'sensors', 'bme280', 'BME280x.js');
Blockly.JavaScript.provideFunction_( Blockly.JavaScript.provideFunction_(
'require_bme280', [`const _bme280 = require('${modpath}');`] 'require_bme280', [`const _bme280 = require('${modpath}');`]
); );
@ -53,4 +53,28 @@ Blockly.JavaScript['ugj_bme280_data'] = function (block) {
var dropdown_thp = block.getFieldValue('thp'); var dropdown_thp = block.getFieldValue('thp');
var code = `_bmedata[${dropdown_thp}]`; var code = `_bmedata[${dropdown_thp}]`;
return [code, Blockly.JavaScript.ORDER_ATOMIC]; return [code, Blockly.JavaScript.ORDER_ATOMIC];
}; };
flyout_contents = flyout_contents.concat([
{
"kind": "label",
"text": "温湿度気圧センサー BME280",
"web-line": "4.0",
"web-line-width": "200"
},
{
"kind": "block",
"type": "ugj_bme280",
"fields": {
"addr": "0x76"
}
},
{
"kind": "block",
"type": "ugj_bme280_data",
"fields": {
"thp": "0"
}
}
]);

View File

@ -1,22 +0,0 @@
[
{
"kind": "label",
"text": "温湿度気圧センサー BME280",
"web-line": "4.0",
"web-line-width": "200"
},
{
"kind": "block",
"type": "ugj_bme280",
"fields": {
"addr": "0x76"
}
},
{
"kind": "block",
"type": "ugj_bme280_data",
"fields": {
"thp": "0"
}
}
]

View File

@ -15,7 +15,7 @@ Blockly.Blocks['ugj_dht11'] = {
}; };
Blockly.JavaScript['ugj_dht11'] = function (block) { Blockly.JavaScript['ugj_dht11'] = function (block) {
var value_pin = Blockly.JavaScript.valueToCode(block, 'pin', Blockly.JavaScript.ORDER_ATOMIC); var value_pin = Blockly.JavaScript.valueToCode(block, 'pin', Blockly.JavaScript.ORDER_ATOMIC);
let pypath = apptool.path.join(apptool.blocks_sensors_dir, 'dht11', 'dht11.py'); let pypath = apptool.path.join(ugj_const.blocks_dir, 'sensors', 'dht11', 'dht11.py');
var code = `let _th = require('child_process').spawnSync('python3', ['${pypath}', '${value_pin}'], {timeout: 5000}).stdout.toString(); var code = `let _th = require('child_process').spawnSync('python3', ['${pypath}', '${value_pin}'], {timeout: 5000}).stdout.toString();
let _dhtdata = JSON.parse(_th);`; let _dhtdata = JSON.parse(_th);`;
// let _dht11data[0] = // let _dht11data[0] =
@ -38,4 +38,34 @@ Blockly.JavaScript['ugj_dht11_data'] = function (block) {
var dropdown_th = block.getFieldValue('th'); var dropdown_th = block.getFieldValue('th');
var code = `_dhtdata.${dropdown_th}`; var code = `_dhtdata.${dropdown_th}`;
return [code, Blockly.JavaScript.ORDER_ATOMIC]; return [code, Blockly.JavaScript.ORDER_ATOMIC];
}; };
flyout_contents = flyout_contents.concat([
{
"kind": "label",
"text": "温湿度センサー DHT11",
"web-line": "4.0",
"web-line-width": "200"
},
{
"kind": "block",
"type": "ugj_dht11",
"inputs": {
"pin": {
"shadow": {
"type": "math_number",
"fields": {
"NUM": "8"
}
}
}
}
},
{
"kind": "block",
"type": "ugj_dht11_data",
"fields": {
"th": "temperature"
}
}
]);

View File

@ -1,29 +0,0 @@
[
{
"kind": "label",
"text": "温湿度センサー DHT11",
"web-line": "4.0",
"web-line-width": "200"
},
{
"kind": "block",
"type": "ugj_dht11",
"inputs": {
"pin": {
"shadow": {
"type": "math_number",
"fields": {
"NUM": "8"
}
}
}
}
},
{
"kind": "block",
"type": "ugj_dht11_data",
"fields": {
"th": "temperature"
}
}
]

View File

@ -35,7 +35,7 @@ Blockly.JavaScript['ugj_gesture_init'] = function (block) {
Blockly.JavaScript.provideFunction_( Blockly.JavaScript.provideFunction_(
'require_gpio', [`const _pi = require('@ocoge.club/` + apptool.gpio_backend + `');`] 'require_gpio', [`const _pi = require('@ocoge.club/` + apptool.gpio_backend + `');`]
); );
let modpath = apptool.path.join(apptool.blocks_sensors_dir, 'paj7620', 'PAJ7620x.js'); let modpath = apptool.path.join(ugj_const.blocks_dir, 'sensors', 'paj7620', 'PAJ7620x.js');
Blockly.JavaScript.provideFunction_( Blockly.JavaScript.provideFunction_(
'require_paj7620', [`const _paj7620 = require('${modpath}');`] 'require_paj7620', [`const _paj7620 = require('${modpath}');`]
); );
@ -87,3 +87,41 @@ Blockly.JavaScript['ugj_gesture_stop'] = function (block) {
var code = 'await _paj7620.stop();\n'; var code = 'await _paj7620.stop();\n';
return code; return code;
}; };
flyout_contents = flyout_contents.concat([
{
"kind": "label",
"text": "ジェスチャーセンサー PAJ7620",
"web-line": "4.0",
"web-line-width": "200"
},
{
"kind": "block",
"type": "ugj_gesture_init",
"inputs": {
"i2c_addr": {
"shadow": {
"type": "ugj_hextodec",
"inputs": {
"hex": {
"shadow": {
"type": "text",
"fields": {
"TEXT": "73"
}
}
}
}
}
}
}
},
{
"kind": "block",
"type": "ugj_gesture_read"
},
{
"kind": "block",
"type": "ugj_gesture_stop"
}
]);

View File

@ -1,37 +0,0 @@
[
{
"kind": "label",
"text": "ジェスチャーセンサー PAJ7620",
"web-line": "4.0",
"web-line-width": "200"
},
{
"kind": "block",
"type": "ugj_gesture_init",
"inputs": {
"i2c_addr": {
"shadow": {
"type": "ugj_hextodec",
"inputs": {
"hex": {
"shadow": {
"type": "text",
"fields": {
"TEXT": "73"
}
}
}
}
}
}
}
},
{
"kind": "block",
"type": "ugj_gesture_read"
},
{
"kind": "block",
"type": "ugj_gesture_stop"
}
]

View File

@ -0,0 +1,10 @@
(() => {
let category = workspace.getToolbox().getToolboxItemById('category_sensors');
category.updateFlyoutContents(flyout_contents.concat([{
"kind": "label",
"text": " ",
"web-line": "4.0",
"web-line-width": "200"
}]));
flyout_contents = [];
})();

View File

@ -12,7 +12,12 @@
</link> </link>
<link rel="stylesheet" href="./index.css"> <link rel="stylesheet" href="./index.css">
</link> </link>
<link rel="shortcut icon" type="image/png" href="https://ocoge.club/assets/img/favicon.png">
<meta property="og:url" content="https://ocoge.club/demo/" />
<meta property="og:title" content="『オコゲ』Web 体験版" />
<meta property="og:description" content="ブロックプログラミングを体験してみましょう" />
<meta property="og:site_name" content="『オコゲ』Web 体験版" />
<meta property="og:image" content="https://ocoge.club/assets/img/mimmy_360.webp" />
</head> </head>
<body> <body>
@ -1046,11 +1051,13 @@
<script src="./blocks/blocks.js"></script> <script src="./blocks/blocks.js"></script>
<script src="./apptool.js"></script> <script src="./apptool.js"></script>
<script src="./index.js"></script> <script src="./index.js"></script>
<script src="./blocks/index.js"></script>
<script src="./node_modules/js-beautify/js/lib/beautify.js"></script> <script src="./node_modules/js-beautify/js/lib/beautify.js"></script>
<script src="./node_modules/prismjs/prism.js"></script> <script src="./node_modules/prismjs/prism.js"></script>
<script src="./node_modules/prismjs/plugins/line-numbers/prism-line-numbers.min.js"></script> <script src="./node_modules/prismjs/components/prism-python.js"></script>
<script src="./node_modules/prismjs/plugins/toolbar/prism-toolbar.min.js"></script> <script src="./node_modules/prismjs/plugins/line-numbers/prism-line-numbers.js"></script>
<script src="./node_modules/prismjs/plugins/copy-to-clipboard/prism-copy-to-clipboard.min.js"></script> <script src="./node_modules/prismjs/plugins/toolbar/prism-toolbar.js"></script>
<script src="./node_modules/prismjs/plugins/copy-to-clipboard/prism-copy-to-clipboard.js"></script>
</body> </body>
</html> </html>

View File

@ -1,6 +1,6 @@
'use strict'; 'use strict';
const { checkPrimeSync } = require('crypto'); // const { checkPrimeSync } = require('crypto');
let apptool = appTool_new(); let apptool = appTool_new();

184
package-lock.json generated
View File

@ -1,26 +1,26 @@
{ {
"name": "ocoge", "name": "ocoge",
"version": "0.1.9", "version": "0.1.10",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "ocoge", "name": "ocoge",
"version": "0.1.9", "version": "0.1.10",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@blockly/field-slider": "^4.0.3", "@blockly/field-slider": "^4.0.4",
"@ocoge.club/pigpio": "file:local_modules/pigpio", "@ocoge.club/pigpio": "file:local_modules/pigpio",
"@tensorflow-models/blazeface": "^0.0.7", "@tensorflow-models/blazeface": "^0.0.7",
"@tensorflow-models/knn-classifier": "^1.2.4", "@tensorflow-models/knn-classifier": "^1.2.4",
"@tensorflow-models/mobilenet": "^2.1.0", "@tensorflow-models/mobilenet": "^2.1.0",
"@tensorflow-models/speech-commands": "^0.5.4", "@tensorflow-models/speech-commands": "^0.5.4",
"@tensorflow/tfjs-node": "^4.1.0", "@tensorflow/tfjs-node": "^4.2.0",
"axios": "^1.2.2", "axios": "^1.2.2",
"blockly": "^9.2.0", "blockly": "^9.2.0",
"dracula-prism": "^2.1.13", "dracula-prism": "^2.1.13",
"js-beautify": "^1.14.7", "js-beautify": "^1.14.7",
"node-abi": "^3.30.0", "node-abi": "^3.31.0",
"nodemailer": "^6.8.0", "nodemailer": "^6.8.0",
"prismjs": "^1.29.0" "prismjs": "^1.29.0"
}, },
@ -46,9 +46,9 @@
"integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==" "integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg=="
}, },
"node_modules/@blockly/field-slider": { "node_modules/@blockly/field-slider": {
"version": "4.0.3", "version": "4.0.4",
"resolved": "https://registry.npmjs.org/@blockly/field-slider/-/field-slider-4.0.3.tgz", "resolved": "https://registry.npmjs.org/@blockly/field-slider/-/field-slider-4.0.4.tgz",
"integrity": "sha512-jbTEp4pHf+WG8eac3czUW+CvE+IKa8poZ97Jd3l+QPfeKuljWt9YYQ6x+7iOBx135kpHAZXUmPbQtRCjZA5oCw==", "integrity": "sha512-T3lMHzG1uaTLkv9WfDLO6Mo4uYLCQVP3mJzS/yICPvEAWzYXps+Ig5MJBLe3Mfh4qBkQyFO3jG2EgYK+jytJ9w==",
"engines": { "engines": {
"node": ">=8.0.0" "node": ">=8.0.0"
}, },
@ -728,16 +728,16 @@
} }
}, },
"node_modules/@tensorflow/tfjs": { "node_modules/@tensorflow/tfjs": {
"version": "4.1.0", "version": "4.2.0",
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs/-/tfjs-4.1.0.tgz", "resolved": "https://registry.npmjs.org/@tensorflow/tfjs/-/tfjs-4.2.0.tgz",
"integrity": "sha512-jlrJ6MIBos8NkmF+NHIWBnKVBGYJTG06QmW/A0vgyXwkp+3PgzX8TJ4MWIv/7oZr7g27zfY6dXA1OFzrrgvklA==", "integrity": "sha512-iZmtyGC9IJkx+TpFnkgDol8BHv2BU3zJ01HyNcuvnm1w1EqoNe+1n8bwvLzI/sxHMcHTqzuu7VugMaphryxE+A==",
"dependencies": { "dependencies": {
"@tensorflow/tfjs-backend-cpu": "4.1.0", "@tensorflow/tfjs-backend-cpu": "4.2.0",
"@tensorflow/tfjs-backend-webgl": "4.1.0", "@tensorflow/tfjs-backend-webgl": "4.2.0",
"@tensorflow/tfjs-converter": "4.1.0", "@tensorflow/tfjs-converter": "4.2.0",
"@tensorflow/tfjs-core": "4.1.0", "@tensorflow/tfjs-core": "4.2.0",
"@tensorflow/tfjs-data": "4.1.0", "@tensorflow/tfjs-data": "4.2.0",
"@tensorflow/tfjs-layers": "4.1.0", "@tensorflow/tfjs-layers": "4.2.0",
"argparse": "^1.0.10", "argparse": "^1.0.10",
"chalk": "^4.1.0", "chalk": "^4.1.0",
"core-js": "3", "core-js": "3",
@ -749,9 +749,9 @@
} }
}, },
"node_modules/@tensorflow/tfjs-backend-cpu": { "node_modules/@tensorflow/tfjs-backend-cpu": {
"version": "4.1.0", "version": "4.2.0",
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-cpu/-/tfjs-backend-cpu-4.1.0.tgz", "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-cpu/-/tfjs-backend-cpu-4.2.0.tgz",
"integrity": "sha512-NqxrwpYa/hXGaBa1RzxfHsLAsaniIZryhF5CxQM9uSp1ny8wUJMH+Mda/Y8+llS3weHug8JDAbAW2cabn8l84A==", "integrity": "sha512-8HWg9J69m0Ovc6w8TVhhixMOcwA3t/NPXLblOA/sgJ+/JD5gsbpLWJk4QISQyb1RnpSVzw6PX3BSMTJU7hWVOg==",
"dependencies": { "dependencies": {
"@types/seedrandom": "^2.4.28", "@types/seedrandom": "^2.4.28",
"seedrandom": "^3.0.5" "seedrandom": "^3.0.5"
@ -760,15 +760,15 @@
"yarn": ">= 1.3.2" "yarn": ">= 1.3.2"
}, },
"peerDependencies": { "peerDependencies": {
"@tensorflow/tfjs-core": "4.1.0" "@tensorflow/tfjs-core": "4.2.0"
} }
}, },
"node_modules/@tensorflow/tfjs-backend-webgl": { "node_modules/@tensorflow/tfjs-backend-webgl": {
"version": "4.1.0", "version": "4.2.0",
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-webgl/-/tfjs-backend-webgl-4.1.0.tgz", "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-webgl/-/tfjs-backend-webgl-4.2.0.tgz",
"integrity": "sha512-RDjwbFCPESjh+QTrTvKC623MO58gIqxQvtX3DfJLhlsSbnsvIpA5s1CXNJYzNVmFDia35mPYKmQQWvEvhl9weA==", "integrity": "sha512-Qvf+hD5pSh+xi48kChSGzcDKJemkc4EKfoVVjuxl4k25ZUPwuEd7zZUAtinkLu1dzgHNyvePZY8k+9rVm59HJA==",
"dependencies": { "dependencies": {
"@tensorflow/tfjs-backend-cpu": "4.1.0", "@tensorflow/tfjs-backend-cpu": "4.2.0",
"@types/offscreencanvas": "~2019.3.0", "@types/offscreencanvas": "~2019.3.0",
"@types/seedrandom": "^2.4.28", "@types/seedrandom": "^2.4.28",
"@types/webgl-ext": "0.0.30", "@types/webgl-ext": "0.0.30",
@ -778,21 +778,21 @@
"yarn": ">= 1.3.2" "yarn": ">= 1.3.2"
}, },
"peerDependencies": { "peerDependencies": {
"@tensorflow/tfjs-core": "4.1.0" "@tensorflow/tfjs-core": "4.2.0"
} }
}, },
"node_modules/@tensorflow/tfjs-converter": { "node_modules/@tensorflow/tfjs-converter": {
"version": "4.1.0", "version": "4.2.0",
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-converter/-/tfjs-converter-4.1.0.tgz", "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-converter/-/tfjs-converter-4.2.0.tgz",
"integrity": "sha512-pR4TSUI949a/5uUWjHga8xzxD7Y9AbobHJtCmg86Bldfl2GV8aibz87cNjpoO+iUhH8WZo1TOJy8GpM+MPT2DA==", "integrity": "sha512-m+E2KJM6yGQdi8ElzWpChdD/JaqhWMCi9yK70v/ndkOaCL2q2UN48nYP2T5S15vkDvMIgzAQyZfh7hxQsMuvRQ==",
"peerDependencies": { "peerDependencies": {
"@tensorflow/tfjs-core": "4.1.0" "@tensorflow/tfjs-core": "4.2.0"
} }
}, },
"node_modules/@tensorflow/tfjs-core": { "node_modules/@tensorflow/tfjs-core": {
"version": "4.1.0", "version": "4.2.0",
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-core/-/tfjs-core-4.1.0.tgz", "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-core/-/tfjs-core-4.2.0.tgz",
"integrity": "sha512-zERD4xtxNq3dV3+wPEMi2HWSV68FA8WucSAogzErp38/q98Byv9G1x8DhxQ+jowTcqN4srGWcBfK59jYwjlAvA==", "integrity": "sha512-uuHkiWVC8b00ngFbHvAV7J7haRlN/9PEdeenCi0CzBjgKd7aN25wPWaoN0TSQcU+GT4FJ8mofMZ9VBYZ/s/WLg==",
"dependencies": { "dependencies": {
"@types/long": "^4.0.1", "@types/long": "^4.0.1",
"@types/offscreencanvas": "~2019.7.0", "@types/offscreencanvas": "~2019.7.0",
@ -813,35 +813,35 @@
"integrity": "sha512-PGcyveRIpL1XIqK8eBsmRBt76eFgtzuPiSTyKHZxnGemp2yzGzWpjYKAfK3wIMiU7eH+851yEpiuP8JZerTmWg==" "integrity": "sha512-PGcyveRIpL1XIqK8eBsmRBt76eFgtzuPiSTyKHZxnGemp2yzGzWpjYKAfK3wIMiU7eH+851yEpiuP8JZerTmWg=="
}, },
"node_modules/@tensorflow/tfjs-data": { "node_modules/@tensorflow/tfjs-data": {
"version": "4.1.0", "version": "4.2.0",
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-data/-/tfjs-data-4.1.0.tgz", "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-data/-/tfjs-data-4.2.0.tgz",
"integrity": "sha512-H6ef6NXPwi2xKYB6tVNZi5RqniMFpfUSlxG3q0BNxnyuyeCUSjJvHJFpah9hT/ysYjVdwspzh/I6B67h+lBchg==", "integrity": "sha512-11t7Q+ikseduJgkd9iSeRrtor1aA3o5PVCFhC5yYvR3JLO55ic1+4Ryo0EJfhRoismS6zBUJrpzX4K0zlLbIfw==",
"dependencies": { "dependencies": {
"@types/node-fetch": "^2.1.2", "@types/node-fetch": "^2.1.2",
"node-fetch": "~2.6.1", "node-fetch": "~2.6.1",
"string_decoder": "^1.3.0" "string_decoder": "^1.3.0"
}, },
"peerDependencies": { "peerDependencies": {
"@tensorflow/tfjs-core": "4.1.0", "@tensorflow/tfjs-core": "4.2.0",
"seedrandom": "^3.0.5" "seedrandom": "^3.0.5"
} }
}, },
"node_modules/@tensorflow/tfjs-layers": { "node_modules/@tensorflow/tfjs-layers": {
"version": "4.1.0", "version": "4.2.0",
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-layers/-/tfjs-layers-4.1.0.tgz", "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-layers/-/tfjs-layers-4.2.0.tgz",
"integrity": "sha512-lzHNTZu1GwKl7hW5tt2COSpflE0m7xrsOf8AzRzpTDVJYYRx/x5ScMt/y//5jbRuaDOnb3EjT1FxWxwkD44/sg==", "integrity": "sha512-SO0KTmCFOjrW+PlP9nKYXz07XGFq6uE7am9yH2bRaRPWpEeaKT/+k0C9vFMxI/GzRwY8AK4sLe4U+jE1mhYxGw==",
"peerDependencies": { "peerDependencies": {
"@tensorflow/tfjs-core": "4.1.0" "@tensorflow/tfjs-core": "4.2.0"
} }
}, },
"node_modules/@tensorflow/tfjs-node": { "node_modules/@tensorflow/tfjs-node": {
"version": "4.1.0", "version": "4.2.0",
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-node/-/tfjs-node-4.1.0.tgz", "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-node/-/tfjs-node-4.2.0.tgz",
"integrity": "sha512-2H7UJqVafuM9fbsMdzUkcfWLpH/owgvVHWES+gQsiueIqyOjpq6ZGSQLDxyuKtHP2D/8/kWeVIbnzAjnIRniuA==", "integrity": "sha512-dkyExfqTjMVDpKLBzHH2b7JWzGK+QORtYswvoNHbeHwx7kvYYRAQeiHxp+xrgry6LdbWfZs88IWCwNGoOiZ21w==",
"hasInstallScript": true, "hasInstallScript": true,
"dependencies": { "dependencies": {
"@mapbox/node-pre-gyp": "1.0.9", "@mapbox/node-pre-gyp": "1.0.9",
"@tensorflow/tfjs": "4.1.0", "@tensorflow/tfjs": "4.2.0",
"adm-zip": "^0.5.2", "adm-zip": "^0.5.2",
"google-protobuf": "^3.9.2", "google-protobuf": "^3.9.2",
"https-proxy-agent": "^2.2.1", "https-proxy-agent": "^2.2.1",
@ -1798,9 +1798,9 @@
"integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==" "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ=="
}, },
"node_modules/core-js": { "node_modules/core-js": {
"version": "3.26.1", "version": "3.27.1",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.26.1.tgz", "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.27.1.tgz",
"integrity": "sha512-21491RRQVzUn0GGM9Z1Jrpr6PNPxPi+Za8OM9q4tksTSnlbXXGKK1nXNg/QvwFYettXvSX6zWKCtHHfjN4puyA==", "integrity": "sha512-GutwJLBChfGCpwwhbYoqfv03LAfmiz7e7D/BNxzeMxwQf10GRSzqiOjx7AmtEk+heiD/JWmBuyBPgFtx0Sg1ww==",
"hasInstallScript": true, "hasInstallScript": true,
"funding": { "funding": {
"type": "opencollective", "type": "opencollective",
@ -4306,9 +4306,9 @@
"dev": true "dev": true
}, },
"node_modules/node-abi": { "node_modules/node-abi": {
"version": "3.30.0", "version": "3.31.0",
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.30.0.tgz", "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.31.0.tgz",
"integrity": "sha512-qWO5l3SCqbwQavymOmtTVuCWZE23++S+rxyoHjXqUmPyzRcaoI4lA2gO55/drddGnedAyjA7sk76SfQ5lfUMnw==", "integrity": "sha512-eSKV6s+APenqVh8ubJyiu/YhZgxQpGP66ntzUb3lY1xB9ukSRaGnx0AIxI+IM+1+IVYC1oWobgG5L3Lt9ARykQ==",
"dependencies": { "dependencies": {
"semver": "^7.3.5" "semver": "^7.3.5"
}, },
@ -6315,9 +6315,9 @@
}, },
"dependencies": { "dependencies": {
"@blockly/field-slider": { "@blockly/field-slider": {
"version": "4.0.3", "version": "4.0.4",
"resolved": "https://registry.npmjs.org/@blockly/field-slider/-/field-slider-4.0.3.tgz", "resolved": "https://registry.npmjs.org/@blockly/field-slider/-/field-slider-4.0.4.tgz",
"integrity": "sha512-jbTEp4pHf+WG8eac3czUW+CvE+IKa8poZ97Jd3l+QPfeKuljWt9YYQ6x+7iOBx135kpHAZXUmPbQtRCjZA5oCw==" "integrity": "sha512-T3lMHzG1uaTLkv9WfDLO6Mo4uYLCQVP3mJzS/yICPvEAWzYXps+Ig5MJBLe3Mfh4qBkQyFO3jG2EgYK+jytJ9w=="
}, },
"@electron-forge/cli": { "@electron-forge/cli": {
"version": "6.0.4", "version": "6.0.4",
@ -6814,16 +6814,16 @@
"integrity": "sha512-r0c/MvC15/09xWujx1pKe6mA0nta+4jQWDXGkqfSVkXLo8ARrwcZ4mTGLlfvT43ySfidiveUo0m+P51+UK821Q==" "integrity": "sha512-r0c/MvC15/09xWujx1pKe6mA0nta+4jQWDXGkqfSVkXLo8ARrwcZ4mTGLlfvT43ySfidiveUo0m+P51+UK821Q=="
}, },
"@tensorflow/tfjs": { "@tensorflow/tfjs": {
"version": "4.1.0", "version": "4.2.0",
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs/-/tfjs-4.1.0.tgz", "resolved": "https://registry.npmjs.org/@tensorflow/tfjs/-/tfjs-4.2.0.tgz",
"integrity": "sha512-jlrJ6MIBos8NkmF+NHIWBnKVBGYJTG06QmW/A0vgyXwkp+3PgzX8TJ4MWIv/7oZr7g27zfY6dXA1OFzrrgvklA==", "integrity": "sha512-iZmtyGC9IJkx+TpFnkgDol8BHv2BU3zJ01HyNcuvnm1w1EqoNe+1n8bwvLzI/sxHMcHTqzuu7VugMaphryxE+A==",
"requires": { "requires": {
"@tensorflow/tfjs-backend-cpu": "4.1.0", "@tensorflow/tfjs-backend-cpu": "4.2.0",
"@tensorflow/tfjs-backend-webgl": "4.1.0", "@tensorflow/tfjs-backend-webgl": "4.2.0",
"@tensorflow/tfjs-converter": "4.1.0", "@tensorflow/tfjs-converter": "4.2.0",
"@tensorflow/tfjs-core": "4.1.0", "@tensorflow/tfjs-core": "4.2.0",
"@tensorflow/tfjs-data": "4.1.0", "@tensorflow/tfjs-data": "4.2.0",
"@tensorflow/tfjs-layers": "4.1.0", "@tensorflow/tfjs-layers": "4.2.0",
"argparse": "^1.0.10", "argparse": "^1.0.10",
"chalk": "^4.1.0", "chalk": "^4.1.0",
"core-js": "3", "core-js": "3",
@ -6863,20 +6863,20 @@
} }
}, },
"@tensorflow/tfjs-backend-cpu": { "@tensorflow/tfjs-backend-cpu": {
"version": "4.1.0", "version": "4.2.0",
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-cpu/-/tfjs-backend-cpu-4.1.0.tgz", "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-cpu/-/tfjs-backend-cpu-4.2.0.tgz",
"integrity": "sha512-NqxrwpYa/hXGaBa1RzxfHsLAsaniIZryhF5CxQM9uSp1ny8wUJMH+Mda/Y8+llS3weHug8JDAbAW2cabn8l84A==", "integrity": "sha512-8HWg9J69m0Ovc6w8TVhhixMOcwA3t/NPXLblOA/sgJ+/JD5gsbpLWJk4QISQyb1RnpSVzw6PX3BSMTJU7hWVOg==",
"requires": { "requires": {
"@types/seedrandom": "^2.4.28", "@types/seedrandom": "^2.4.28",
"seedrandom": "^3.0.5" "seedrandom": "^3.0.5"
} }
}, },
"@tensorflow/tfjs-backend-webgl": { "@tensorflow/tfjs-backend-webgl": {
"version": "4.1.0", "version": "4.2.0",
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-webgl/-/tfjs-backend-webgl-4.1.0.tgz", "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-webgl/-/tfjs-backend-webgl-4.2.0.tgz",
"integrity": "sha512-RDjwbFCPESjh+QTrTvKC623MO58gIqxQvtX3DfJLhlsSbnsvIpA5s1CXNJYzNVmFDia35mPYKmQQWvEvhl9weA==", "integrity": "sha512-Qvf+hD5pSh+xi48kChSGzcDKJemkc4EKfoVVjuxl4k25ZUPwuEd7zZUAtinkLu1dzgHNyvePZY8k+9rVm59HJA==",
"requires": { "requires": {
"@tensorflow/tfjs-backend-cpu": "4.1.0", "@tensorflow/tfjs-backend-cpu": "4.2.0",
"@types/offscreencanvas": "~2019.3.0", "@types/offscreencanvas": "~2019.3.0",
"@types/seedrandom": "^2.4.28", "@types/seedrandom": "^2.4.28",
"@types/webgl-ext": "0.0.30", "@types/webgl-ext": "0.0.30",
@ -6884,14 +6884,14 @@
} }
}, },
"@tensorflow/tfjs-converter": { "@tensorflow/tfjs-converter": {
"version": "4.1.0", "version": "4.2.0",
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-converter/-/tfjs-converter-4.1.0.tgz", "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-converter/-/tfjs-converter-4.2.0.tgz",
"integrity": "sha512-pR4TSUI949a/5uUWjHga8xzxD7Y9AbobHJtCmg86Bldfl2GV8aibz87cNjpoO+iUhH8WZo1TOJy8GpM+MPT2DA==" "integrity": "sha512-m+E2KJM6yGQdi8ElzWpChdD/JaqhWMCi9yK70v/ndkOaCL2q2UN48nYP2T5S15vkDvMIgzAQyZfh7hxQsMuvRQ=="
}, },
"@tensorflow/tfjs-core": { "@tensorflow/tfjs-core": {
"version": "4.1.0", "version": "4.2.0",
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-core/-/tfjs-core-4.1.0.tgz", "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-core/-/tfjs-core-4.2.0.tgz",
"integrity": "sha512-zERD4xtxNq3dV3+wPEMi2HWSV68FA8WucSAogzErp38/q98Byv9G1x8DhxQ+jowTcqN4srGWcBfK59jYwjlAvA==", "integrity": "sha512-uuHkiWVC8b00ngFbHvAV7J7haRlN/9PEdeenCi0CzBjgKd7aN25wPWaoN0TSQcU+GT4FJ8mofMZ9VBYZ/s/WLg==",
"requires": { "requires": {
"@types/long": "^4.0.1", "@types/long": "^4.0.1",
"@types/offscreencanvas": "~2019.7.0", "@types/offscreencanvas": "~2019.7.0",
@ -6911,9 +6911,9 @@
} }
}, },
"@tensorflow/tfjs-data": { "@tensorflow/tfjs-data": {
"version": "4.1.0", "version": "4.2.0",
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-data/-/tfjs-data-4.1.0.tgz", "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-data/-/tfjs-data-4.2.0.tgz",
"integrity": "sha512-H6ef6NXPwi2xKYB6tVNZi5RqniMFpfUSlxG3q0BNxnyuyeCUSjJvHJFpah9hT/ysYjVdwspzh/I6B67h+lBchg==", "integrity": "sha512-11t7Q+ikseduJgkd9iSeRrtor1aA3o5PVCFhC5yYvR3JLO55ic1+4Ryo0EJfhRoismS6zBUJrpzX4K0zlLbIfw==",
"requires": { "requires": {
"@types/node-fetch": "^2.1.2", "@types/node-fetch": "^2.1.2",
"node-fetch": "~2.6.1", "node-fetch": "~2.6.1",
@ -6921,17 +6921,17 @@
} }
}, },
"@tensorflow/tfjs-layers": { "@tensorflow/tfjs-layers": {
"version": "4.1.0", "version": "4.2.0",
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-layers/-/tfjs-layers-4.1.0.tgz", "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-layers/-/tfjs-layers-4.2.0.tgz",
"integrity": "sha512-lzHNTZu1GwKl7hW5tt2COSpflE0m7xrsOf8AzRzpTDVJYYRx/x5ScMt/y//5jbRuaDOnb3EjT1FxWxwkD44/sg==" "integrity": "sha512-SO0KTmCFOjrW+PlP9nKYXz07XGFq6uE7am9yH2bRaRPWpEeaKT/+k0C9vFMxI/GzRwY8AK4sLe4U+jE1mhYxGw=="
}, },
"@tensorflow/tfjs-node": { "@tensorflow/tfjs-node": {
"version": "4.1.0", "version": "4.2.0",
"resolved": "https://registry.npmjs.org/@tensorflow/tfjs-node/-/tfjs-node-4.1.0.tgz", "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-node/-/tfjs-node-4.2.0.tgz",
"integrity": "sha512-2H7UJqVafuM9fbsMdzUkcfWLpH/owgvVHWES+gQsiueIqyOjpq6ZGSQLDxyuKtHP2D/8/kWeVIbnzAjnIRniuA==", "integrity": "sha512-dkyExfqTjMVDpKLBzHH2b7JWzGK+QORtYswvoNHbeHwx7kvYYRAQeiHxp+xrgry6LdbWfZs88IWCwNGoOiZ21w==",
"requires": { "requires": {
"@mapbox/node-pre-gyp": "1.0.9", "@mapbox/node-pre-gyp": "1.0.9",
"@tensorflow/tfjs": "4.1.0", "@tensorflow/tfjs": "4.2.0",
"adm-zip": "^0.5.2", "adm-zip": "^0.5.2",
"google-protobuf": "^3.9.2", "google-protobuf": "^3.9.2",
"https-proxy-agent": "^2.2.1", "https-proxy-agent": "^2.2.1",
@ -7661,9 +7661,9 @@
"integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==" "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ=="
}, },
"core-js": { "core-js": {
"version": "3.26.1", "version": "3.27.1",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.26.1.tgz", "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.27.1.tgz",
"integrity": "sha512-21491RRQVzUn0GGM9Z1Jrpr6PNPxPi+Za8OM9q4tksTSnlbXXGKK1nXNg/QvwFYettXvSX6zWKCtHHfjN4puyA==" "integrity": "sha512-GutwJLBChfGCpwwhbYoqfv03LAfmiz7e7D/BNxzeMxwQf10GRSzqiOjx7AmtEk+heiD/JWmBuyBPgFtx0Sg1ww=="
}, },
"cross-spawn": { "cross-spawn": {
"version": "7.0.3", "version": "7.0.3",
@ -9544,9 +9544,9 @@
"dev": true "dev": true
}, },
"node-abi": { "node-abi": {
"version": "3.30.0", "version": "3.31.0",
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.30.0.tgz", "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.31.0.tgz",
"integrity": "sha512-qWO5l3SCqbwQavymOmtTVuCWZE23++S+rxyoHjXqUmPyzRcaoI4lA2gO55/drddGnedAyjA7sk76SfQ5lfUMnw==", "integrity": "sha512-eSKV6s+APenqVh8ubJyiu/YhZgxQpGP66ntzUb3lY1xB9ukSRaGnx0AIxI+IM+1+IVYC1oWobgG5L3Lt9ARykQ==",
"requires": { "requires": {
"semver": "^7.3.5" "semver": "^7.3.5"
} }

View File

@ -28,18 +28,18 @@
"electron": "^22.0.0" "electron": "^22.0.0"
}, },
"dependencies": { "dependencies": {
"@blockly/field-slider": "^4.0.3", "@blockly/field-slider": "^4.0.4",
"@ocoge.club/pigpio": "file:local_modules/pigpio", "@ocoge.club/pigpio": "file:local_modules/pigpio",
"@tensorflow-models/blazeface": "^0.0.7", "@tensorflow-models/blazeface": "^0.0.7",
"@tensorflow-models/knn-classifier": "^1.2.4", "@tensorflow-models/knn-classifier": "^1.2.4",
"@tensorflow-models/mobilenet": "^2.1.0", "@tensorflow-models/mobilenet": "^2.1.0",
"@tensorflow-models/speech-commands": "^0.5.4", "@tensorflow-models/speech-commands": "^0.5.4",
"@tensorflow/tfjs-node": "^4.1.0", "@tensorflow/tfjs-node": "^4.2.0",
"axios": "^1.2.2", "axios": "^1.2.2",
"blockly": "^9.2.0", "blockly": "^9.2.0",
"dracula-prism": "^2.1.13", "dracula-prism": "^2.1.13",
"js-beautify": "^1.14.7", "js-beautify": "^1.14.7",
"node-abi": "^3.30.0", "node-abi": "^3.31.0",
"nodemailer": "^6.8.0", "nodemailer": "^6.8.0",
"prismjs": "^1.29.0" "prismjs": "^1.29.0"
}, },