From ef8f659468144ce127a0e4eded2fc4ba6aaffcb7 Mon Sep 17 00:00:00 2001 From: ocogeclub Date: Tue, 10 Jan 2023 21:46:36 +0900 Subject: [PATCH] =?UTF-8?q?[update]=20Web=20Demo=20=E3=81=A7=E3=82=82?= =?UTF-8?q?=E3=82=BB=E3=83=B3=E3=82=B5=E3=83=BC=E3=83=96=E3=83=AD=E3=83=83?= =?UTF-8?q?=E3=82=AF=E3=81=8C=E8=A1=A8=E7=A4=BA=E3=81=95=E3=82=8C=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apptool.js | 86 ++++++------ blocks/index.js | 20 +++ blocks/sensors/amg8833/index.js | 214 +++++++++++++++++++----------- blocks/sensors/amg8833/index.json | 87 ------------ blocks/sensors/bme280/index.js | 28 +++- blocks/sensors/bme280/index.json | 22 --- blocks/sensors/dht11/index.js | 34 ++++- blocks/sensors/dht11/index.json | 29 ---- blocks/sensors/paj7620/index.js | 40 +++++- blocks/sensors/paj7620/index.json | 37 ------ blocks/sensors/z-line/index.js | 10 ++ index.html | 15 ++- index.js | 2 +- package-lock.json | 184 ++++++++++++------------- package.json | 6 +- 15 files changed, 416 insertions(+), 398 deletions(-) create mode 100644 blocks/index.js delete mode 100644 blocks/sensors/amg8833/index.json delete mode 100644 blocks/sensors/bme280/index.json delete mode 100644 blocks/sensors/dht11/index.json delete mode 100644 blocks/sensors/paj7620/index.json create mode 100644 blocks/sensors/z-line/index.js diff --git a/apptool.js b/apptool.js index 0959678..a3d4d33 100644 --- a/apptool.js +++ b/apptool.js @@ -9,9 +9,9 @@ const ugj_const = { mascot_defname: 'tamachee.png', library_dirname: 'lib', document_root: 'Documents', - tmp_dir: '.ocogeclub/tmp', - executable_path: '.ocogeclub/apps/', - blocks_sensors_dir: 'blocks/sensors/', + tmp_dir: '.ocogeclub/tmp', //ホームディレクトリからのパス + executable_path: '.ocogeclub/apps/', //ホームディレクトリからのパス + blocks_dir: './blocks', // 動作するコードを web demo で生成するためには「./」をつける localStorage_fname: 'ocoge.json', error_ja_all: 'エラーが発生しました。\n『おこげ倶楽部』までお問い合わせください。', pig: 'pigpio', @@ -38,7 +38,7 @@ class appTool { 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.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); const EventEmitter = require('events'); this.ugjEmitter = new EventEmitter(); @@ -51,44 +51,44 @@ class appTool { 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.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.loadSensorblocks(); + this.blocks_dir = this.path.join(this.app_path, ugj_const.blocks_dir); + // this.loadSensorblocks(); } // センサーブロックのロード - loadSensorblocks() { - // ディレクトリの有無 - if (!this.fs.existsSync(this.blocks_sensors_dir)) return; - // ブロックデータ格納ディレクトリのリスト - const allDirents = this.fs.readdirSync(this.blocks_sensors_dir, { withFileTypes: true }); - const blocks_list = allDirents.filter(dirent => dirent.isDirectory()).map(({ name }) => name); - // センサーカテゴリのインスタンス - let category_sensors = workspace.getToolbox().getToolboxItemById('category_sensors'); - let flyout_contents = []; // フライアウトのjsonのリスト - for (let sensor_dir of blocks_list) { //ディレクトリ巡り - if (sensor_dir.charAt(0) == '.') continue; //隠しディレクトリをスキップ - // フライアウトのjsonを取得してパース、リストに追加 - let fname = this.path.join(this.blocks_sensors_dir, sensor_dir, 'index.json'); - let json_text = this.fs.readFileSync(fname); - let obj = JSON.parse(json_text); - flyout_contents = flyout_contents.concat(obj); - // ブロック定義のスクリプト要素をbody要素の最後に追加 - fname = this.path.join(this.blocks_sensors_dir, sensor_dir, 'index.js'); - let script = document.createElement('script'); - script.type = 'text/javascript'; - script.src = fname; - document.body.appendChild(script); - } - let lastline = [{ - "kind": "label", - "text": " ", - "web-line": "4.0", - "web-line-width": "200" - }]; - flyout_contents = flyout_contents.concat(lastline); - // センサーカテゴリのフライアウトをアップデート - category_sensors.updateFlyoutContents(flyout_contents); - } + // loadSensorblocks() { + // // ディレクトリの有無 + // if (!this.fs.existsSync(this.blocks_dir)) return; + // // ブロックデータ格納ディレクトリのリスト + // const allDirents = this.fs.readdirSync(this.blocks_dir, { withFileTypes: true }); + // const blocks_list = allDirents.filter(dirent => dirent.isDirectory()).map(({ name }) => name); + // // センサーカテゴリのインスタンス + // let category_sensors = workspace.getToolbox().getToolboxItemById('category_sensors'); + // let flyout_contents = []; // フライアウトのjsonのリスト + // for (let sensor_dir of blocks_list) { //ディレクトリ巡り + // if (sensor_dir.charAt(0) == '.') continue; //隠しディレクトリをスキップ + // // フライアウトのjsonを取得してパース、リストに追加 + // let fname = this.path.join(this.blocks_dir, sensor_dir, 'index.json'); + // let json_text = this.fs.readFileSync(fname); + // let obj = JSON.parse(json_text); + // flyout_contents = flyout_contents.concat(obj); + // // ブロック定義のスクリプト要素をbody要素の最後に追加 + // fname = this.path.join(this.blocks_dir, sensor_dir, 'index.js'); + // let script = document.createElement('script'); + // script.type = 'text/javascript'; + // script.src = fname; + // document.body.appendChild(script); + // } + // let lastline = [{ + // "kind": "label", + // "text": " ", + // "web-line": "4.0", + // "web-line-width": "200" + // }]; + // flyout_contents = flyout_contents.concat(lastline); + // // センサーカテゴリのフライアウトをアップデート + // category_sensors.updateFlyoutContents(flyout_contents); + // } // 0で数値の桁合わせ : NUM=値 LEN=桁数 @@ -332,6 +332,7 @@ class webTool { // GPIOブロックは使えません this.gpio_backend = ugj_const.pig; this.lang = 'js'; + this.blocks_dir = ugj_const.blocks_dir; } // マスコット @@ -378,7 +379,12 @@ class webTool { cleanupGPIO() { ; } path = { 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) : '') } } } diff --git a/blocks/index.js b/blocks/index.js new file mode 100644 index 0000000..8a7d5d0 --- /dev/null +++ b/blocks/index.js @@ -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" // フライアウト下端の不可視ライン。スクリプトにカテゴリ名を含むので注意 +]); diff --git a/blocks/sensors/amg8833/index.js b/blocks/sensors/amg8833/index.js index 1db0928..14d4541 100644 --- a/blocks/sensors/amg8833/index.js +++ b/blocks/sensors/amg8833/index.js @@ -25,7 +25,7 @@ Blockly.Msg["UGJ_TENSORSET_PARSE_TOOLTIP"] = "JSONテキストをパースして /******************* */ /** Init Grid-Eye ** */ /******************* */ -var ugjGridEyeInitDefinition = { +Blockly.defineBlocksWithJsonArray([{ "type": "ugj_grideye_init", "message0": "%{BKY_UGJ_GRIDEYE_INIT_TITLE}", "args0": [ @@ -50,18 +50,13 @@ var ugjGridEyeInitDefinition = { "tooltip": "%{BKY_UGJ_GRIDEYE_INIT_TOOLTIP}", "helpUrl": "", "style": "sensor_blocks" -}; -Blockly.Blocks['ugj_grideye_init'] = { - init: function () { - this.jsonInit(ugjGridEyeInitDefinition); - } -}; +}]); Blockly.JavaScript['ugj_grideye_init'] = function (block) { var dropdown_addr = block.getFieldValue('addr'); Blockly.JavaScript.provideFunction_( '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_( 'require_amg8833', [`const _amg8833 = require('${modpath}');`] ); @@ -71,19 +66,14 @@ Blockly.JavaScript['ugj_grideye_init'] = function (block) { /********************** */ /** Grid-Eye 本体温度 ** */ /********************** */ -var ugjGridEyeThermistorDefinition = { +Blockly.defineBlocksWithJsonArray([{ "type": "ugj_grideye_thermistor", "message0": "%{BKY_UGJ_GRIDEYE_THERMISTOR_TITLE}", "output": "Number", "tooltip": "%{BKY_UGJ_GRIDEYE_THERMISTOR_TOOLTIP}", "helpUrl": "", "style": "sensor_blocks" -}; -Blockly.Blocks['ugj_grideye_thermistor'] = { - init: function () { - this.jsonInit(ugjGridEyeThermistorDefinition); - } -}; +}]); Blockly.JavaScript['ugj_grideye_thermistor'] = function (block) { var code = `await _amg8833.read_thermistor()`; return [code, Blockly.JavaScript.ORDER_NONE]; @@ -92,7 +82,7 @@ Blockly.JavaScript['ugj_grideye_thermistor'] = function (block) { /**************************** */ /** Read Temperature Array ** */ /**************************** */ -var ugjGridEyeReadDefinition = { +Blockly.defineBlocksWithJsonArray([{ "type": "ugj_grideye_read", "message0": "%{BKY_UGJ_GRIDEYE_READ_TITLE}", "inputsInline": true, @@ -100,12 +90,7 @@ var ugjGridEyeReadDefinition = { "tooltip": "%{BKY_UGJ_GRIDEYE_READ_TOOLTIP}", "helpUrl": "", "style": "sensor_blocks" -}; -Blockly.Blocks['ugj_grideye_read'] = { - init: function () { - this.jsonInit(ugjGridEyeReadDefinition); - } -}; +}]); Blockly.JavaScript['ugj_grideye_read'] = function (block) { var code = 'await _amg8833.read_temp_array()'; return [code, Blockly.JavaScript.ORDER_ATOMIC]; @@ -113,7 +98,7 @@ Blockly.JavaScript['ugj_grideye_read'] = function (block) { /******************* */ /** Stop Grid-Eye ** */ /******************* */ -var ugjGridEyeStopDefinition = { +Blockly.defineBlocksWithJsonArray([{ "type": "ugj_grideye_stop", "message0": "%{BKY_UGJ_GRIDEYE_STOP_TITLE}", "inputsInline": true, @@ -122,12 +107,7 @@ var ugjGridEyeStopDefinition = { "tooltip": "%{BKY_UGJ_GRIDEYE_STOP_TOOLTIP}", "helpUrl": "", "style": "sensor_blocks" -}; -Blockly.Blocks['ugj_grideye_stop'] = { - init: function () { - this.jsonInit(ugjGridEyeStopDefinition); - } -}; +}]); Blockly.JavaScript['ugj_grideye_stop'] = function (block) { var code = 'await _amg8833.stop();\n'; return code; @@ -137,7 +117,7 @@ Blockly.JavaScript['ugj_grideye_stop'] = function (block) { /***************************** */ /** GridEye 表示キャンバス作成 ** */ /***************************** */ -var ugjGridEyeCanvasCreateDefinition = { +Blockly.defineBlocksWithJsonArray([{ "type": "ugj_grideye_canvas_create", "message0": "%{BKY_UGJ_GRIDEYE_CANVAS_CREATE_TITLE}", "inputsInline": true, @@ -146,12 +126,7 @@ var ugjGridEyeCanvasCreateDefinition = { "tooltip": "%{BKY_UGJ_GRIDEYE_CANVAS_CREATE_TOOLTIP}", "helpUrl": "", "style": "multimedia_blocks" -}; -Blockly.Blocks['ugj_grideye_canvas_create'] = { - init: function () { - this.jsonInit(ugjGridEyeCanvasCreateDefinition); - } -}; +}]); Blockly.JavaScript['ugj_grideye_canvas_create'] = function (block) { var code = `let _grideye_canvas = document.createElement('canvas'); _grideye_canvas.setAttribute('width', 8); @@ -169,7 +144,8 @@ Blockly.JavaScript['ugj_grideye_canvas_create'] = function (block) { /********************************************** */ /** Draw IR Array Data to Image Data ** */ /********************************************** */ -var ugjDrawGrideyedataDefinition = { + +Blockly.defineBlocksWithJsonArray([{ "type": "ugj_draw_grideyedata", "message0": "%{BKY_UGJ_DRAW_GRIDEYEDATA_TITLE}", "args0": [ @@ -211,12 +187,7 @@ var ugjDrawGrideyedataDefinition = { "tooltip": "%{BKY_UGJ_DRAW_GRIDEYEDATA_TOOLTIP}", "helpUrl": "", "style": "multimedia_blocks" -}; -Blockly.Blocks['ugj_draw_grideyedata'] = { - init: function () { - this.jsonInit(ugjDrawGrideyedataDefinition); - } -}; +}]); Blockly.JavaScript['ugj_draw_grideyedata'] = function (block) { var value_amg8833data = Blockly.JavaScript.valueToCode(block, 'amg8833data', Blockly.JavaScript.ORDER_ATOMIC); var colour_color_high = block.getFieldValue('color_high'); @@ -258,7 +229,7 @@ Blockly.JavaScript['ugj_draw_grideyedata'] = function (block) { /**************************** */ /** Teachable Machine を開始** */ /**************************** */ -var ugjTeachableMachineDefinition = { +Blockly.defineBlocksWithJsonArray([{ "type": "ugj_teachable_machine", "message0": "%{BKY_UGJ_TEACHABLE_MACHINE_TITLE}", "inputsInline": true, @@ -267,12 +238,7 @@ var ugjTeachableMachineDefinition = { "tooltip": "%{BKY_UGJ_TEACHABLE_MACHINE_TOOLTIP}", "helpUrl": "", "style": "multimedia_blocks" -}; -Blockly.Blocks['ugj_teachable_machine'] = { - init: function () { - this.jsonInit(ugjTeachableMachineDefinition); - } -}; +}]); Blockly.JavaScript['ugj_teachable_machine'] = function (block) { Blockly.JavaScript.provideFunction_( 'require_ts', [`const _tf = require('@tensorflow/tfjs-node');`] @@ -292,7 +258,7 @@ Blockly.JavaScript['ugj_teachable_machine'] = function (block) { /************************* */ /** GridEye で推論を行う ** */ /************************* */ -var ugjGridEyePredictClassDefinition = { +Blockly.defineBlocksWithJsonArray([{ "type": "ugj_grideye_predict_class", "message0": "%{BKY_UGJ_GRIDEYE_PREDICT_CLASS_TITLE}", "inputsInline": true, @@ -300,12 +266,7 @@ var ugjGridEyePredictClassDefinition = { "tooltip": "%{BKY_UGJ_GRIDEYE_PREDICT_CLASS_TOOLTIP}", "helpUrl": "", "style": "multimedia_blocks" -}; -Blockly.Blocks['ugj_grideye_predict_class'] = { - init: function () { - this.jsonInit(ugjGridEyePredictClassDefinition); - } -}; +}]); Blockly.JavaScript['ugj_grideye_predict_class'] = function (block) { var functionName = Blockly.JavaScript.provideFunction_( // left output にするための関数化 '_predictClass', @@ -327,7 +288,7 @@ Blockly.JavaScript['ugj_grideye_predict_class'] = function (block) { /******************************************** */ /** ラベルをつけて Example をデータセットに追加 ** */ /******************************************** */ -var ugjGridEyeAddExampleDefinition = { +Blockly.defineBlocksWithJsonArray([{ "type": "ugj_grideye_add_example", "message0": "%{BKY_UGJ_GRIDEYE_ADD_EXAMPLE_TITLE}", "args0": [ @@ -343,12 +304,7 @@ var ugjGridEyeAddExampleDefinition = { "tooltip": "%{BKY_UGJ_GRIDEYE_ADD_EXAMPLE_TOOLTIP}", "helpUrl": "", "style": "multimedia_blocks" -}; -Blockly.Blocks['ugj_grideye_add_example'] = { - init: function () { - this.jsonInit(ugjGridEyeAddExampleDefinition); - } -}; +}]); Blockly.JavaScript['ugj_grideye_add_example'] = function (block) { 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});`; @@ -357,19 +313,14 @@ Blockly.JavaScript['ugj_grideye_add_example'] = function (block) { /*************************** */ /** 学習したクラスを文字列化 ** */ /*************************** */ -var ugjTensorsetStringifyDefinition = { +Blockly.defineBlocksWithJsonArray([{ "type": "ugj_tensorset_stringify", "message0": "%{BKY_UGJ_TENSORSET_STRINGIFY_TITLE}", "output": null, "tooltip": "%{BKY_UGJ_TENSORSET_STRINGIFY_TOOLTIP}", "helpUrl": "", "style": "multimedia_blocks" -}; -Blockly.Blocks['ugj_tensorset_stringify'] = { - init: function () { - this.jsonInit(ugjTensorsetStringifyDefinition); - } -}; +}]); 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]) )`; return [code, Blockly.JavaScript.ORDER_NONE]; @@ -377,7 +328,7 @@ Blockly.JavaScript['ugj_tensorset_stringify'] = function (block) { /***************************************** */ /** jsonをデータセットに戻して分類器にセット ** */ /***************************************** */ -var ugjTensorsetParseDefinition = { +Blockly.defineBlocksWithJsonArray([{ "type": "ugj_tensorset_parse", "message0": "%{BKY_UGJ_TENSORSET_PARSE_TITLE}", "args0": [ @@ -392,17 +343,124 @@ var ugjTensorsetParseDefinition = { "tooltip": "%{BKY_UGJ_TENSORSET_PARSE_TOOLTIP}", "helpUrl": "", "style": "multimedia_blocks" -}; -Blockly.Blocks['ugj_tensorset_parse'] = { - init: function () { - this.jsonInit(ugjTensorsetParseDefinition); - } -}; +}]); Blockly.JavaScript['ugj_tensorset_parse'] = function (block) { 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)]) ) );`; 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" + } +]); \ No newline at end of file diff --git a/blocks/sensors/amg8833/index.json b/blocks/sensors/amg8833/index.json deleted file mode 100644 index d8842da..0000000 --- a/blocks/sensors/amg8833/index.json +++ /dev/null @@ -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" - } -] \ No newline at end of file diff --git a/blocks/sensors/bme280/index.js b/blocks/sensors/bme280/index.js index d920a9e..2430263 100644 --- a/blocks/sensors/bme280/index.js +++ b/blocks/sensors/bme280/index.js @@ -20,7 +20,7 @@ Blockly.JavaScript['ugj_bme280'] = function (block) { Blockly.JavaScript.provideFunction_( '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_( 'require_bme280', [`const _bme280 = require('${modpath}');`] ); @@ -53,4 +53,28 @@ Blockly.JavaScript['ugj_bme280_data'] = function (block) { var dropdown_thp = block.getFieldValue('thp'); var code = `_bmedata[${dropdown_thp}]`; return [code, Blockly.JavaScript.ORDER_ATOMIC]; -}; \ No newline at end of file +}; + +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" + } + } +]); + diff --git a/blocks/sensors/bme280/index.json b/blocks/sensors/bme280/index.json deleted file mode 100644 index 7a4e319..0000000 --- a/blocks/sensors/bme280/index.json +++ /dev/null @@ -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" - } - } -] \ No newline at end of file diff --git a/blocks/sensors/dht11/index.js b/blocks/sensors/dht11/index.js index a465784..edc67e1 100644 --- a/blocks/sensors/dht11/index.js +++ b/blocks/sensors/dht11/index.js @@ -15,7 +15,7 @@ Blockly.Blocks['ugj_dht11'] = { }; Blockly.JavaScript['ugj_dht11'] = function (block) { 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(); let _dhtdata = JSON.parse(_th);`; // let _dht11data[0] = @@ -38,4 +38,34 @@ Blockly.JavaScript['ugj_dht11_data'] = function (block) { var dropdown_th = block.getFieldValue('th'); var code = `_dhtdata.${dropdown_th}`; return [code, Blockly.JavaScript.ORDER_ATOMIC]; -}; \ No newline at end of file +}; + +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" + } + } +]); \ No newline at end of file diff --git a/blocks/sensors/dht11/index.json b/blocks/sensors/dht11/index.json deleted file mode 100644 index 7e4b061..0000000 --- a/blocks/sensors/dht11/index.json +++ /dev/null @@ -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" - } - } -] \ No newline at end of file diff --git a/blocks/sensors/paj7620/index.js b/blocks/sensors/paj7620/index.js index 720cd6b..90ef2f0 100644 --- a/blocks/sensors/paj7620/index.js +++ b/blocks/sensors/paj7620/index.js @@ -35,7 +35,7 @@ Blockly.JavaScript['ugj_gesture_init'] = function (block) { Blockly.JavaScript.provideFunction_( '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_( 'require_paj7620', [`const _paj7620 = require('${modpath}');`] ); @@ -87,3 +87,41 @@ Blockly.JavaScript['ugj_gesture_stop'] = function (block) { var code = 'await _paj7620.stop();\n'; 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" + } +]); \ No newline at end of file diff --git a/blocks/sensors/paj7620/index.json b/blocks/sensors/paj7620/index.json deleted file mode 100644 index fdf9602..0000000 --- a/blocks/sensors/paj7620/index.json +++ /dev/null @@ -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" - } -] \ No newline at end of file diff --git a/blocks/sensors/z-line/index.js b/blocks/sensors/z-line/index.js new file mode 100644 index 0000000..e9ccea6 --- /dev/null +++ b/blocks/sensors/z-line/index.js @@ -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 = []; +})(); \ No newline at end of file diff --git a/index.html b/index.html index 968b64a..a89a69d 100644 --- a/index.html +++ b/index.html @@ -12,7 +12,12 @@ - + + + + + + @@ -1046,11 +1051,13 @@ + - - - + + + + \ No newline at end of file diff --git a/index.js b/index.js index 8eda22b..4a1417a 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,6 @@ 'use strict'; -const { checkPrimeSync } = require('crypto'); +// const { checkPrimeSync } = require('crypto'); let apptool = appTool_new(); diff --git a/package-lock.json b/package-lock.json index 47bd768..c7e5b63 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,26 +1,26 @@ { "name": "ocoge", - "version": "0.1.9", + "version": "0.1.10", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "ocoge", - "version": "0.1.9", + "version": "0.1.10", "license": "ISC", "dependencies": { - "@blockly/field-slider": "^4.0.3", + "@blockly/field-slider": "^4.0.4", "@ocoge.club/pigpio": "file:local_modules/pigpio", "@tensorflow-models/blazeface": "^0.0.7", "@tensorflow-models/knn-classifier": "^1.2.4", "@tensorflow-models/mobilenet": "^2.1.0", "@tensorflow-models/speech-commands": "^0.5.4", - "@tensorflow/tfjs-node": "^4.1.0", + "@tensorflow/tfjs-node": "^4.2.0", "axios": "^1.2.2", "blockly": "^9.2.0", "dracula-prism": "^2.1.13", "js-beautify": "^1.14.7", - "node-abi": "^3.30.0", + "node-abi": "^3.31.0", "nodemailer": "^6.8.0", "prismjs": "^1.29.0" }, @@ -46,9 +46,9 @@ "integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==" }, "node_modules/@blockly/field-slider": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/@blockly/field-slider/-/field-slider-4.0.3.tgz", - "integrity": "sha512-jbTEp4pHf+WG8eac3czUW+CvE+IKa8poZ97Jd3l+QPfeKuljWt9YYQ6x+7iOBx135kpHAZXUmPbQtRCjZA5oCw==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@blockly/field-slider/-/field-slider-4.0.4.tgz", + "integrity": "sha512-T3lMHzG1uaTLkv9WfDLO6Mo4uYLCQVP3mJzS/yICPvEAWzYXps+Ig5MJBLe3Mfh4qBkQyFO3jG2EgYK+jytJ9w==", "engines": { "node": ">=8.0.0" }, @@ -728,16 +728,16 @@ } }, "node_modules/@tensorflow/tfjs": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs/-/tfjs-4.1.0.tgz", - "integrity": "sha512-jlrJ6MIBos8NkmF+NHIWBnKVBGYJTG06QmW/A0vgyXwkp+3PgzX8TJ4MWIv/7oZr7g27zfY6dXA1OFzrrgvklA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs/-/tfjs-4.2.0.tgz", + "integrity": "sha512-iZmtyGC9IJkx+TpFnkgDol8BHv2BU3zJ01HyNcuvnm1w1EqoNe+1n8bwvLzI/sxHMcHTqzuu7VugMaphryxE+A==", "dependencies": { - "@tensorflow/tfjs-backend-cpu": "4.1.0", - "@tensorflow/tfjs-backend-webgl": "4.1.0", - "@tensorflow/tfjs-converter": "4.1.0", - "@tensorflow/tfjs-core": "4.1.0", - "@tensorflow/tfjs-data": "4.1.0", - "@tensorflow/tfjs-layers": "4.1.0", + "@tensorflow/tfjs-backend-cpu": "4.2.0", + "@tensorflow/tfjs-backend-webgl": "4.2.0", + "@tensorflow/tfjs-converter": "4.2.0", + "@tensorflow/tfjs-core": "4.2.0", + "@tensorflow/tfjs-data": "4.2.0", + "@tensorflow/tfjs-layers": "4.2.0", "argparse": "^1.0.10", "chalk": "^4.1.0", "core-js": "3", @@ -749,9 +749,9 @@ } }, "node_modules/@tensorflow/tfjs-backend-cpu": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-cpu/-/tfjs-backend-cpu-4.1.0.tgz", - "integrity": "sha512-NqxrwpYa/hXGaBa1RzxfHsLAsaniIZryhF5CxQM9uSp1ny8wUJMH+Mda/Y8+llS3weHug8JDAbAW2cabn8l84A==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-cpu/-/tfjs-backend-cpu-4.2.0.tgz", + "integrity": "sha512-8HWg9J69m0Ovc6w8TVhhixMOcwA3t/NPXLblOA/sgJ+/JD5gsbpLWJk4QISQyb1RnpSVzw6PX3BSMTJU7hWVOg==", "dependencies": { "@types/seedrandom": "^2.4.28", "seedrandom": "^3.0.5" @@ -760,15 +760,15 @@ "yarn": ">= 1.3.2" }, "peerDependencies": { - "@tensorflow/tfjs-core": "4.1.0" + "@tensorflow/tfjs-core": "4.2.0" } }, "node_modules/@tensorflow/tfjs-backend-webgl": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-webgl/-/tfjs-backend-webgl-4.1.0.tgz", - "integrity": "sha512-RDjwbFCPESjh+QTrTvKC623MO58gIqxQvtX3DfJLhlsSbnsvIpA5s1CXNJYzNVmFDia35mPYKmQQWvEvhl9weA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-webgl/-/tfjs-backend-webgl-4.2.0.tgz", + "integrity": "sha512-Qvf+hD5pSh+xi48kChSGzcDKJemkc4EKfoVVjuxl4k25ZUPwuEd7zZUAtinkLu1dzgHNyvePZY8k+9rVm59HJA==", "dependencies": { - "@tensorflow/tfjs-backend-cpu": "4.1.0", + "@tensorflow/tfjs-backend-cpu": "4.2.0", "@types/offscreencanvas": "~2019.3.0", "@types/seedrandom": "^2.4.28", "@types/webgl-ext": "0.0.30", @@ -778,21 +778,21 @@ "yarn": ">= 1.3.2" }, "peerDependencies": { - "@tensorflow/tfjs-core": "4.1.0" + "@tensorflow/tfjs-core": "4.2.0" } }, "node_modules/@tensorflow/tfjs-converter": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-converter/-/tfjs-converter-4.1.0.tgz", - "integrity": "sha512-pR4TSUI949a/5uUWjHga8xzxD7Y9AbobHJtCmg86Bldfl2GV8aibz87cNjpoO+iUhH8WZo1TOJy8GpM+MPT2DA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-converter/-/tfjs-converter-4.2.0.tgz", + "integrity": "sha512-m+E2KJM6yGQdi8ElzWpChdD/JaqhWMCi9yK70v/ndkOaCL2q2UN48nYP2T5S15vkDvMIgzAQyZfh7hxQsMuvRQ==", "peerDependencies": { - "@tensorflow/tfjs-core": "4.1.0" + "@tensorflow/tfjs-core": "4.2.0" } }, "node_modules/@tensorflow/tfjs-core": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-core/-/tfjs-core-4.1.0.tgz", - "integrity": "sha512-zERD4xtxNq3dV3+wPEMi2HWSV68FA8WucSAogzErp38/q98Byv9G1x8DhxQ+jowTcqN4srGWcBfK59jYwjlAvA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-core/-/tfjs-core-4.2.0.tgz", + "integrity": "sha512-uuHkiWVC8b00ngFbHvAV7J7haRlN/9PEdeenCi0CzBjgKd7aN25wPWaoN0TSQcU+GT4FJ8mofMZ9VBYZ/s/WLg==", "dependencies": { "@types/long": "^4.0.1", "@types/offscreencanvas": "~2019.7.0", @@ -813,35 +813,35 @@ "integrity": "sha512-PGcyveRIpL1XIqK8eBsmRBt76eFgtzuPiSTyKHZxnGemp2yzGzWpjYKAfK3wIMiU7eH+851yEpiuP8JZerTmWg==" }, "node_modules/@tensorflow/tfjs-data": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-data/-/tfjs-data-4.1.0.tgz", - "integrity": "sha512-H6ef6NXPwi2xKYB6tVNZi5RqniMFpfUSlxG3q0BNxnyuyeCUSjJvHJFpah9hT/ysYjVdwspzh/I6B67h+lBchg==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-data/-/tfjs-data-4.2.0.tgz", + "integrity": "sha512-11t7Q+ikseduJgkd9iSeRrtor1aA3o5PVCFhC5yYvR3JLO55ic1+4Ryo0EJfhRoismS6zBUJrpzX4K0zlLbIfw==", "dependencies": { "@types/node-fetch": "^2.1.2", "node-fetch": "~2.6.1", "string_decoder": "^1.3.0" }, "peerDependencies": { - "@tensorflow/tfjs-core": "4.1.0", + "@tensorflow/tfjs-core": "4.2.0", "seedrandom": "^3.0.5" } }, "node_modules/@tensorflow/tfjs-layers": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-layers/-/tfjs-layers-4.1.0.tgz", - "integrity": "sha512-lzHNTZu1GwKl7hW5tt2COSpflE0m7xrsOf8AzRzpTDVJYYRx/x5ScMt/y//5jbRuaDOnb3EjT1FxWxwkD44/sg==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-layers/-/tfjs-layers-4.2.0.tgz", + "integrity": "sha512-SO0KTmCFOjrW+PlP9nKYXz07XGFq6uE7am9yH2bRaRPWpEeaKT/+k0C9vFMxI/GzRwY8AK4sLe4U+jE1mhYxGw==", "peerDependencies": { - "@tensorflow/tfjs-core": "4.1.0" + "@tensorflow/tfjs-core": "4.2.0" } }, "node_modules/@tensorflow/tfjs-node": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-node/-/tfjs-node-4.1.0.tgz", - "integrity": "sha512-2H7UJqVafuM9fbsMdzUkcfWLpH/owgvVHWES+gQsiueIqyOjpq6ZGSQLDxyuKtHP2D/8/kWeVIbnzAjnIRniuA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-node/-/tfjs-node-4.2.0.tgz", + "integrity": "sha512-dkyExfqTjMVDpKLBzHH2b7JWzGK+QORtYswvoNHbeHwx7kvYYRAQeiHxp+xrgry6LdbWfZs88IWCwNGoOiZ21w==", "hasInstallScript": true, "dependencies": { "@mapbox/node-pre-gyp": "1.0.9", - "@tensorflow/tfjs": "4.1.0", + "@tensorflow/tfjs": "4.2.0", "adm-zip": "^0.5.2", "google-protobuf": "^3.9.2", "https-proxy-agent": "^2.2.1", @@ -1798,9 +1798,9 @@ "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==" }, "node_modules/core-js": { - "version": "3.26.1", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.26.1.tgz", - "integrity": "sha512-21491RRQVzUn0GGM9Z1Jrpr6PNPxPi+Za8OM9q4tksTSnlbXXGKK1nXNg/QvwFYettXvSX6zWKCtHHfjN4puyA==", + "version": "3.27.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.27.1.tgz", + "integrity": "sha512-GutwJLBChfGCpwwhbYoqfv03LAfmiz7e7D/BNxzeMxwQf10GRSzqiOjx7AmtEk+heiD/JWmBuyBPgFtx0Sg1ww==", "hasInstallScript": true, "funding": { "type": "opencollective", @@ -4306,9 +4306,9 @@ "dev": true }, "node_modules/node-abi": { - "version": "3.30.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.30.0.tgz", - "integrity": "sha512-qWO5l3SCqbwQavymOmtTVuCWZE23++S+rxyoHjXqUmPyzRcaoI4lA2gO55/drddGnedAyjA7sk76SfQ5lfUMnw==", + "version": "3.31.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.31.0.tgz", + "integrity": "sha512-eSKV6s+APenqVh8ubJyiu/YhZgxQpGP66ntzUb3lY1xB9ukSRaGnx0AIxI+IM+1+IVYC1oWobgG5L3Lt9ARykQ==", "dependencies": { "semver": "^7.3.5" }, @@ -6315,9 +6315,9 @@ }, "dependencies": { "@blockly/field-slider": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/@blockly/field-slider/-/field-slider-4.0.3.tgz", - "integrity": "sha512-jbTEp4pHf+WG8eac3czUW+CvE+IKa8poZ97Jd3l+QPfeKuljWt9YYQ6x+7iOBx135kpHAZXUmPbQtRCjZA5oCw==" + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@blockly/field-slider/-/field-slider-4.0.4.tgz", + "integrity": "sha512-T3lMHzG1uaTLkv9WfDLO6Mo4uYLCQVP3mJzS/yICPvEAWzYXps+Ig5MJBLe3Mfh4qBkQyFO3jG2EgYK+jytJ9w==" }, "@electron-forge/cli": { "version": "6.0.4", @@ -6814,16 +6814,16 @@ "integrity": "sha512-r0c/MvC15/09xWujx1pKe6mA0nta+4jQWDXGkqfSVkXLo8ARrwcZ4mTGLlfvT43ySfidiveUo0m+P51+UK821Q==" }, "@tensorflow/tfjs": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs/-/tfjs-4.1.0.tgz", - "integrity": "sha512-jlrJ6MIBos8NkmF+NHIWBnKVBGYJTG06QmW/A0vgyXwkp+3PgzX8TJ4MWIv/7oZr7g27zfY6dXA1OFzrrgvklA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs/-/tfjs-4.2.0.tgz", + "integrity": "sha512-iZmtyGC9IJkx+TpFnkgDol8BHv2BU3zJ01HyNcuvnm1w1EqoNe+1n8bwvLzI/sxHMcHTqzuu7VugMaphryxE+A==", "requires": { - "@tensorflow/tfjs-backend-cpu": "4.1.0", - "@tensorflow/tfjs-backend-webgl": "4.1.0", - "@tensorflow/tfjs-converter": "4.1.0", - "@tensorflow/tfjs-core": "4.1.0", - "@tensorflow/tfjs-data": "4.1.0", - "@tensorflow/tfjs-layers": "4.1.0", + "@tensorflow/tfjs-backend-cpu": "4.2.0", + "@tensorflow/tfjs-backend-webgl": "4.2.0", + "@tensorflow/tfjs-converter": "4.2.0", + "@tensorflow/tfjs-core": "4.2.0", + "@tensorflow/tfjs-data": "4.2.0", + "@tensorflow/tfjs-layers": "4.2.0", "argparse": "^1.0.10", "chalk": "^4.1.0", "core-js": "3", @@ -6863,20 +6863,20 @@ } }, "@tensorflow/tfjs-backend-cpu": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-cpu/-/tfjs-backend-cpu-4.1.0.tgz", - "integrity": "sha512-NqxrwpYa/hXGaBa1RzxfHsLAsaniIZryhF5CxQM9uSp1ny8wUJMH+Mda/Y8+llS3weHug8JDAbAW2cabn8l84A==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-cpu/-/tfjs-backend-cpu-4.2.0.tgz", + "integrity": "sha512-8HWg9J69m0Ovc6w8TVhhixMOcwA3t/NPXLblOA/sgJ+/JD5gsbpLWJk4QISQyb1RnpSVzw6PX3BSMTJU7hWVOg==", "requires": { "@types/seedrandom": "^2.4.28", "seedrandom": "^3.0.5" } }, "@tensorflow/tfjs-backend-webgl": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-webgl/-/tfjs-backend-webgl-4.1.0.tgz", - "integrity": "sha512-RDjwbFCPESjh+QTrTvKC623MO58gIqxQvtX3DfJLhlsSbnsvIpA5s1CXNJYzNVmFDia35mPYKmQQWvEvhl9weA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-webgl/-/tfjs-backend-webgl-4.2.0.tgz", + "integrity": "sha512-Qvf+hD5pSh+xi48kChSGzcDKJemkc4EKfoVVjuxl4k25ZUPwuEd7zZUAtinkLu1dzgHNyvePZY8k+9rVm59HJA==", "requires": { - "@tensorflow/tfjs-backend-cpu": "4.1.0", + "@tensorflow/tfjs-backend-cpu": "4.2.0", "@types/offscreencanvas": "~2019.3.0", "@types/seedrandom": "^2.4.28", "@types/webgl-ext": "0.0.30", @@ -6884,14 +6884,14 @@ } }, "@tensorflow/tfjs-converter": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-converter/-/tfjs-converter-4.1.0.tgz", - "integrity": "sha512-pR4TSUI949a/5uUWjHga8xzxD7Y9AbobHJtCmg86Bldfl2GV8aibz87cNjpoO+iUhH8WZo1TOJy8GpM+MPT2DA==" + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-converter/-/tfjs-converter-4.2.0.tgz", + "integrity": "sha512-m+E2KJM6yGQdi8ElzWpChdD/JaqhWMCi9yK70v/ndkOaCL2q2UN48nYP2T5S15vkDvMIgzAQyZfh7hxQsMuvRQ==" }, "@tensorflow/tfjs-core": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-core/-/tfjs-core-4.1.0.tgz", - "integrity": "sha512-zERD4xtxNq3dV3+wPEMi2HWSV68FA8WucSAogzErp38/q98Byv9G1x8DhxQ+jowTcqN4srGWcBfK59jYwjlAvA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-core/-/tfjs-core-4.2.0.tgz", + "integrity": "sha512-uuHkiWVC8b00ngFbHvAV7J7haRlN/9PEdeenCi0CzBjgKd7aN25wPWaoN0TSQcU+GT4FJ8mofMZ9VBYZ/s/WLg==", "requires": { "@types/long": "^4.0.1", "@types/offscreencanvas": "~2019.7.0", @@ -6911,9 +6911,9 @@ } }, "@tensorflow/tfjs-data": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-data/-/tfjs-data-4.1.0.tgz", - "integrity": "sha512-H6ef6NXPwi2xKYB6tVNZi5RqniMFpfUSlxG3q0BNxnyuyeCUSjJvHJFpah9hT/ysYjVdwspzh/I6B67h+lBchg==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-data/-/tfjs-data-4.2.0.tgz", + "integrity": "sha512-11t7Q+ikseduJgkd9iSeRrtor1aA3o5PVCFhC5yYvR3JLO55ic1+4Ryo0EJfhRoismS6zBUJrpzX4K0zlLbIfw==", "requires": { "@types/node-fetch": "^2.1.2", "node-fetch": "~2.6.1", @@ -6921,17 +6921,17 @@ } }, "@tensorflow/tfjs-layers": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-layers/-/tfjs-layers-4.1.0.tgz", - "integrity": "sha512-lzHNTZu1GwKl7hW5tt2COSpflE0m7xrsOf8AzRzpTDVJYYRx/x5ScMt/y//5jbRuaDOnb3EjT1FxWxwkD44/sg==" + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-layers/-/tfjs-layers-4.2.0.tgz", + "integrity": "sha512-SO0KTmCFOjrW+PlP9nKYXz07XGFq6uE7am9yH2bRaRPWpEeaKT/+k0C9vFMxI/GzRwY8AK4sLe4U+jE1mhYxGw==" }, "@tensorflow/tfjs-node": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-node/-/tfjs-node-4.1.0.tgz", - "integrity": "sha512-2H7UJqVafuM9fbsMdzUkcfWLpH/owgvVHWES+gQsiueIqyOjpq6ZGSQLDxyuKtHP2D/8/kWeVIbnzAjnIRniuA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-node/-/tfjs-node-4.2.0.tgz", + "integrity": "sha512-dkyExfqTjMVDpKLBzHH2b7JWzGK+QORtYswvoNHbeHwx7kvYYRAQeiHxp+xrgry6LdbWfZs88IWCwNGoOiZ21w==", "requires": { "@mapbox/node-pre-gyp": "1.0.9", - "@tensorflow/tfjs": "4.1.0", + "@tensorflow/tfjs": "4.2.0", "adm-zip": "^0.5.2", "google-protobuf": "^3.9.2", "https-proxy-agent": "^2.2.1", @@ -7661,9 +7661,9 @@ "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==" }, "core-js": { - "version": "3.26.1", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.26.1.tgz", - "integrity": "sha512-21491RRQVzUn0GGM9Z1Jrpr6PNPxPi+Za8OM9q4tksTSnlbXXGKK1nXNg/QvwFYettXvSX6zWKCtHHfjN4puyA==" + "version": "3.27.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.27.1.tgz", + "integrity": "sha512-GutwJLBChfGCpwwhbYoqfv03LAfmiz7e7D/BNxzeMxwQf10GRSzqiOjx7AmtEk+heiD/JWmBuyBPgFtx0Sg1ww==" }, "cross-spawn": { "version": "7.0.3", @@ -9544,9 +9544,9 @@ "dev": true }, "node-abi": { - "version": "3.30.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.30.0.tgz", - "integrity": "sha512-qWO5l3SCqbwQavymOmtTVuCWZE23++S+rxyoHjXqUmPyzRcaoI4lA2gO55/drddGnedAyjA7sk76SfQ5lfUMnw==", + "version": "3.31.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.31.0.tgz", + "integrity": "sha512-eSKV6s+APenqVh8ubJyiu/YhZgxQpGP66ntzUb3lY1xB9ukSRaGnx0AIxI+IM+1+IVYC1oWobgG5L3Lt9ARykQ==", "requires": { "semver": "^7.3.5" } diff --git a/package.json b/package.json index d237a81..fb2819f 100644 --- a/package.json +++ b/package.json @@ -28,18 +28,18 @@ "electron": "^22.0.0" }, "dependencies": { - "@blockly/field-slider": "^4.0.3", + "@blockly/field-slider": "^4.0.4", "@ocoge.club/pigpio": "file:local_modules/pigpio", "@tensorflow-models/blazeface": "^0.0.7", "@tensorflow-models/knn-classifier": "^1.2.4", "@tensorflow-models/mobilenet": "^2.1.0", "@tensorflow-models/speech-commands": "^0.5.4", - "@tensorflow/tfjs-node": "^4.1.0", + "@tensorflow/tfjs-node": "^4.2.0", "axios": "^1.2.2", "blockly": "^9.2.0", "dracula-prism": "^2.1.13", "js-beautify": "^1.14.7", - "node-abi": "^3.30.0", + "node-abi": "^3.31.0", "nodemailer": "^6.8.0", "prismjs": "^1.29.0" },