From a97a207d55d205e52246fded13ff1d5064feb151 Mon Sep 17 00:00:00 2001 From: ocogeclub Date: Sun, 25 Jun 2023 21:18:33 +0900 Subject: [PATCH] [update] new rp2 blocks --- apptool.js | 4 +- blocks/blocks.js | 984 +++++++++++++++++++--------- blocks/{sensors => }/dht11/dht11.py | 0 blocks/{sensors => }/dht11/index.js | 0 blocks/index.js | 4 +- blocks/sensors/amg8833/AMG8833x.js | 6 +- blocks/sensors/bme280/BME280x.js | 6 +- blocks/sensors/paj7620/PAJ7620x.js | 26 +- index.html | 258 ++++---- index.js | 37 +- local_modules/rgpio/index.js | 166 ++--- local_modules/rgpio/rgpio.cpp | 263 +++++--- main.js | 2 +- package-lock.json | 548 ++++++++-------- package.json | 16 +- 15 files changed, 1405 insertions(+), 915 deletions(-) rename blocks/{sensors => }/dht11/dht11.py (100%) rename blocks/{sensors => }/dht11/index.js (100%) diff --git a/apptool.js b/apptool.js index 2df8da6..0468613 100644 --- a/apptool.js +++ b/apptool.js @@ -10,7 +10,7 @@ const ugj_const = { library_dirname: 'lib', document_root: 'Documents', tmp_dir: '.ocogeclub/tmp', //ホームディレクトリからのパス - executable_path: '.ocogeclub/apps/', //ホームディレクトリからのパス + executable_path: 'ocogeclub/bin/', //ホームディレクトリからのパス localStorage_fname: 'ocoge.json', error_ja_all: 'エラーが発生しました。\n『おこげ倶楽部』までお問い合わせください。', pig: 'pigpio', @@ -315,7 +315,7 @@ class appTool { class webTool { constructor() { // GPIOブロックは使えません - this.gpio_lib = ugj_const.pig; + this.gpio_lib = ugj_const.rg; this.lang = 'js'; this.blocks_dir = ugj_const.blocks_dir; } diff --git a/blocks/blocks.js b/blocks/blocks.js index f25a33a..57543fc 100644 --- a/blocks/blocks.js +++ b/blocks/blocks.js @@ -14,6 +14,33 @@ Blockly.FieldColour.TITLES = [ Blockly.FieldColour.COLUMNS = 5; /** Additional Basic Blocks********************************************************************************* */ +Blockly.defineBlocksWithJsonArray([{ + "type": "oc_text_to_number", + "message0": "%1 を整数に変換", + "args0": [ + { + "type": "input_value", + "name": "text", + "check": "String" + } + ], + "inputsInline": true, + "output": null, + "tooltip": "数字のテキストを整数に変換します。数字以外の文字が含まれているとエラーになります。", + "helpUrl": "", + "style": "math_blocks" +}]); +Blockly.JavaScript['oc_text_to_number'] = function (block) { + var value_text = Blockly.JavaScript.valueToCode(block, 'text', Blockly.JavaScript.ORDER_ATOMIC); + var code = `Number(${value_text})`; + return [code, Blockly.JavaScript.ORDER_NONE]; +}; +Blockly.Python['oc_text_to_number'] = function (block) { + var value_text = Blockly.Python.valueToCode(block, 'text', Blockly.Python.ORDER_ATOMIC); + var code = `int(${value_text})`; + return [code, Blockly.Python.ORDER_NONE]; +}; + var ugjCodecharDefinition = { "type": "ugj_codechar", "message0": "%{BKY_UGJ_CODECHAR_TITLE}", @@ -166,10 +193,14 @@ Blockly.Python['ugj_dectohex'] = function (block) { }; /** GPIO *****************************************************************************************************/ +/** GPIO 関連共通コード */ +// var require_gpio = [`const _rg = require('${apptool.gpio_lib}');`, +// `await _rg.rgpio_sbc();`]; + /************ */ /** GPIO Open */ /************ */ -var ugjGpioOpenDefinition = { +Blockly.defineBlocksWithJsonArray([{ "type": "ugj_gpio_open", "message0": "%{BKY_GPIO_OPEN_TITLE}", "previousStatement": null, @@ -177,17 +208,12 @@ var ugjGpioOpenDefinition = { "tooltip": "%{BKY_GPIO_OPEN_TOOLTIP}", "helpUrl": "", "style": "gpio_blocks" -}; -Blockly.Blocks['ugj_gpio_open'] = { - init: function () { - this.jsonInit(ugjGpioOpenDefinition); - } -}; +}]); Blockly.JavaScript['ugj_gpio_open'] = function (block) { Blockly.JavaScript.provideFunction_( - 'require_gpio', [`const _pi = require('` + apptool.gpio_lib + `');`] + 'require_gpio', [`const _rg = require('${apptool.gpio_lib}');`] ); - var code = `await _pi.gpio_open();\n`; // + var code = `await _rg.rgpio_sbc();\n`; // return code; }; Blockly.Python['ugj_gpio_open'] = function (block) { @@ -201,7 +227,7 @@ Blockly.Python['ugj_gpio_open'] = function (block) { /************* */ /** GPIO Close */ /************* */ -var ugjGpioCloseDefinition = { +Blockly.defineBlocksWithJsonArray([{ "type": "ugj_gpio_close", "message0": "%{BKY_GPIO_CLOSE_TITLE}", "previousStatement": null, @@ -209,14 +235,9 @@ var ugjGpioCloseDefinition = { "tooltip": "%{BKY_GPIO_CLOSE_TOOLTIP}", "helpUrl": "", "style": "gpio_blocks" -}; -Blockly.Blocks['ugj_gpio_close'] = { - init: function () { - this.jsonInit(ugjGpioCloseDefinition); - } -}; +}]); Blockly.JavaScript['ugj_gpio_close'] = function (block) { - var code = 'await _pi.gpio_close();\n'; + var code = 'await _rg.sbc_stop();\n'; return code; }; Blockly.Python['ugj_gpio_close'] = function (block) { @@ -228,48 +249,47 @@ Blockly.Python['ugj_gpio_close'] = function (block) { /** GPIO Set Output ** */ /*********************** */ var ugjGpioSetOutputDefinition = { - "type": "ugj_gpio_set_output", - "message0": "%{BKY_GPIO_SET_OUTPUT_TITLE}", + "type": "oc_gpio_set_output", + "message0": "GPIO %1 を出力モードにする", "args0": [ { "type": "input_value", - "name": "gpio", + "name": "ugpio", "check": "Number" } ], - "inputsInline": true, "previousStatement": null, "nextStatement": null, - "tooltip": "%{BKY_GPIO_SET_OUTPUT_TOOLTIP}", + "tooltip": "GPIO を出力モードに設定します。", "helpUrl": "", "style": "gpio_blocks" }; -Blockly.Blocks['ugj_gpio_set_output'] = { +Blockly.Blocks['oc_gpio_set_output'] = { init: function () { this.jsonInit(ugjGpioSetOutputDefinition); } }; -Blockly.JavaScript['ugj_gpio_set_output'] = function (block) { - var value_gpio = Blockly.JavaScript.valueToCode(block, 'gpio', Blockly.JavaScript.ORDER_ATOMIC); - var code = `await _pi.gpio_set_output(${value_gpio});\n`; +Blockly.JavaScript['oc_gpio_set_output'] = function (block) { + var value_ugpio = Blockly.JavaScript.valueToCode(block, 'ugpio', Blockly.JavaScript.ORDER_ATOMIC); + var code = `await _rg.gpio_set_output(${value_ugpio});\n`; return code; }; -Blockly.Python['ugj_gpio_set_output'] = function (block) { - var value_gpio = Blockly.Python.valueToCode(block, 'gpio', Blockly.Python.ORDER_ATOMIC); - var code = `_pin[${value_gpio}] = Pin(${value_gpio}, Pin.OUT)\n`; +Blockly.Python['oc_gpio_set_output'] = function (block) { + var value_ugpio = Blockly.Python.valueToCode(block, 'ugpio', Blockly.Python.ORDER_ATOMIC); + var code = `_pin[${value_ugpio}] = Pin(${value_ugpio}, Pin.OUT)\n`; return code; }; /********************** */ /** GPIO Set Input ** */ /********************** */ -var ugjGpioSetInputDefinition = { - "type": "ugj_gpio_set_input", - "message0": "%{BKY_GPIO_SET_INPUT_TITLE}", +Blockly.defineBlocksWithJsonArray([{ + "type": "oc_gpio_set_input", + "message0": "GPIO %1 を入力モードにして %2", "args0": [ { "type": "input_value", - "name": "gpio", + "name": "ugpio", "check": "Number" }, { @@ -277,43 +297,37 @@ var ugjGpioSetInputDefinition = { "name": "lflag", "options": [ [ - "%{BKY_GPIO_SET_INPUT_PULLUP}", - "PULL_UP" + "プルしない", + "SET_PULL_NONE" ], [ - "%{BKY_GPIO_SET_INPUT_PULLDOWN}", - "PULL_DOWN" + "プルアップ", + "SET_PULL_UP" ], [ - "%{BKY_GPIO_SET_INPUT_PULLNONE}", - "PULL_NONE" + "プルダウン", + "SET_PULL_DOWN" ] ] } ], - "inputsInline": true, "previousStatement": null, "nextStatement": null, - "tooltip": "%{BKY_GPIO_SET_INPUT_TOOLTIP}", + "tooltip": "GPIO を入力モードに設定します。Raspberry Pi では内蔵プルアップ/ダウンの設定が可能です。", "helpUrl": "", "style": "gpio_blocks" -}; -Blockly.Blocks['ugj_gpio_set_input'] = { - init: function () { - this.jsonInit(ugjGpioSetInputDefinition); - } -}; -Blockly.JavaScript['ugj_gpio_set_input'] = function (block) { - var value_gpio = Blockly.JavaScript.valueToCode(block, 'gpio', Blockly.JavaScript.ORDER_ATOMIC); +}]); +Blockly.JavaScript['oc_gpio_set_input'] = function (block) { + var value_ugpio = Blockly.JavaScript.valueToCode(block, 'ugpio', Blockly.JavaScript.ORDER_ATOMIC); var dropdown_lflag = block.getFieldValue('lflag'); - var code = `await _pi.gpio_set_input(${value_gpio}, _pi.${dropdown_lflag});\n`; + var code = `await _rg.gpio_set_input(${value_ugpio}, _rg.${dropdown_lflag});\n`; return code; }; -Blockly.Python['ugj_gpio_set_input'] = function (block) { - var value_gpio = Blockly.Python.valueToCode(block, 'gpio', Blockly.Python.ORDER_ATOMIC); +Blockly.Python['oc_gpio_set_input'] = function (block) { + var value_gpio = Blockly.Python.valueToCode(block, 'ugpio', Blockly.Python.ORDER_ATOMIC); var dropdown_lflag = block.getFieldValue('lflag'); let lflag; - if (dropdown_lflag == 'PULL_NONE') { lflag = 'None'; } + if (dropdown_lflag == 'SET_PULL_NONE') { lflag = 'None'; } else { lflag = `Pin.${dropdown_lflag}`; } var code = `_pin[${value_gpio}] = Pin(${value_gpio}, Pin.IN, ${lflag})\n`; return code; @@ -345,7 +359,7 @@ Blockly.Blocks['ugj_gpio_read'] = { }; Blockly.JavaScript['ugj_gpio_read'] = function (block) { var value_gpio = Blockly.JavaScript.valueToCode(block, 'gpio', Blockly.JavaScript.ORDER_ATOMIC); - var code = `await _pi.gpio_read(${value_gpio})`; + var code = `await _rg.gpio_read(${value_gpio})`; return [code, Blockly.JavaScript.ORDER_NONE]; }; Blockly.Python['ugj_gpio_read'] = function (block) { @@ -396,7 +410,7 @@ Blockly.Blocks['ugj_gpio_write'] = { Blockly.JavaScript['ugj_gpio_write'] = function (block) { var value_gpio = Blockly.JavaScript.valueToCode(block, 'gpio', Blockly.JavaScript.ORDER_ATOMIC); var dropdown_level = block.getFieldValue('level'); - var code = `await _pi.gpio_write(${value_gpio}, ${dropdown_level});\n`; + var code = `await _rg.gpio_write(${value_gpio}, ${dropdown_level});\n`; return code; }; Blockly.Python['ugj_gpio_write'] = function (block) { @@ -406,49 +420,6 @@ Blockly.Python['ugj_gpio_write'] = function (block) { return code; }; -/*****************/ -/** Servo motor **/ -/*****************/ -var ugjServoDefinition = { - "type": "ugj_servo", - "message0": "%{BKY_SERVO_TITLE}", - "args0": [ - { - "type": "input_value", - "name": "gpio", - "check": "Number" - }, - { - "type": "input_value", - "name": "pulsewidth", - "check": "Number" - } - ], - "inputsInline": true, - "previousStatement": null, - "nextStatement": null, - "tooltip": "%{BKY_SERVO_TOOLTIP}", - "helpUrl": "", - "style": "gpio_blocks" -}; -Blockly.Blocks['ugj_servo'] = { - init: function () { - this.jsonInit(ugjServoDefinition); - } -}; -Blockly.JavaScript['ugj_servo'] = function (block) { - var value_gpio = Blockly.JavaScript.valueToCode(block, 'gpio', Blockly.JavaScript.ORDER_ATOMIC); - var value_pulsewidth = Blockly.JavaScript.valueToCode(block, 'pulsewidth', Blockly.JavaScript.ORDER_ATOMIC); - var code = `await _pi.servo(${value_gpio}, ${value_pulsewidth});\n`; - return code; -}; -// Blockly.Python['ugj_servo'] = function (block) { -// var value_gpio = Blockly.Python.valueToCode(block, 'gpio', Blockly.Python.ORDER_ATOMIC); -// var value_pulsewidth = Blockly.Python.valueToCode(block, 'pulsewidth', Blockly.Python.ORDER_ATOMIC); -// var code = `await pi.servo(gpioHand, ${value_gpio}, ${value_pulsewidth})\n`; -// return code; -// }; - /************************************************* */ /** starts software timed PWM on an output GPIO ** */ /************************************************* */ @@ -483,7 +454,7 @@ Blockly.Blocks['ugj_pwm'] = { // var value_gpio = Blockly.JavaScript.valueToCode(block, 'gpio', Blockly.JavaScript.ORDER_ATOMIC); // var value_pwm_frequency = Blockly.JavaScript.valueToCode(block, 'pwm_frequency', Blockly.JavaScript.ORDER_ATOMIC); // var value_pwm_duty_cycle = Blockly.JavaScript.valueToCode(block, 'pwm_duty_cycle', Blockly.JavaScript.ORDER_ATOMIC); -// var code = `await _pi.pwm(${value_gpio}, ${value_pwm_frequency}, ${value_pwm_duty_cycle});\n`; +// var code = `await _rg.pwm(${value_gpio}, ${value_pwm_frequency}, ${value_pwm_duty_cycle});\n`; // return code; // }; Blockly.Python['ugj_pwm'] = function (block) { @@ -512,7 +483,7 @@ Blockly.Blocks['oc_pwm_duty'] = { this.setInputsInline(true); this.setPreviousStatement(true, null); this.setNextStatement(true, null); - this.setTooltip("PWM出力に設定したGPIOへパルスを出力します。デューティ値は 0(0%) ~ 65535(100%) の範囲で指定します。"); + this.setTooltip("[RP2] PWM出力に設定したGPIOへパルスを出力します。デューティ値は 0(0%) ~ 65535(100%) の範囲で指定します。"); this.setHelpUrl(""); this.setStyle('gpio_blocks'); } @@ -526,24 +497,34 @@ Blockly.Python['oc_pwm_duty'] = function (block) { /********************** */ /** Open Serial Port ** */ /********************** */ -var ugjSerialOpenDefinition = { - "type": "ugj_serial_open", - "message0": "%{BKY_SERIAL_OPEN_TITLE}", +Blockly.defineBlocksWithJsonArray([{ + "type": "oc_serial_open", + "message0": "ポート %1 のシリアルデバイスを %2 として速度 %3 で開く", "args0": [ + { + "type": "input_value", + "name": "port", + "check": "String" + }, + { + "type": "field_variable", + "name": "ser_hand", + "variable": "シリアルデバイス" + }, { "type": "field_dropdown", "name": "baud", "options": [ [ - "9600", + "9600bps", "9600" ], [ - "19200", + "19200bps", "19200" ], [ - "115200", + "115200bps", "115200" ] ] @@ -552,68 +533,92 @@ var ugjSerialOpenDefinition = { "inputsInline": true, "previousStatement": null, "nextStatement": null, - "tooltip": "%{BKY_SERIAL_OPEN_TOOLTIP}", + "tooltip": "シリアルデバイスに名前をつけて開きます。", "helpUrl": "", "style": "gpio_blocks" -}; -Blockly.Blocks['ugj_serial_open'] = { - init: function () { - this.jsonInit(ugjSerialOpenDefinition); - } -}; -Blockly.JavaScript['ugj_serial_open'] = function (block) { - // var value_tty = Blockly.JavaScript.valueToCode(block, 'tty', Blockly.JavaScript.ORDER_ATOMIC); +}]); +Blockly.JavaScript['oc_serial_open'] = function (block) { + var value_port = Blockly.JavaScript.valueToCode(block, 'port', Blockly.JavaScript.ORDER_ATOMIC); + var variable_ser_hand = Blockly.JavaScript.nameDB_.getName(block.getFieldValue('ser_hand'), Blockly.Names.NameType.VARIABLE); var dropdown_baud = block.getFieldValue('baud'); - Blockly.JavaScript.provideFunction_( - 'require_gpio', [`const _pi = require('` + apptool.gpio_lib + `');`] - ); - var code = `await _pi.serial_open('/dev/ttyS0', ${dropdown_baud});\n`; - // var code = `await _pi.serial_open('/dev/serial0', ${dropdown_baud});\n`; + var code = `${variable_ser_hand} = await _rg.serial_open(${value_port}, ${dropdown_baud});\nconsole.log(${variable_ser_hand});\n`; return code; }; -// Blockly.Python['ugj_serial_open'] = function (block) { -// var value_tty = Blockly.Python.valueToCode(block, 'tty', Blockly.Python.ORDER_ATOMIC); -// var dropdown_baud = block.getFieldValue('baud'); -// Blockly.Python.provideFunction_( -// 'import_lgpio', ['import lgpio as pi'] -// ); -// var code = `ser_hand = pi.serial_open(${value_tty}, ${dropdown_baud}, 0)\n`; -// return code; -// }; /*********************** */ /** Close Serial Port ** */ /*********************** */ -var ugjSerialCloseDefinition = { - "type": "ugj_serial_close", - "message0": "%{BKY_SERIAL_CLOSE_TITLE}", +Blockly.defineBlocksWithJsonArray([{ + "type": "oc_serial_close", + "message0": "%1 を閉じる", + "args0": [ + { + "type": "field_variable", + "name": "ser_hand", + "variable": "シリアルデバイス" + } + ], "inputsInline": true, "previousStatement": null, "nextStatement": null, - "tooltip": "%{BKY_SERIAL_CLOSE_TOOLTIP}", + "tooltip": "シリアルデバイスとの通信を切断します。", "helpUrl": "", "style": "gpio_blocks" -}; -Blockly.Blocks['ugj_serial_close'] = { - init: function () { - this.jsonInit(ugjSerialCloseDefinition); - } -}; -Blockly.JavaScript['ugj_serial_close'] = function (block) { - var code = 'await _pi.serial_close();\n'; +}]); +Blockly.JavaScript['oc_serial_close'] = function (block) { + var variable_ser_hand = Blockly.JavaScript.nameDB_.getName(block.getFieldValue('ser_hand'), Blockly.Names.NameType.VARIABLE); + var code = `await _rg.serial_close(${variable_ser_hand});\n`; return code; }; -// Blockly.Python['ugj_serial_close'] = function (block) { -// var code = 'pi.serial_close(ser_hand)\n'; -// return code; -// }; + +/************************ */ +/** Read Data from Serial */ +/************************ */ +Blockly.defineBlocksWithJsonArray([{ + "type": "oc_serial_read", + "message0": "%1 %2 から %3 文字受け取る", + "args0": [ + { + "type": "field_variable", + "name": "ser_hand", + "variable": "シリアルデバイス" + }, + { + "type": "input_dummy" + }, + { + "type": "input_value", + "name": "count", + "check": "Number" + } + ], + "inputsInline": true, + "output": null, + "tooltip": "シリアルデバイスから指定したバイト数のデータを受け取ります。0を指定すると受信可能な全てのデータを取得します。", + "helpUrl": "", + "style": "gpio_blocks" +}]); +Blockly.JavaScript['oc_serial_read'] = function (block) { + var variable_ser_hand = Blockly.JavaScript.nameDB_.getName(block.getFieldValue('ser_hand'), Blockly.Names.NameType.VARIABLE); + var value_count = Blockly.JavaScript.valueToCode(block, 'count', Blockly.JavaScript.ORDER_ATOMIC); + var code = `await _rg.serial_read(${variable_ser_hand}, ${value_count})`; + return [code, Blockly.JavaScript.ORDER_ATOMIC]; +}; /************************** */ /** Write Data to Serial ** */ /************************** */ -var ugjSerialWriteDefinition = { - "type": "ugj_serial_write", - "message0": "%{BKY_SERIAL_WRITE_TITLE}", +Blockly.defineBlocksWithJsonArray([{ + "type": "oc_serial_write", + "message0": "%1 %2 に %3 を送信する", "args0": [ + { + "type": "field_variable", + "name": "ser_hand", + "variable": "シリアルデバイス" + }, + { + "type": "input_dummy" + }, { "type": "input_value", "name": "data", @@ -623,126 +628,83 @@ var ugjSerialWriteDefinition = { "inputsInline": true, "previousStatement": null, "nextStatement": null, - "tooltip": "%{BKY_SERIAL_WRITE_TOOLTIP}", + "tooltip": "シリアルデバイスにデータを送信します。", "helpUrl": "", "style": "gpio_blocks" -}; -Blockly.Blocks['ugj_serial_write'] = { - init: function () { - this.jsonInit(ugjSerialWriteDefinition); - } -}; -Blockly.JavaScript['ugj_serial_write'] = function (block) { +}]); +Blockly.JavaScript['oc_serial_write'] = function (block) { + var variable_ser_hand = Blockly.JavaScript.nameDB_.getName(block.getFieldValue('ser_hand'), Blockly.Names.NameType.VARIABLE); var value_data = Blockly.JavaScript.valueToCode(block, 'data', Blockly.JavaScript.ORDER_ATOMIC); - var code = `await _pi.serial_write(${value_data});\n`; + // TODO: Assemble JavaScript into code variable. + var code = `await _rg.serial_write(${variable_ser_hand}, ${value_data});\n`; return code; }; -// Blockly.Python['ugj_serial_write'] = function (block) { -// var value_data = Blockly.Python.valueToCode(block, 'data', Blockly.Python.ORDER_ATOMIC); -// var code = `await pi.serial_write(ser_hand, ${value_data}.encode())\n`; -// return code; -// }; - -/************************ */ -/** Read Data from Serial */ -/************************ */ -var ugjSerialReadDefinition = { - "type": "ugj_serial_read", - "message0": "%{BKY_SERIAL_READ_TITLE}", - "args0": [ - { - "type": "input_value", - "name": "count", - "check": "Number" - } - ], - "inputsInline": true, - "output": null, - "tooltip": "%{BKY_SERIAL_READ_TOOLTIP}", - "helpUrl": "", - "style": "gpio_blocks" -}; -Blockly.Blocks['ugj_serial_read'] = { - init: function () { - this.jsonInit(ugjSerialReadDefinition); - } -}; -Blockly.JavaScript['ugj_serial_read'] = function (block) { - var value_count = Blockly.JavaScript.valueToCode(block, 'count', Blockly.JavaScript.ORDER_ATOMIC); - var code = `await _pi.serial_read(${value_count})`; - return [code, Blockly.JavaScript.ORDER_ATOMIC]; -}; -// Blockly.Python['ugj_serial_read'] = function (block) { -// var value_count = Blockly.Python.valueToCode(block, 'count', Blockly.Python.ORDER_ATOMIC); -// var code = `await pi.serial_read(ser_hand, ${value_count}).decode()`; -// return [code, Blockly.Python.ORDER_ATOMIC]; -// }; +/******************************************************************* */ +/** Returns the number of bytes available to be read from the device */ +/******************************************************************* */ /********************* */ /** Open I2C Device ** */ /********************* */ -var ugjI2cOpenDefinition = { - "type": "ugj_i2c_open", - "message0": "%{BKY_I2C_OPEN_TITLE}", - "args0": [ - { - "type": "input_value", - "name": "i2c_address", - "check": "Number" - } - ], - "inputsInline": true, - "previousStatement": null, - "nextStatement": null, - "tooltip": "%{BKY_I2C_OPEN_TOOLTIP}", - "helpUrl": "", - "style": "gpio_blocks" -}; -Blockly.Blocks['ugj_i2c_open'] = { +Blockly.Blocks['oc_i2c_open'] = { init: function () { - this.jsonInit(ugjI2cOpenDefinition); + this.appendValueInput("addr") + .setCheck("Number") + .appendField("アドレス"); + this.appendDummyInput() + .appendField("の I2C デバイスを") + .appendField(new Blockly.FieldVariable("I2Cデバイス"), "i2c_hand") + .appendField("として開く"); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip("I2C接続されたデバイスに名前をつけて通信を開始します。"); + this.setHelpUrl(""); + this.setStyle("gpio_blocks"); } }; -Blockly.JavaScript['ugj_i2c_open'] = function (block) { - var value_i2c_address = Blockly.JavaScript.valueToCode(block, 'i2c_address', Blockly.JavaScript.ORDER_ATOMIC); +Blockly.JavaScript['oc_i2c_open'] = function (block) { + var value_addr = Blockly.JavaScript.valueToCode(block, 'addr', Blockly.JavaScript.ORDER_ATOMIC); + var variable_i2c_hand = Blockly.JavaScript.nameDB_.getName(block.getFieldValue('i2c_hand'), Blockly.Names.NameType.VARIABLE); Blockly.JavaScript.provideFunction_( - 'require_gpio', [`const _pi = require('` + apptool.gpio_lib + `');`] + 'require_gpio', require_gpio ); - var code = `await _pi.i2c_open(${apptool.i2c_bus}, ${value_i2c_address});\n`; + var code = `${variable_i2c_hand} = await _rg.i2c_open(${apptool.i2c_bus}, ${value_addr});\n`; return code; }; -Blockly.Python['ugj_i2c_open'] = function (block) { - var value_i2c_address = Blockly.Python.valueToCode(block, 'i2c_address', Blockly.Python.ORDER_ATOMIC); +Blockly.Python['oc_i2c_open'] = function (block) { + var value_addr = Blockly.Python.valueToCode(block, 'addr', Blockly.Python.ORDER_ATOMIC); + var variable_i2c_hand = Blockly.Python.nameDB_.getName(block.getFieldValue('i2c_hand'), Blockly.Names.NameType.VARIABLE); Blockly.Python.provideFunction_( 'import_i2c', ['from machine import I2C'] ); - var code = `_addr = ${value_i2c_address} -_i2c_hand = I2C(0,sda=Pin(0),scl=Pin(1))\n`; + var code = `_addr = ${value_addr} +${variable_i2c_hand} = I2C(0,sda=Pin(0),scl=Pin(1))\n`; return code; }; /********************** */ /** Close I2C Device ** */ /********************** */ -var ugjI2cCloseDefinition = { - "type": "ugj_i2c_close", - "message0": "%{BKY_I2C_CLOSE_TITLE}", - "inputsInline": true, - "previousStatement": null, - "nextStatement": null, - "tooltip": "%{BKY_I2C_CLOSE_TOOLTIP}", - "helpUrl": "", - "style": "gpio_blocks" -}; -Blockly.Blocks['ugj_i2c_close'] = { +Blockly.Blocks['oc_i2c_close'] = { init: function () { - this.jsonInit(ugjI2cCloseDefinition); + this.appendDummyInput() + // .appendField("I2C デバイス") + .appendField(new Blockly.FieldVariable("I2Cデバイス"), "i2c_hand") + .appendField("を閉じる"); + this.setInputsInline(true); + this.setPreviousStatement(true, null); + this.setNextStatement(true, null); + this.setTooltip("指定した I2C デバイスとの通信を切断します。"); + this.setHelpUrl(""); + this.setStyle("gpio_blocks"); } }; -Blockly.JavaScript['ugj_i2c_close'] = function (block) { - var code = `await _pi.i2c_close();\n`; +Blockly.JavaScript['oc_i2c_close'] = function (block) { + var variable_i2c_hand = Blockly.JavaScript.nameDB_.getName(block.getFieldValue('i2c_hand'), Blockly.Names.NameType.VARIABLE); + var code = `await _rg.i2c_close(${variable_i2c_hand});\n`; return code; }; -Blockly.Python['ugj_i2c_close'] = function (block) { +Blockly.Python['oc_i2c_close'] = function (block) { var code = ``; return code; }; @@ -752,32 +714,43 @@ Blockly.Python['ugj_i2c_close'] = function (block) { /*************************************** */ Blockly.Blocks['oc_i2c_write_byte'] = { init: function () { + this.appendDummyInput() + // .appendField("I2C デバイス") + .appendField(new Blockly.FieldVariable("I2Cデバイス"), "i2c_hand") this.appendValueInput("byte_val") .setCheck("Number") - .appendField("デバイスに1バイトデータ"); + .appendField("に1バイトデータ"); this.appendDummyInput() .appendField("を送信"); this.setPreviousStatement(true, null); this.setNextStatement(true, null); - this.setTooltip("i2cデバイスに1バイトデータを送信します。0-0xFF(255)の範囲の数字で入力してください。"); + this.setTooltip("指定の I2C デバイスに1バイトデータを送信します。0-0xFF(255)の範囲の数字で入力してください。"); this.setHelpUrl(""); this.setStyle('gpio_blocks'); } }; Blockly.JavaScript['oc_i2c_write_byte'] = function (block) { + var variable_i2c_hand = Blockly.JavaScript.nameDB_.getName(block.getFieldValue('i2c_hand'), Blockly.Names.NameType.VARIABLE); var value_byte_val = Blockly.JavaScript.valueToCode(block, 'byte_val', Blockly.JavaScript.ORDER_ATOMIC); - // TODO: Assemble JavaScript into code variable. - var code = `await _pi.i2c_write_byte(${value_byte_val});\n`; + var code = `await _rg.i2c_write_byte(${variable_i2c_hand}, ${value_byte_val});\n`; return code; }; /****************************************************************** */ /** Writes a single byte to the specified register of the device ** */ /****************************************************************** */ -var ugjI2cWriteByteDataDefinition = { +Blockly.defineBlocksWithJsonArray([{ "type": "ugj_i2c_write_byte_data", - "message0": "%{BKY_I2C_WRITE_BYTE_DATA_TITLE}", + "message0": "%1 %2 のレジスタ %3 に %4 を書き込む", "args0": [ + { + "type": "field_variable", + "name": "i2c_hand", + "variable": "I2Cデバイス" + }, + { + "type": "input_dummy" + }, { "type": "input_value", "name": "reg", @@ -792,19 +765,15 @@ var ugjI2cWriteByteDataDefinition = { "inputsInline": true, "previousStatement": null, "nextStatement": null, - "tooltip": "%{BKY_I2C_WRITE_BYTE_DATA_TOOLTIP}", + "tooltip": "I2C デバイスの指定されたレジスタに1バイトを書き込みます。", "helpUrl": "", "style": "gpio_blocks" -}; -Blockly.Blocks['ugj_i2c_write_byte_data'] = { - init: function () { - this.jsonInit(ugjI2cWriteByteDataDefinition); - } -}; +}]); Blockly.JavaScript['ugj_i2c_write_byte_data'] = function (block) { + var variable_i2c_hand = Blockly.JavaScript.nameDB_.getName(block.getFieldValue('i2c_hand'), Blockly.Names.NameType.VARIABLE); var value_reg = Blockly.JavaScript.valueToCode(block, 'reg', Blockly.JavaScript.ORDER_ATOMIC); var value_byte_val = Blockly.JavaScript.valueToCode(block, 'byte_val', Blockly.JavaScript.ORDER_ATOMIC); - var code = `await _pi.i2c_write_byte_data(${value_reg}, ${value_byte_val});\n`; + var code = `await _rg.i2c_write_byte_data(${variable_i2c_hand}, ${value_reg}, ${value_byte_val});\n`; return code; }; Blockly.Python['ugj_i2c_write_byte_data'] = function (block) { @@ -817,10 +786,18 @@ Blockly.Python['ugj_i2c_write_byte_data'] = function (block) { /****************************************************************** */ /** Read a single byte from the specified resister of the device ** */ /****************************************************************** */ -var ugjI2cReadByteDataDefinition = { +Blockly.defineBlocksWithJsonArray([{ "type": "ugj_i2c_read_byte_data", - "message0": "%{BKY_I2C_READ_BYTE_DATA_TITLE}", + "message0": "%1 %2 のレジスタ %3 の値", "args0": [ + { + "type": "field_variable", + "name": "i2c_hand", + "variable": "I2Cデバイス" + }, + { + "type": "input_dummy" + }, { "type": "input_value", "name": "reg", @@ -829,18 +806,14 @@ var ugjI2cReadByteDataDefinition = { ], "inputsInline": true, "output": null, - "tooltip": "%{BKY_I2C_READ_BYTE_DATA_TOOLTIP}", + "tooltip": "I2C デバイスの指定されたレジスタから1バイトを読み込みます。", "helpUrl": "", "style": "gpio_blocks" -}; -Blockly.Blocks['ugj_i2c_read_byte_data'] = { - init: function () { - this.jsonInit(ugjI2cReadByteDataDefinition); - } -}; +}]); Blockly.JavaScript['ugj_i2c_read_byte_data'] = function (block) { + var variable_i2c_hand = Blockly.JavaScript.nameDB_.getName(block.getFieldValue('i2c_hand'), Blockly.Names.NameType.VARIABLE); var value_reg = Blockly.JavaScript.valueToCode(block, 'reg', Blockly.JavaScript.ORDER_ATOMIC); - var code = `await _pi.i2c_read_byte_data(${value_reg})`; + var code = `await _rg.i2c_read_byte_data(${variable_i2c_hand}, ${value_reg})`; return [code, Blockly.JavaScript.ORDER_ATOMIC]; }; Blockly.Python['ugj_i2c_read_byte_data'] = function (block) { @@ -849,8 +822,13 @@ Blockly.Python['ugj_i2c_read_byte_data'] = function (block) { return [code, Blockly.Python.ORDER_ATOMIC]; }; +/************************************************************************ */ +/** Reads a single 16 bit word from the specified register of the device. */ +/************************************************************************ */ Blockly.Blocks['ugj_i2c_read_word_data'] = { init: function () { + this.appendDummyInput() + .appendField(new Blockly.FieldVariable("I2Cデバイス"), "i2c_hand") this.appendValueInput("reg") .setCheck("Number") .appendField("レジスタ"); @@ -864,15 +842,27 @@ Blockly.Blocks['ugj_i2c_read_word_data'] = { } }; Blockly.JavaScript['ugj_i2c_read_word_data'] = function (block) { + var variable_i2c_hand = Blockly.JavaScript.nameDB_.getName(block.getFieldValue('i2c_hand'), Blockly.Names.NameType.VARIABLE); var value_reg = Blockly.JavaScript.valueToCode(block, 'reg', Blockly.JavaScript.ORDER_ATOMIC); - var code = `await _pi.i2c_read_word_data(${value_reg})`; + var code = `await _rg.i2c_read_word_data(${variable_i2c_hand}, ${value_reg})`; return [code, Blockly.JavaScript.ORDER_ATOMIC]; }; -var ugjI2cWriteI2cBlockDataDefinition = { +/***************************************************************** */ +/** Writes up to 32 bytes to the specified register of the device. */ +/***************************************************************** */ +Blockly.defineBlocksWithJsonArray([{ "type": "ugj_i2c_write_i2c_block_data", - "message0": "%{BKY_I2C_WRITE_I2C_BLOCK_DATA_TITLE}", + "message0": "%1 %2 のレジスタ %3 に %4 を書き込む", "args0": [ + { + "type": "field_variable", + "name": "i2c_hand", + "variable": "I2Cデバイス" + }, + { + "type": "input_dummy" + }, { "type": "input_value", "name": "reg", @@ -887,19 +877,15 @@ var ugjI2cWriteI2cBlockDataDefinition = { "inputsInline": true, "previousStatement": null, "nextStatement": null, - "tooltip": "%{BKY_I2C_WRITE_I2C_BLOCK_DATA_TOOLTIP}", + "tooltip": "I2C デバイスの指定されたレジスタに最大32バイトのテキストデータを書き込みます。", "helpUrl": "", "style": "gpio_blocks" -}; -Blockly.Blocks['ugj_i2c_write_i2c_block_data'] = { - init: function () { - this.jsonInit(ugjI2cWriteI2cBlockDataDefinition); - } -}; +}]); Blockly.JavaScript['ugj_i2c_write_i2c_block_data'] = function (block) { + var variable_i2c_hand = Blockly.JavaScript.nameDB_.getName(block.getFieldValue('i2c_hand'), Blockly.Names.NameType.VARIABLE); var value_reg = Blockly.JavaScript.valueToCode(block, 'reg', Blockly.JavaScript.ORDER_ATOMIC); var value_data = Blockly.JavaScript.valueToCode(block, 'data', Blockly.JavaScript.ORDER_ATOMIC); - var code = `await _pi.i2c_write_i2c_block_data (${value_reg}, ${value_data});`; + var code = `await _rg.i2c_write_i2c_block_data (${variable_i2c_hand}, ${value_reg}, ${value_data});`; return code; }; Blockly.Python['ugj_i2c_write_i2c_block_data'] = function (block) { @@ -912,10 +898,18 @@ Blockly.Python['ugj_i2c_write_i2c_block_data'] = function (block) { /************************************************************************** */ /** Returns count bytes read from the raw device associated with handle. ** */ /************************************************************************** */ -var ugjI2cReadDeviceDefinition = { +Blockly.defineBlocksWithJsonArray([{ "type": "ugj_i2c_read_device", - "message0": "%{BKY_I2C_READ_DEVICE_TITLE}", + "message0": "%1 %2 から %3 文字受け取る", "args0": [ + { + "type": "field_variable", + "name": "i2c_hand", + "variable": "I2Cデバイス" + }, + { + "type": "input_dummy" + }, { "type": "input_value", "name": "count", @@ -924,18 +918,14 @@ var ugjI2cReadDeviceDefinition = { ], "inputsInline": true, "output": null, - "tooltip": "%{BKY_I2C_READ_DEVICE_TOOLTIP}", + "tooltip": "I2C デバイスから指定したバイト数のデータを受け取ります。データが指定の長さより短いこともあります。", "helpUrl": "", "style": "gpio_blocks" -}; -Blockly.Blocks['ugj_i2c_read_device'] = { - init: function () { - this.jsonInit(ugjI2cReadDeviceDefinition); - } -}; +}]); Blockly.JavaScript['ugj_i2c_read_device'] = function (block) { + var variable_i2c_hand = Blockly.JavaScript.nameDB_.getName(block.getFieldValue('i2c_hand'), Blockly.Names.NameType.VARIABLE); var value_count = Blockly.JavaScript.valueToCode(block, 'count', Blockly.JavaScript.ORDER_ATOMIC); - var code = `await _pi.i2c_read_device(${value_count})`; + var code = `await _rg.i2c_read_device(${variable_i2c_hand}, ${value_count})`; return [code, Blockly.JavaScript.ORDER_ATOMIC]; }; // Blockly.Python['ugj_i2c_read_device'] = function (block) { @@ -946,10 +936,18 @@ Blockly.JavaScript['ugj_i2c_read_device'] = function (block) { /********************************************** */ /** Writes the data bytes to the raw device. ** */ /********************************************** */ -var ugjI2cWriteDeviceDefinition = { +Blockly.defineBlocksWithJsonArray([{ "type": "ugj_i2c_write_device", - "message0": "%{BKY_I2C_WRITE_DEVICE_TITLE}", + "message0": "%1 %2 に %3 を送信", "args0": [ + { + "type": "field_variable", + "name": "i2c_hand", + "variable": "I2Cデバイス" + }, + { + "type": "input_dummy" + }, { "type": "input_value", "name": "data", @@ -959,18 +957,14 @@ var ugjI2cWriteDeviceDefinition = { "inputsInline": true, "previousStatement": null, "nextStatement": null, - "tooltip": "%{BKY_I2C_WRITE_DEVICE_TOOLTIP}", + "tooltip": "I2C デバイスにデータを送信します。", "helpUrl": "", "style": "gpio_blocks" -}; -Blockly.Blocks['ugj_i2c_write_device'] = { - init: function () { - this.jsonInit(ugjI2cWriteDeviceDefinition); - } -}; +}]); Blockly.JavaScript['ugj_i2c_write_device'] = function (block) { + var variable_i2c_hand = Blockly.JavaScript.nameDB_.getName(block.getFieldValue('i2c_hand'), Blockly.Names.NameType.VARIABLE); var value_data = Blockly.JavaScript.valueToCode(block, 'data', Blockly.JavaScript.ORDER_ATOMIC); - var code = `await _pi.i2c_write_device(${value_data})\n`; + var code = `await _rg.i2c_write_device(${variable_i2c_hand}, ${value_data})\n`; return code; }; // Blockly.Python['ugj_i2c_write_device'] = function (block) { @@ -1588,7 +1582,7 @@ Blockly.JavaScript['ugj_socket'] = function (block) { var value_host = Blockly.JavaScript.valueToCode(block, 'host', Blockly.JavaScript.ORDER_ATOMIC); var value_port = Blockly.JavaScript.valueToCode(block, 'port', Blockly.JavaScript.ORDER_ATOMIC); var statements_connect = Blockly.JavaScript.statementToCode(block, 'connect'); - var variable_data = Blockly.JavaScript.nameDB_.getName(block.getFieldValue('data'), Blockly.Variables.NAME_TYPE); + var variable_data = Blockly.JavaScript.nameDB_.getName(block.getFieldValue('data'), Blockly.Names.NameType.VARIABLE); var statements_data = Blockly.JavaScript.statementToCode(block, 'data'); Blockly.JavaScript.provideFunction_( 'require_net', [`const _net = require('net');`] @@ -2817,6 +2811,252 @@ Blockly.JavaScript['ugj_control_button'] = function (block) { return code; }; +/** ******** */ +/** RP2 専用 */ +/** ******** */ +Blockly.defineBlocksWithJsonArray([{ + "type": "oc_rp2_input", + "message0": "入力待ち", + "inputsInline": true, + "output": null, + "tooltip": "[RP2] 標準入力を待ちます。", + "helpUrl": "", + "style": "text_blocks" +}]); +Blockly.Python['oc_rp2_input'] = function (block) { + Blockly.Python.provideFunction_( + 'import_sys', ['import sys'] + ); + var code = 'sys.stdin.readline().replace("\\n","")'; + return [code, Blockly.Python.ORDER_NONE]; +}; +Blockly.defineBlocksWithJsonArray([{ + "type": "oc_rp2_print", + "message0": "%1 を終端文字なしで表示", + "args0": [ + { + "type": "input_value", + "name": "text", + "check": "String" + } + ], + "inputsInline": true, + "previousStatement": null, + "nextStatement": null, + "tooltip": "[RP2] テキストを表示します。終端文字(改行など)を追加しません。", + "helpUrl": "", + "style": "text_blocks" +}]); +Blockly.Python['oc_rp2_print'] = function (block) { + var value_text = Blockly.Python.valueToCode(block, 'text', Blockly.Python.ORDER_ATOMIC); + var code = `print(${value_text}, end='')\n`; + return code; +}; + +/******************** */ +/** UltraJSON Encoder */ +/******************** */ +Blockly.defineBlocksWithJsonArray([{ + "type": "oc_rp2_ujson_dumps", + "message0": "オブジェクト %1 を JSON に変換", + "args0": [ + { + "type": "input_value", + "name": "obj" + } + ], + "output": null, + "tooltip": "変数や配列の内容を JSON 形式の文字列にエンコードします。", + "helpUrl": "", + "style": "rp2_blocks" +}]); +Blockly.Python['oc_rp2_ujson_dumps'] = function (block) { + var value_obj = Blockly.Python.valueToCode(block, 'obj', Blockly.Python.ORDER_ATOMIC); + Blockly.Python.provideFunction_( + 'import_ujson', ['import ujson'] + ); + var code = `ujson.dumps(${value_obj})`; + return [code, Blockly.Python.ORDER_NONE]; +}; +/******************** */ +/** UltraJSON Decoder */ +/******************** */ +Blockly.defineBlocksWithJsonArray([{ + "type": "oc_rp2_ujson_loads", + "message0": "JSON %1 をオブジェクトに変換", + "args0": [ + { + "type": "input_value", + "name": "json", + "check": "String" + } + ], + "output": null, + "tooltip": "JSON 形式の文字列を元の変数や配列の内容にデコードします。", + "helpUrl": "", + "style": "rp2_blocks" +}]); +Blockly.Python['oc_rp2_ujson_loads'] = function (block) { + var value_json = Blockly.Python.valueToCode(block, 'json', Blockly.Python.ORDER_ATOMIC); + Blockly.Python.provideFunction_( + 'import_ujson', ['import ujson'] + ); + var code = `ujson.loads(${value_json})`; + return [code, Blockly.Python.ORDER_NONE]; +}; + +/****************** */ +/** Setup IR Record */ +/****************** */ +Blockly.defineBlocksWithJsonArray([{ + "type": "oc_rp2_ir_rx", + "message0": "GPIO %1 をリモコン信号受信ピンに設定する", + "args0": [ + { + "type": "input_value", + "name": "gpio", + "check": "Number" + } + ], + "inputsInline": true, + "previousStatement": null, + "nextStatement": null, + "tooltip": "", + "helpUrl": "", + "style": "gpio_blocks" +}]); +Blockly.Python['oc_rp2_ir_rx'] = function (block) { + var value_gpio = Blockly.Python.valueToCode(block, 'gpio', Blockly.Python.ORDER_ATOMIC); + Blockly.Python.provideFunction_( + 'import_upyirrx', ['from UpyIrRx import UpyIrRx'] + ); + var code = `_rx = UpyIrRx(_pin[${value_gpio}])\n`; + return code; +}; +/******************* */ +/** Record IR Signal */ +/******************* */ +Blockly.defineBlocksWithJsonArray([{ + "type": "oc_rp2_ir_record", + "message0": "リモコン信号を受信:待ち受け時間 %1 秒", + "args0": [ + { + "type": "input_value", + "name": "timeout", + "check": "Number" + } + ], + "inputsInline": true, + "output": null, + "tooltip": "", + "helpUrl": "", + "style": "gpio_blocks" +}]); +Blockly.Python['oc_rp2_ir_record'] = function (block) { + var value_timeout = Blockly.Python.valueToCode(block, 'timeout', Blockly.Python.ORDER_ATOMIC); + var functionName = Blockly.Python.provideFunction_( + '_rx_record', + [ + `def ${Blockly.Python.FUNCTION_NAME_PLACEHOLDER_} (rx):`, + ` rx.record(${value_timeout} * 1000)`, + ` if rx.get_mode() == UpyIrRx.MODE_DONE_OK:`, + ` signal_list = rx.get_calibrate_list()`, + ` else:`, + ` signal_list = []`, + ` return signal_list`, + ] + ); + var code = `${functionName}(_rx)`; + return [code, Blockly.Python.ORDER_NONE]; +}; +/******************** */ +/** Setup IR Transmit */ +/******************** */ +Blockly.defineBlocksWithJsonArray([{ + "type": "oc_rp2_ir_tx", + "message0": "GPIO %1 をリモコン信号送信ピンに設定する", + "args0": [ + { + "type": "input_value", + "name": "gpio" + } + ], + "previousStatement": null, + "nextStatement": null, + "tooltip": "", + "helpUrl": "", + "style": "gpio_blocks" +}]); +Blockly.Python['oc_rp2_ir_tx'] = function (block) { + var value_gpio = Blockly.Python.valueToCode(block, 'gpio', Blockly.Python.ORDER_ATOMIC); + Blockly.Python.provideFunction_( + 'import_upyirtx', ['from UpyIrTx import UpyIrTx'] + ); + var code = `_tx = UpyIrTx(0, _pin[${value_gpio}])\n`; + return code; +}; + +/********************* */ +/** Transmit IR Signal */ +/********************* */ +Blockly.defineBlocksWithJsonArray([{ + "type": "oc_rp2_ir_transmit", + "message0": "リモコン信号 %1 を送信", + "args0": [ + { + "type": "input_value", + "name": "signal" + } + ], + "previousStatement": null, + "nextStatement": null, + "tooltip": "リモコン信号を送信します。", + "helpUrl": "", + "style": "gpio_blocks" +}]); +Blockly.Python['oc_rp2_ir_transmit'] = function (block) { + var value_signal = Blockly.Python.valueToCode(block, 'signal', Blockly.Python.ORDER_ATOMIC); + var code = `_tx.send(${value_signal})\n`; + return code; +}; + +/************************ */ +/** RP2 MicroPython Slave */ +/************************ */ +Blockly.Blocks['oc_i2cslave'] = { + init: function () { + this.appendValueInput("i2c_addr") + .setCheck("Number") + .appendField("RP2 スレーブ:I2Cアドレス"); + this.appendDummyInput() + .appendField(new Blockly.FieldVariable("データ"), "data") + .appendField("を受け取ったら"); + this.appendStatementInput("do") + .setCheck(null); + this.setInputsInline(false); + this.setPreviousStatement(true, null); + this.setTooltip("Raspberry Pi Pico(及びその互換機)を I2Cスレーブ化します。受信データは1バイトデータです。i2c_slave.py が必要です。"); + this.setHelpUrl(""); + this.setStyle('gpio_blocks'); + } +}; +Blockly.Python['oc_i2cslave'] = function (block) { + var value_i2c_addr = Blockly.Python.valueToCode(block, 'i2c_addr', Blockly.Python.ORDER_ATOMIC); + var variable_data = Blockly.Python.nameDB_.getName(block.getFieldValue('data'), Blockly.Names.NameType.VARIABLE); + var statements_do = Blockly.Python.statementToCode(block, 'do'); + Blockly.Python.provideFunction_( + 'import_i2cslave', ['from i2cSlave import i2c_slave'] + ); + var code = `_i2cs = i2c_slave(0,sda=0,scl=1,slaveAddress=${value_i2c_addr}) +while True: +${variable_data} = int(_i2cs.get()) +${statements_do} +`; + return code; +}; + + + /////////////////////////////////////////////////////////////////////////// // 開発用 /////////////////////////////////////////////////////////////////////////// @@ -3068,3 +3308,157 @@ Blockly.Python['ugj_controls_foreach'] = function (block) { // return code; // }; +// 削除予定 +/********************** */ +/** Open Serial Port ** */ +/********************** */ +var ugjSerialOpenDefinition = { + "type": "ugj_serial_open", + "message0": "%{BKY_SERIAL_OPEN_TITLE}", + "args0": [ + { + "type": "field_dropdown", + "name": "baud", + "options": [ + [ + "9600", + "9600" + ], + [ + "19200", + "19200" + ], + [ + "115200", + "115200" + ] + ] + } + ], + "inputsInline": true, + "previousStatement": null, + "nextStatement": null, + "tooltip": "%{BKY_SERIAL_OPEN_TOOLTIP}", + "helpUrl": "", + "style": "gpio_blocks" +}; +Blockly.Blocks['ugj_serial_open'] = { + init: function () { + this.jsonInit(ugjSerialOpenDefinition); + } +}; +Blockly.JavaScript['ugj_serial_open'] = function (block) { + // var value_tty = Blockly.JavaScript.valueToCode(block, 'tty', Blockly.JavaScript.ORDER_ATOMIC); + var dropdown_baud = block.getFieldValue('baud'); + // Blockly.JavaScript.provideFunction_( + // 'require_gpio', require_gpio + // ); + var code = `let _ser_hand = await _rg.serial_open('/dev/ttyACM0', ${dropdown_baud});\nconsole.log(_ser_hand);\n`; + // var code = `await _rg.serial_open('/dev/serial0', ${dropdown_baud});\n`; + return code; +}; +// Blockly.Python['ugj_serial_open'] = function (block) { +// var value_tty = Blockly.Python.valueToCode(block, 'tty', Blockly.Python.ORDER_ATOMIC); +// var dropdown_baud = block.getFieldValue('baud'); +// Blockly.Python.provideFunction_( +// 'import_lgpio', ['import lgpio as pi'] +// ); +// var code = `ser_hand = pi.serial_open(${value_tty}, ${dropdown_baud}, 0)\n`; +// return code; +// }; +/*********************** */ +/** Close Serial Port ** */ +/*********************** */ +var ugjSerialCloseDefinition = { + "type": "ugj_serial_close", + "message0": "%{BKY_SERIAL_CLOSE_TITLE}", + "inputsInline": true, + "previousStatement": null, + "nextStatement": null, + "tooltip": "%{BKY_SERIAL_CLOSE_TOOLTIP}", + "helpUrl": "", + "style": "gpio_blocks" +}; +Blockly.Blocks['ugj_serial_close'] = { + init: function () { + this.jsonInit(ugjSerialCloseDefinition); + } +}; +Blockly.JavaScript['ugj_serial_close'] = function (block) { + var code = 'await _rg.serial_close(_ser_hand);\n'; + return code; +}; +// Blockly.Python['ugj_serial_close'] = function (block) { +// var code = 'pi.serial_close(ser_hand)\n'; +// return code; +// }; +/************************** */ +/** Write Data to Serial ** */ +/************************** */ +var ugjSerialWriteDefinition = { + "type": "ugj_serial_write", + "message0": "%{BKY_SERIAL_WRITE_TITLE}", + "args0": [ + { + "type": "input_value", + "name": "data", + "check": "String" + } + ], + "inputsInline": true, + "previousStatement": null, + "nextStatement": null, + "tooltip": "%{BKY_SERIAL_WRITE_TOOLTIP}", + "helpUrl": "", + "style": "gpio_blocks" +}; +Blockly.Blocks['ugj_serial_write'] = { + init: function () { + this.jsonInit(ugjSerialWriteDefinition); + } +}; +Blockly.JavaScript['ugj_serial_write'] = function (block) { + var value_data = Blockly.JavaScript.valueToCode(block, 'data', Blockly.JavaScript.ORDER_ATOMIC); + var code = `let ret = await _rg.serial_write(_ser_hand, ${value_data});\nconsole.log(ret);\n`; + return code; +}; +// Blockly.Python['ugj_serial_write'] = function (block) { +// var value_data = Blockly.Python.valueToCode(block, 'data', Blockly.Python.ORDER_ATOMIC); +// var code = `await pi.serial_write(ser_hand, ${value_data}.encode())\n`; +// return code; +// }; + +/************************ */ +/** Read Data from Serial */ +/************************ */ +var ugjSerialReadDefinition = { + "type": "ugj_serial_read", + "message0": "%{BKY_SERIAL_READ_TITLE}", + "args0": [ + { + "type": "input_value", + "name": "count", + "check": "Number" + } + ], + "inputsInline": true, + "output": null, + "tooltip": "%{BKY_SERIAL_READ_TOOLTIP}", + "helpUrl": "", + "style": "gpio_blocks" +}; +Blockly.Blocks['ugj_serial_read'] = { + init: function () { + this.jsonInit(ugjSerialReadDefinition); + } +}; +Blockly.JavaScript['ugj_serial_read'] = function (block) { + var value_count = Blockly.JavaScript.valueToCode(block, 'count', Blockly.JavaScript.ORDER_ATOMIC); + var code = `await _rg.serial_read(_ser_hand, ${value_count})`; + return [code, Blockly.JavaScript.ORDER_ATOMIC]; +}; +// Blockly.Python['ugj_serial_read'] = function (block) { +// var value_count = Blockly.Python.valueToCode(block, 'count', Blockly.Python.ORDER_ATOMIC); +// var code = `await pi.serial_read(ser_hand, ${value_count}).decode()`; +// return [code, Blockly.Python.ORDER_ATOMIC]; +// }; \ No newline at end of file diff --git a/blocks/sensors/dht11/dht11.py b/blocks/dht11/dht11.py similarity index 100% rename from blocks/sensors/dht11/dht11.py rename to blocks/dht11/dht11.py diff --git a/blocks/sensors/dht11/index.js b/blocks/dht11/index.js similarity index 100% rename from blocks/sensors/dht11/index.js rename to blocks/dht11/index.js diff --git a/blocks/index.js b/blocks/index.js index b90e856..2de794a 100644 --- a/blocks/index.js +++ b/blocks/index.js @@ -29,7 +29,7 @@ registerCategory('sensors', [ // カテゴリディレクトリ名 "amg8833", "paj7620", "bme280", - "dht11", - "pico_slave", + // "dht11", + // "pico_slave", "z-line" // フライアウト下端の不可視ライン。スクリプトにカテゴリ名を含むので注意 ]); diff --git a/blocks/sensors/amg8833/AMG8833x.js b/blocks/sensors/amg8833/AMG8833x.js index d072cb1..f82756f 100644 --- a/blocks/sensors/amg8833/AMG8833x.js +++ b/blocks/sensors/amg8833/AMG8833x.js @@ -12,10 +12,10 @@ exports.init = async (i2c_bus, i2c_addr, wael = null) => { }); } if (pi >= 0) { throw new Error(err_msg); return; } - pi = await pig._gpiod_start('', ''); + pi = await pig._rgpiod_start('', ''); console.log('pi=' + pi); if (i2c_hand >= 0) { throw new Error(err_msg); return; } - i2c_hand = await pig._i2c_open(pi, i2c_bus, i2c_addr); + i2c_hand = await pig._i2c_open(pi, i2c_bus, i2c_addr, 0); console.log('i2c_hand=' + i2c_hand); await pig._i2c_write_byte_data(pi, i2c_hand, 0x00, 0x00); //Normal mode await pig._i2c_write_byte_data(pi, i2c_hand, 0x02, 0x00); //10FPS @@ -45,7 +45,7 @@ exports.stop = async () => { i2c_hand = -1; } if (pi >= 0) { - await pig._gpiod_stop(pi); + await pig._rgpiod_stop(pi); pi = -1; } } diff --git a/blocks/sensors/bme280/BME280x.js b/blocks/sensors/bme280/BME280x.js index cd20cc6..bfff10a 100644 --- a/blocks/sensors/bme280/BME280x.js +++ b/blocks/sensors/bme280/BME280x.js @@ -43,11 +43,11 @@ this.REGISTER_HUMIDITY_DATA = 0xFD; exports.init = async (options) => { this.pig = require(`${apptool.gpio_lib}`); - this.pi = await this.pig._gpiod_start('', ''); + this.pi = await this.pig._rgpiod_start('', ''); this.i2cBusNo = (options && options.hasOwnProperty('i2cBusNo')) ? options.i2cBusNo : 1; this.i2cAddress = (options && options.hasOwnProperty('i2cAddress')) ? options.i2cAddress : this.BME280_DEFAULT_I2C_ADDRESS(); - this.i2cHand = await this.pig._i2c_open(this.pi, this.i2cBusNo, this.i2cAddress); + this.i2cHand = await this.pig._i2c_open(this.pi, this.i2cBusNo, this.i2cAddress, 0); let r; r = await this.pig._i2c_write_byte_data(this.pi, this.i2cHand, this.REGISTER_CHIPID, 0); @@ -96,7 +96,7 @@ exports.cancel = async () => { if (this.i2cHand >= 0) { await this.pig._i2c_close(this.pi, this.i2cHand); this.i2cHand = null; - await this.pig._gpiod_stop(this.pi); + await this.pig._rgpiod_stop(this.pi); this.pi = null; } } diff --git a/blocks/sensors/paj7620/PAJ7620x.js b/blocks/sensors/paj7620/PAJ7620x.js index c7b125a..f0942f6 100644 --- a/blocks/sensors/paj7620/PAJ7620x.js +++ b/blocks/sensors/paj7620/PAJ7620x.js @@ -312,8 +312,8 @@ const initRegisterArray = [ const debug = 1; const err_msg = 'PAJ7620 is already opened. Please close old connection to use new one.'; -let pig = -1; -let pi = -1; +let rg = -1; +let sbc = -1; let i2c_hand = -1; //Initialize the sensors exports.init = async (i2c_bus, i2c_addr, wael = null) => { @@ -322,13 +322,13 @@ exports.init = async (i2c_bus, i2c_addr, wael = null) => { await exports.stop(); }); } - pig = require(`${apptool.gpio_lib}`); - if (pi >= 0) { throw new Error(err_msg); return; } - pi = await pig._gpiod_start('', ''); + rg = require(`rgpio`);//${apptool.gpio_lib} + if (sbc >= 0) { throw new Error(err_msg); return; } + sbc = await rg._rgpiod_start('', ''); if (i2c_hand >= 0) { throw new Error(err_msg); return; } - i2c_hand = await pig._i2c_open(pi, i2c_bus, i2c_addr); + i2c_hand = await rg._i2c_open(sbc, i2c_bus, i2c_addr, 0); if (debug) - console.log("pi=" + pi + ", i2c_hand=" + i2c_hand); + console.log("sbc=" + sbc + ", i2c_hand=" + i2c_hand); await sleep(.001); await paj7620SelectBank(BANK0); @@ -355,7 +355,7 @@ exports.init = async (i2c_bus, i2c_addr, wael = null) => { // Write a byte to a register on the Gesture sensor const paj7620WriteReg = async (addr, cmd) => - await pig._i2c_write_word_data(pi, i2c_hand, addr, cmd); + await rg._i2c_write_word_data(sbc, i2c_hand, addr, cmd); //Select a register bank on the Gesture Sensor const paj7620SelectBank = async bank => { @@ -365,7 +365,7 @@ const paj7620SelectBank = async bank => { //Read a block of bytes of length "qty" starting at address "addr" from the Gesture sensor const paj7620ReadReg = async (addr, qty) => { - return await pig._i2c_read_i2c_block_data(pi, i2c_hand, addr, qty); + return await rg._i2c_read_i2c_block_data(sbc, i2c_hand, addr, qty); } //Return a vlaue from the gestire sensor which can be used in a program @@ -457,12 +457,12 @@ exports.return_gesture = async () => { exports.stop = async () => { if (i2c_hand >= 0) { - await pig._i2c_close(pi, i2c_hand); + await rg._i2c_close(sbc, i2c_hand); i2c_hand = -1; } - if (pi >= 0) { - await pig._gpiod_stop(pi); - pi = -1; + if (sbc >= 0) { + await rg._rgpiod_stop(sbc); + sbc = -1; } } diff --git a/index.html b/index.html index 08d13d9..38ee6a9 100644 --- a/index.html +++ b/index.html @@ -111,7 +111,7 @@ WHILE - 番号 + 番号 1 @@ -129,7 +129,7 @@ - 項目 + 項目 BREAK @@ -214,8 +214,15 @@ + + + + 0 + + + - + @@ -287,7 +294,7 @@ FIRST - list + list @@ -297,7 +304,7 @@ FROM_START - list + list @@ -307,7 +314,7 @@ FROM_START - list + list @@ -334,8 +341,8 @@ - - + + 5 @@ -349,9 +356,9 @@ 1 - - PULL_DOWN - + + SET_PULL_NONE + 6 @@ -364,41 +371,21 @@ - - - - - 29 - - - - - 50 - - - - - - - 29 - - - - - 0 - - - - - + + I2Cデバイス + 0 - + + I2Cデバイス + + + I2Cデバイス 0 @@ -418,6 +405,7 @@ + I2Cデバイス 0 @@ -425,6 +413,7 @@ + I2Cデバイス 0 @@ -432,6 +421,7 @@ + I2Cデバイス 0 @@ -444,6 +434,7 @@ + I2Cデバイス 1 @@ -451,6 +442,7 @@ + I2Cデバイス @@ -466,7 +458,35 @@ - + + シリアルデバイス + 9600 + + + /dev/ttyACM0 + + + + + シリアルデバイス + + + シリアルデバイス + + + 0 + + + + + シリアルデバイス + + + hello + + + + @@ -613,7 +633,7 @@ keydown - キー + キー @@ -623,7 +643,7 @@ - 検出結果 + 検出結果 @@ -636,7 +656,7 @@ FROM_START - 検出結果 + 検出結果 @@ -656,7 +676,7 @@ FROM_START - 検出結果 + 検出結果 @@ -676,7 +696,7 @@ --> - ラベル + ラベル @@ -684,11 +704,11 @@ - スコア + スコア @@ -723,7 +743,7 @@ - URL + URL @@ -743,7 +763,7 @@ - 自分のID + 自分のID @@ -756,7 +776,7 @@ - 相手のID + 相手のID @@ -764,14 +784,14 @@ - 発言 + 発言 - 内容 + 内容 @@ -804,7 +824,7 @@ - 答え + 答え @@ -877,14 +897,14 @@ - 実行結果 + 実行結果 - データストリーム + データストリーム @@ -941,7 +961,7 @@ - 受信データ + 受信データ localhost @@ -971,72 +991,66 @@ - - - - 停止フラグ - - - 停止フラグ - - - FALSE - + + + + + + + - - - - - 停止 - - - - - #ffffff - - - - - #ff00ff - - - - - ループを停止します - - - - - 停止フラグ - - - TRUE - - - - - - - UNTIL - - - 停止フラグ - - - - - - - 0 - - - - - - - - + + + + + + + + + 29 + + + + + 50 + + + + + + + 29 + + + + + 0 + + + + + + + 26 + + + + + + + 3 + + + + + + + 27 + + + + diff --git a/index.js b/index.js index 195407e..3892497 100644 --- a/index.js +++ b/index.js @@ -15,7 +15,7 @@ var sonsor_color = '20'; var multimedia_color = '240'; var network_color = '340'; var special_color = '40'; -var snippets_color = '180'; +var rp2_color = '180'; // テーマ var theme = Blockly.Theme.defineTheme('ocoge', { 'base': Blockly.Themes.Classic, @@ -45,8 +45,8 @@ var theme = Blockly.Theme.defineTheme('ocoge', { 'special_blocks': { "colourPrimary": special_color }, - 'snippets_blocks': { - "colourPrimary": snippets_color + 'rp2_blocks': { + "colourPrimary": rp2_color } }, 'categoryStyles': { @@ -65,8 +65,8 @@ var theme = Blockly.Theme.defineTheme('ocoge', { "special_category": { "colour": special_color }, - "snippets_category": { - "colour": snippets_color + "rp2_category": { + "colour": rp2_color } }, }); @@ -96,10 +96,9 @@ Blockly.Msg["UGJ_FOREACH_ITEM"] = "項目"; Blockly.Msg["UGJ_FOREACH_TOOLTIP"] = "リストの各項目について、その項目を変数「項目」としてステートメントを実行します。"; Blockly.Msg["GPIO_OPEN_TITLE"] = "GPIO を使えるようにする"; -Blockly.Msg["GPIO_OPEN_TOOLTIP"] = "GPIOを初期化して接続します。"; -Blockly.Msg["GPIO_CLOSE_TITLE"] = "GPIO の後片付けをする"; -Blockly.Msg["GPIO_CLOSE_TOOLTIP"] = "GPIOとの接続を終了します。"; +Blockly.Msg["GPIO_OPEN_TOOLTIP"] = "rgpiod デーモンに接続します。"; Blockly.Msg["GPIO_CLOSE_TITLE"] = "GPIO の後片付けをする"; +Blockly.Msg["GPIO_CLOSE_TOOLTIP"] = "rgpiod デーモンから切断します。"; Blockly.Msg["GPIO_SET_INPUT_TITLE"] = "GPIO %1 を入力モードにして %2"; Blockly.Msg["GPIO_SET_INPUT_TOOLTIP"] = "GPIO端子を入力モードにして、プルアップ・プルダウン・無しを設定します。"; Blockly.Msg["GPIO_SET_INPUT_PULLUP"] = "プルアップ"; @@ -114,9 +113,7 @@ Blockly.Msg["GPIO_WRITE_TOOLTIP"] = "GPIO端子の値をデジタル値(0ま Blockly.Msg["SERVO_TITLE"] = "GPIO %1 のサーボモータの回転を %2 にする"; Blockly.Msg["SERVO_TOOLTIP"] = "サーボモータの回転をパルス幅(1000~2000μsec)までの数値で指定します。"; Blockly.Msg["PWM_TITLE"] = "GPIO %1 をパルス周波数 %2 Hzの PWM 出力に設定"; -Blockly.Msg["PWM_TOOLTIP"] = "パルス周波数をセットして、GPIO端子がPWM出力できるようにします。(MicorPython 専用)"; -Blockly.Msg["I2C_OPEN_TITLE"] = "アドレス %1 の I2C デバイスを開く"; -Blockly.Msg["I2C_OPEN_TOOLTIP"] = "I2C接続されたデバイスとの通信を開始します。一度にオープンできるI2Cデバイスはひとつだけです。"; +Blockly.Msg["PWM_TOOLTIP"] = "[RP2] パルス周波数をセットして、GPIO端子がPWM出力できるようにします。"; Blockly.Msg["SERIAL_OPEN_TITLE"] = "シリアルポートを速度 %1 bpsで開く"; Blockly.Msg["SERIAL_OPEN_TOOLTIP"] = "シリアルデバイスとの接続を開きます。"; Blockly.Msg["SERIAL_CLOSE_TITLE"] = "シリアルポートを閉じる"; @@ -125,22 +122,16 @@ Blockly.Msg["SERIAL_WRITE_TITLE"] = "シリアルポートに %1 を送信する Blockly.Msg["SERIAL_WRITE_TOOLTIP"] = "シリアル接続されたデバイスにデータを送信します。シリアルポートは開かれていなくてはいけません。"; Blockly.Msg["SERIAL_READ_TITLE"] = "シリアルポートから %1 文字読み込む"; Blockly.Msg["SERIAL_READ_TOOLTIP"] = "オープン済みシリアルポートから、指定のバイト数だけデータを読み込みます。"; -Blockly.Msg["I2C_CLOSE_TITLE"] = "I2C デバイスを閉じる"; -Blockly.Msg["I2C_CLOSE_TOOLTIP"] = "I2C接続されたデバイスと通信を切断します。"; Blockly.Msg["I2C_WRITE_BYTE_TITLE"] = "デバイスに1バイトデータ %1 を送信"; Blockly.Msg["I2C_WRITE_BYTE_TOOLTIP"] = "i2cデバイスに1バイトデータを送信します。0-0xFFの範囲の数字で入力してください。"; Blockly.Msg["I2C_READ_BYTE_TITLE"] = "I2C デバイスから 1 バイト受け取る"; Blockly.Msg["I2C_READ_BYTE_TOOLTIP"] = "オープン済み I2C デバイスからデータを 1 バイト受け取ります。"; -Blockly.Msg["I2C_WRITE_BYTE_DATA_TITLE"] = "レジスタ %1 に %2 を書き込む"; -Blockly.Msg["I2C_WRITE_BYTE_DATA_TOOLTIP"] = "デバイスの指定されたレジスタに1バイトを書き込みます。"; -Blockly.Msg["I2C_READ_BYTE_DATA_TITLE"] = "レジスタ %1 の値"; -Blockly.Msg["I2C_READ_BYTE_DATA_TOOLTIP"] = "デバイスの指定されたレジスタから1バイトを読み込みます。"; -Blockly.Msg["I2C_WRITE_I2C_BLOCK_DATA_TITLE"] = "レジスタ %1 に %2 を書き込む"; -Blockly.Msg["I2C_WRITE_I2C_BLOCK_DATA_TOOLTIP"] = "デバイスの指定されたレジスタに最大32バイトのテキストデータを書き込みます。"; -Blockly.Msg["I2C_READ_DEVICE_TITLE"] = "i2cデバイスから %1 バイト受け取る"; -Blockly.Msg["I2C_READ_DEVICE_TOOLTIP"] = "デバイスから指定したバイト数のデータを受け取ります。データが指定の長さより短いこともあります。"; -Blockly.Msg["I2C_WRITE_DEVICE_TITLE"] = "i2c デバイスに %1 を送信"; -Blockly.Msg["I2C_WRITE_DEVICE_TOOLTIP"] = "i2c デバイスにデータを送信します。"; +Blockly.Msg["I2C_WRITE_I2C_BLOCK_DATA_TITLE"] = ""; +Blockly.Msg["I2C_WRITE_I2C_BLOCK_DATA_TOOLTIP"] = ""; +Blockly.Msg["I2C_READ_DEVICE_TITLE"] = ""; +Blockly.Msg["I2C_READ_DEVICE_TOOLTIP"] = ""; +Blockly.Msg["I2C_WRITE_DEVICE_TITLE"] = ""; +Blockly.Msg["I2C_WRITE_DEVICE_TOOLTIP"] = ""; Blockly.Msg["UGJ_CODECHAR_TITLE"] = "コード %1 の文字"; Blockly.Msg["UGJ_CODECHAR_TOOLTIP"] = "文字コードを文字に変換します。"; diff --git a/local_modules/rgpio/index.js b/local_modules/rgpio/index.js index 3e80d09..f9df040 100644 --- a/local_modules/rgpio/index.js +++ b/local_modules/rgpio/index.js @@ -1,107 +1,115 @@ module.exports = require('bindings')('rgpio'); -// module.exports.SET_ACTIVE_LOW = 4; -// module.exports.SET_OPEN_DRAIN = 8; -// module.exports.SET_OPEN_SOURCE = 16; -// module.exports.SET_PULL_UP = 32; -// module.exports.SET_PULL_DOWN = 64; -// module.exports.SET_PULL_NONE = 128; -module.exports.PULL_UP = 32; -module.exports.PULL_DOWN = 64; -module.exports.PULL_NONE = 128; - -const CHIP_COUNT = 5; -const port = ''; +module.exports.SET_ACTIVE_LOW = 4; +module.exports.SET_OPEN_DRAIN = 8; +module.exports.SET_OPEN_SOURCE = 16; +module.exports.SET_PULL_UP = 32; +module.exports.SET_PULL_DOWN = 64; +module.exports.SET_PULL_NONE = 128; +// Properties let sbc = -1; -let gpiochip_hand = []; -let ser_hand = -1; -let i2c_hand = -1; -module.exports.gpio_open = async () => { - sbc = await module.exports._gpiod_start('', ''); - if (sbc < 0) return sbc; - for (let i = 0; i < CHIP_COUNT; i++) { - gpiochip_hand.push(await module.exports._gpiochip_open(sbc, i)); - } - return gpiochip_hand; -} -module.exports.gpio_close = async () => { - if (sbc >= 0) { - for (let i = 0; i < CHIP_COUNT; i++) { - if (gpiochip_hand[i] >= 0) - await module.exports._gpiochip_close(sbc, gpiochip_hand[i]); +let chip_hand = []; + +module.exports.rgpio_sbc = async (host = 'localhost', port = 8889, show_errors = true) => { + if (sbc < 0) { + sbc = await module.exports._rgpiod_start(host, port.toString()); + if (sbc < 0) { + if (show_errors) console.log(sbc); } - gpiochip_hand = []; - await module.exports._gpiod_stop(sbc); - sbc = -1; } + return sbc; } -module.exports.gpio_set_output = async gpio => { - let chip = Math.floor(gpio / 32); - let pin = Math.floor(gpio % 32); - if (gpiochip_hand[chip] >= 0) return await module.exports._gpio_claim_output(sbc, gpiochip_hand[chip], pin); +module.exports.sbc_stop = async () => { + await module.exports._rgpiod_stop(sbc); + chip_hand = []; + sbc = -1; } -module.exports.gpio_write = async (gpio, value) => { - let chip = Math.floor(gpio / 32); - let pin = Math.floor(gpio % 32); - if (gpiochip_hand[chip] >= 0) return await module.exports._gpio_write(sbc, gpiochip_hand[chip], pin, value); +module.exports.gpiochip_open = async gpiochip => { + if (!chip_hand[gpiochip] || chip_hand[gpiochip] < 0) { + chip_hand[gpiochip] = await module.exports._gpiochip_open(sbc, gpiochip); + } + return chip_hand[gpiochip]; + // return await module.exports._gpiochip_open(sbc, gpiochip); } -module.exports.serial_open = async (tty, baud) => { - if (ser_hand >= 0) await module.exports._serial_close(sbc, ser_hand); // 勝手に閉じる - ser_hand = await module.exports._serial_open(sbc, tty, baud); - return ser_hand; +module.exports.gpio_set_input = async (ugpio, lFlags = 0) => { + let chip = Math.trunc(ugpio / 32); + let gpio = ugpio % 32; + let handle = await module.exports.gpiochip_open(chip); + return await module.exports._gpio_claim_input(sbc, handle, lFlags, gpio); } -module.exports.serial_close = async () => { - if (ser_hand >= 0) await module.exports._serial_close(sbc, ser_hand); - ser_hand = -1; +module.exports.gpio_set_output = async (ugpio, level = 0, lFlags = 0) => { + let chip = Math.trunc(ugpio / 32); + let gpio = ugpio % 32; + let handle = await module.exports.gpiochip_open(chip); + return await module.exports._gpio_claim_output(sbc, handle, lFlags, gpio, level); } -module.exports.serial_write = async data => { - if (ser_hand >= 0) return await module.exports._serial_write(sbc, ser_hand, Buffer.from(data)); +module.exports.gpio_read = async (ugpio) => { + let chip = Math.trunc(ugpio / 32); + let gpio = ugpio % 32; + let handle = await module.exports.gpiochip_open(chip); + return await module.exports._gpio_read(sbc, handle, gpio); } -module.exports.serial_read = async count => { - if (ser_hand >= 0) return new TextDecoder().decode(await module.exports._serial_read(sbc, ser_hand, count)); - // if (ser_hand >= 0) return await module.exports._serial_read(pi, ser_hand, count);//.toString('utf8'); +module.exports.gpio_write = async (ugpio, level) => { + let chip = Math.trunc(ugpio / 32); + let gpio = ugpio % 32; + let handle = await module.exports.gpiochip_open(chip); + return await module.exports._gpio_write(sbc, handle, gpio, level); } -module.exports.i2c_open = async (i2c_bus, i2c_address) => { - if (i2c_hand >= 0) await module.exports._i2c_close(i2c_hand); // 勝手に閉じる - i2c_hand = await module.exports._i2c_open(sbc, i2c_bus, i2c_address); - return i2c_hand; +module.exports.serial_open = async (tty, baud, ser_flags = 0) => { + return await module.exports._serial_open(sbc, tty, baud, ser_flags); } -module.exports.i2c_close = async () => { - if (i2c_hand >= 0) await module.exports._i2c_close(sbc, i2c_hand); - i2c_hand = -1; +module.exports.serial_close = async handle => { + await module.exports._serial_close(sbc, handle); +} +module.exports.serial_read = async (handle, count = 0) => { + if (count === 0) { + count = await module.exports._serial_data_available(sbc, handle); + if (count === 0) return ''; + } + return new TextDecoder().decode(await module.exports._serial_read(sbc, handle, count)); +} +module.exports.serial_write = async (handle, data) => { + return await module.exports._serial_write(sbc, handle, Buffer.from(data), -1); +} +module.exports.serial_data_available = async handle => { + await module.exports._serial_data_available(sbc, handle); +} +module.exports.i2c_open = async (i2c_bus, i2c_address, i2c_flags = 0) => { + return await module.exports._i2c_open(sbc, i2c_bus, i2c_address, i2c_flags); +} +module.exports.i2c_close = async handle => { + await module.exports._i2c_close(sbc, handle); } -module.exports.i2c_write_byte = async (byte_val) => { - if (i2c_hand >= 0) return await module.exports._i2c_write_byte(sbc, i2c_hand, byte_val); +module.exports.i2c_write_byte = async (handle, byte_val) => { + return await module.exports._i2c_write_byte(sbc, handle, byte_val); } -module.exports.i2c_read_byte = async () => { - if (i2c_hand >= 0) return await module.exports._i2c_read_byte(sbc, i2c_hand); +module.exports.i2c_read_byte = async handle => { + return await module.exports._i2c_read_byte(sbc, handle); } - - -module.exports.i2c_write_byte_data = async (reg, byte_val) => { - if (i2c_hand >= 0) return await module.exports._i2c_write_byte_data(sbc, i2c_hand, reg, byte_val); +module.exports.i2c_write_byte_data = async (handle, reg, byte_val) => { + return await module.exports._i2c_write_byte_data(sbc, handle, reg, byte_val); } -module.exports.i2c_read_byte_data = async reg => { - if (i2c_hand >= 0) return await module.exports._i2c_read_byte_data(sbc, i2c_hand, reg); +module.exports.i2c_read_byte_data = async (handle, reg) => { + return await module.exports._i2c_read_byte_data(sbc, handle, reg); } -module.exports.i2c_write_i2c_block_data = async (reg, data) => { - if (i2c_hand >= 0) return await module.exports._i2c_write_i2c_block_data(sbc, i2c_hand, reg, Buffer.from(data)); +module.exports.i2c_write_i2c_block_data = async (handle, reg, data) => { + return await module.exports._i2c_write_i2c_block_data(sbc, handle, reg, Buffer.from(data), -1); } -module.exports.i2c_read_word_data = async reg => { - if (i2c_hand >= 0) return await module.exports._i2c_read_word_data(sbc, i2c_hand, reg); +module.exports.i2c_read_word_data = async (handle, reg) => { + return await module.exports._i2c_read_word_data(sbc, handle, reg); } -module.exports.i2c_read_device = async count => { - if (i2c_hand >= 0) return new TextDecoder().decode(await module.exports._i2c_read_device(sbc, i2c_hand, count)); +module.exports.i2c_read_device = async (handle, count) => { + return new TextDecoder().decode(await module.exports._i2c_read_device(sbc, handle, count)); } -module.exports.i2c_write_device = async data => { - if (i2c_hand >= 0) return await module.exports._i2c_write_device(sbc, i2c_hand, Buffer.from(data)); +module.exports.i2c_write_device = async (handle, data) => { + return await module.exports._i2c_write_device(sbc, handle, Buffer.from(data), -1); } // 終了処理 module.exports.close_all_handle = async () => { - await module.exports.gpio_close(); - await module.exports.serial_close(); - await module.exports.i2c_close(); + await module.exports.sbc_stop(); + // await module.exports.serial_close(); + // await module.exports.i2c_close(); } \ No newline at end of file diff --git a/local_modules/rgpio/rgpio.cpp b/local_modules/rgpio/rgpio.cpp index a219f6b..2762ff7 100644 --- a/local_modules/rgpio/rgpio.cpp +++ b/local_modules/rgpio/rgpio.cpp @@ -16,12 +16,12 @@ Promise _rgpiodStart(const CallbackInfo &info) if (info.Length() != 2) { deferred.Reject( - TypeError::New(env, "Invalid argument count").Value()); + TypeError::New(env, "Invalid argument count: _rgpiodStart").Value()); } if (!info[0].IsString() || !info[1].IsString()) { deferred.Reject( - Napi::TypeError::New(env, "Invalid argument types").Value()); + Napi::TypeError::New(env, "Invalid argument types: _rgpiodStart").Value()); } else { @@ -39,12 +39,12 @@ Promise _rgpiodStop(const CallbackInfo &info) if (info.Length() != 1) { deferred.Reject( - TypeError::New(env, "Invalid argument count").Value()); + TypeError::New(env, "Invalid argument count: _rgpiodStop").Value()); } if (!info[0].IsNumber()) { deferred.Reject( - Napi::TypeError::New(env, "Invalid argument types").Value()); + Napi::TypeError::New(env, "Invalid argument types: _rgpiodStop").Value()); } else { @@ -63,12 +63,12 @@ Promise _gpiochipOpen(const CallbackInfo &info) if (info.Length() != 2) { deferred.Reject( - TypeError::New(env, "Invalid argument count").Value()); + TypeError::New(env, "Invalid argument count: _gpiochipOpen").Value()); } if (!info[0].IsNumber() || !info[1].IsNumber()) { deferred.Reject( - Napi::TypeError::New(env, "Invalid argument types").Value()); + Napi::TypeError::New(env, "Invalid argument types: _gpiochipOpen").Value()); } else { @@ -87,12 +87,12 @@ Promise _gpiochipClose(const CallbackInfo &info) if (info.Length() != 2) { deferred.Reject( - TypeError::New(env, "Invalid argument count").Value()); + TypeError::New(env, "Invalid argument count: _gpiochipClose").Value()); } if (!info[0].IsNumber() || !info[1].IsNumber()) { deferred.Reject( - Napi::TypeError::New(env, "Invalid argument types").Value()); + Napi::TypeError::New(env, "Invalid argument types: _gpiochipClose").Value()); } else { @@ -105,18 +105,73 @@ Promise _gpiochipClose(const CallbackInfo &info) // GPIO のモードを出力にする(ことを要求?) Promise _gpioClaimOutput(const CallbackInfo &info) +{ + Env env = info.Env(); + auto deferred = Napi::Promise::Deferred::New(env); + if (info.Length() != 5) + { + deferred.Reject( + TypeError::New(env, "Invalid argument count: _gpioClaimOutput").Value()); + } + if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber() || !info[3].IsNumber() || !info[4].IsNumber()) + { + deferred.Reject( + Napi::TypeError::New(env, "Invalid argument types: _gpioClaimOutput").Value()); + } + else + { + int sbc = info[0].As().Int32Value(); + int handle = info[1].As().Int32Value(); + int lFlags = info[2].As().Int32Value(); + int gpio = info[3].As().Int32Value(); + int value = info[4].As().Int32Value(); + + deferred.Resolve(Number::New(env, gpio_claim_output(sbc, handle, lFlags, gpio, value))); + } + return deferred.Promise(); +} + +// GPIO のモードを入力にする(ことを要求?) +Promise _gpioClaimInput(const CallbackInfo &info) +{ + Env env = info.Env(); + auto deferred = Napi::Promise::Deferred::New(env); + if (info.Length() != 4) + { + deferred.Reject( + TypeError::New(env, "Invalid argument count: _gpioClaimInput").Value()); + } + if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber() || !info[3].IsNumber()) + { + deferred.Reject( + Napi::TypeError::New(env, "Invalid argument types: _gpioClaimInput").Value()); + } + else + { + int sbc = info[0].As().Int32Value(); + int handle = info[1].As().Int32Value(); + int lFlags = info[2].As().Int32Value(); + int gpio = info[3].As().Int32Value(); + + deferred.Resolve(Number::New(env, gpio_claim_input(sbc, handle, lFlags, gpio))); + } + return deferred.Promise(); +} + +// GPIOの電圧を読む +Promise _gpioRead(const CallbackInfo &info) { Env env = info.Env(); auto deferred = Napi::Promise::Deferred::New(env); if (info.Length() != 3) { deferred.Reject( - TypeError::New(env, "Invalid argument count").Value()); + TypeError::New(env, "Invalid argument count: _gpioRead").Value()); } if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber()) { deferred.Reject( - Napi::TypeError::New(env, "Invalid argument types").Value()); + Napi::TypeError::New(env, "Invalid argument types: _gpioRead").Value()); } else { @@ -124,14 +179,11 @@ Promise _gpioClaimOutput(const CallbackInfo &info) int handle = info[1].As().Int32Value(); int gpio = info[2].As().Int32Value(); - deferred.Resolve(Number::New(env, gpio_claim_output(sbc, handle, 0, gpio, 0))); + deferred.Resolve(Number::New(env, gpio_read(sbc, handle, gpio))); } return deferred.Promise(); } -// GPIO のモードを入力にする(ことを要求?) -// GPIOの電圧を読む - // GPIO の電圧をセットする Promise _gpioWrite(const CallbackInfo &info) { @@ -140,12 +192,12 @@ Promise _gpioWrite(const CallbackInfo &info) if (info.Length() != 4) { deferred.Reject( - TypeError::New(env, "Invalid argument count").Value()); + TypeError::New(env, "Invalid argument count: _gpioWrite").Value()); } if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber() || !info[3].IsNumber()) { deferred.Reject( - Napi::TypeError::New(env, "Invalid argument types").Value()); + Napi::TypeError::New(env, "Invalid argument types: _gpioWrite").Value()); } else { @@ -164,12 +216,12 @@ Promise _serialOpen(const CallbackInfo &info) { Env env = info.Env(); auto deferred = Napi::Promise::Deferred::New(env); - if (info.Length() != 3) + if (info.Length() != 4) { deferred.Reject( TypeError::New(env, "Invalid argument count: _serialOpen").Value()); } - else if (!info[0].IsNumber() || !info[1].IsString() || !info[2].IsNumber()) + else if (!info[0].IsNumber() || !info[1].IsString() || !info[2].IsNumber() || !info[3].IsNumber()) { deferred.Reject( Napi::TypeError::New(env, "Invalid argument types: _serialOpen").Value()); @@ -179,7 +231,8 @@ Promise _serialOpen(const CallbackInfo &info) int sbc = info[0].As().Int32Value(); std::string ser_tty = info[1].As().Utf8Value(); int baud = info[2].As().Uint32Value(); - deferred.Resolve(Number::New(env, serial_open(sbc, (char *)ser_tty.c_str(), baud, 0))); + int ser_flags = info[3].As().Uint32Value(); + deferred.Resolve(Number::New(env, serial_open(sbc, (char *)ser_tty.c_str(), baud, ser_flags))); } return deferred.Promise(); } @@ -192,12 +245,12 @@ Promise _serialClose(const CallbackInfo &info) if (info.Length() != 2) { deferred.Reject( - TypeError::New(env, "Invalid argument count").Value()); + TypeError::New(env, "Invalid argument count: _serialClose").Value()); } else if (!info[0].IsNumber() || !info[1].IsNumber()) { deferred.Reject( - Napi::TypeError::New(env, "Invalid argument types").Value()); + Napi::TypeError::New(env, "Invalid argument types: _serialClose").Value()); } else { @@ -216,12 +269,12 @@ Promise _serialRead(const CallbackInfo &info) if (info.Length() != 3) { deferred.Reject( - TypeError::New(env, "Invalid argument count").Value()); + TypeError::New(env, "Invalid argument count: _serialRead").Value()); } else if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber()) { deferred.Reject( - Napi::TypeError::New(env, "Invalid argument types").Value()); + Napi::TypeError::New(env, "Invalid argument types: _serialRead").Value()); } else { @@ -242,49 +295,76 @@ Promise _serialWrite(const CallbackInfo &info) { Env env = info.Env(); auto deferred = Napi::Promise::Deferred::New(env); - if (info.Length() != 3) + if (info.Length() != 4) { deferred.Reject( - TypeError::New(env, "Invalid argument count").Value()); + TypeError::New(env, "Invalid argument count: _serialWrite").Value()); } - else if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsBuffer()) + else if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsBuffer() || !info[3].IsNumber()) { deferred.Reject( - Napi::TypeError::New(env, "Invalid argument types").Value()); + Napi::TypeError::New(env, "Invalid argument types: _serialWrite").Value()); } else { int sbc = info[0].As().Int32Value(); int handle = info[1].As().Uint32Value(); auto buf = info[2].As>(); + int count = info[3].As().Uint32Value(); - int count = buf.Length(); + if (count < 0) + count = buf.Length(); deferred.Resolve(Number::New(env, serial_write(sbc, handle, buf.Data(), count))); } return deferred.Promise(); } +// シリアルデバイスから読み出し可能なバイト数を返す +Promise _serialDataAvailable(const CallbackInfo &info) +{ + Env env = info.Env(); + auto deferred = Napi::Promise::Deferred::New(env); + if (info.Length() != 2) + { + deferred.Reject( + TypeError::New(env, "Invalid argument count: _serialDataAvailable").Value()); + } + else if (!info[0].IsNumber() || !info[1].IsNumber()) + { + deferred.Reject( + Napi::TypeError::New(env, "Invalid argument types: _serialDataAvailable").Value()); + } + else + { + int sbc = info[0].As().Int32Value(); + int handle = info[1].As().Uint32Value(); + deferred.Resolve(Number::New(env, serial_data_available(sbc, handle))); + } + return deferred.Promise(); +} + // I2Cバスアドレスのデバイスのハンドルを返す Promise _i2cOpen(const CallbackInfo &info) { Env env = info.Env(); auto deferred = Napi::Promise::Deferred::New(env); - if (info.Length() != 3) + if (info.Length() != 4) { deferred.Reject( - TypeError::New(env, "Invalid argument count").Value()); + TypeError::New(env, "Invalid argument count: _i2cOpen").Value()); } - else if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber()) + else if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber() || !info[3].IsNumber()) { deferred.Reject( - Napi::TypeError::New(env, "Invalid argument types").Value()); + Napi::TypeError::New(env, "Invalid argument types: _i2cOpen").Value()); } else { int sbc = info[0].As().Int32Value(); - unsigned int i2c_bus = info[1].As().Uint32Value(); - unsigned int i2c_addr = info[2].As().Uint32Value(); - deferred.Resolve(Number::New(env, i2c_open(sbc, i2c_bus, i2c_addr, 0))); + int i2c_bus = info[1].As().Uint32Value(); + int i2c_addr = info[2].As().Uint32Value(); + int i2c_flags = info[3].As().Uint32Value(); + deferred.Resolve(Number::New(env, i2c_open(sbc, i2c_bus, i2c_addr, i2c_flags))); } return deferred.Promise(); } @@ -296,17 +376,17 @@ Promise _i2cClose(const CallbackInfo &info) if (info.Length() != 2) { deferred.Reject( - TypeError::New(env, "Invalid argument count").Value()); + TypeError::New(env, "Invalid argument count: _i2cClose").Value()); } else if (!info[0].IsNumber() || !info[1].IsNumber()) { deferred.Reject( - Napi::TypeError::New(env, "Invalid argument types").Value()); + Napi::TypeError::New(env, "Invalid argument types: _i2cClose").Value()); } else { int sbc = info[0].As().Int32Value(); - unsigned int handle = info[1].As().Uint32Value(); + int handle = info[1].As().Uint32Value(); deferred.Resolve(Number::New(env, i2c_close(sbc, handle))); } return deferred.Promise(); @@ -320,18 +400,18 @@ Promise _i2cWriteByte(const CallbackInfo &info) if (info.Length() != 3) { deferred.Reject( - TypeError::New(env, "Invalid argument count").Value()); + TypeError::New(env, "Invalid argument count: _i2cWriteByte").Value()); } else if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber()) { deferred.Reject( - Napi::TypeError::New(env, "Invalid argument types").Value()); + Napi::TypeError::New(env, "Invalid argument types: _i2cWriteByte").Value()); } else { int sbc = info[0].As().Int32Value(); - unsigned int handle = info[1].As().Uint32Value(); - unsigned int bVal = info[2].As().Uint32Value(); + int handle = info[1].As().Uint32Value(); + int bVal = info[2].As().Uint32Value(); deferred.Resolve(Number::New(env, i2c_write_byte(sbc, handle, bVal))); } return deferred.Promise(); @@ -344,17 +424,17 @@ Promise _i2cReadByte(const CallbackInfo &info) if (info.Length() != 2) { deferred.Reject( - TypeError::New(env, "Invalid argument count").Value()); + TypeError::New(env, "Invalid argument count: _i2cReadByte").Value()); } else if (!info[0].IsNumber() || !info[0].IsNumber()) { deferred.Reject( - Napi::TypeError::New(env, "Invalid argument types").Value()); + Napi::TypeError::New(env, "Invalid argument types: _i2cReadByte").Value()); } else { int sbc = info[0].As().Int32Value(); - unsigned int handle = info[1].As().Uint32Value(); + int handle = info[1].As().Uint32Value(); deferred.Resolve(Number::New(env, i2c_read_byte(sbc, handle))); } return deferred.Promise(); @@ -368,19 +448,19 @@ Promise _i2cWriteByteData(const CallbackInfo &info) if (info.Length() != 4) { deferred.Reject( - TypeError::New(env, "Invalid argument count").Value()); + TypeError::New(env, "Invalid argument count: _i2cWriteByteData").Value()); } else if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber() || !info[3].IsNumber()) { deferred.Reject( - Napi::TypeError::New(env, "Invalid argument types").Value()); + Napi::TypeError::New(env, "Invalid argument types: _i2cWriteByteData").Value()); } else { int sbc = info[0].As().Int32Value(); - unsigned int handle = info[1].As().Uint32Value(); - unsigned int i2c_reg = info[2].As().Uint32Value(); - unsigned int bVal = info[3].As().Uint32Value(); + int handle = info[1].As().Uint32Value(); + int i2c_reg = info[2].As().Uint32Value(); + int bVal = info[3].As().Uint32Value(); deferred.Resolve(Number::New(env, i2c_write_byte_data(sbc, handle, i2c_reg, bVal))); } return deferred.Promise(); @@ -393,18 +473,18 @@ Promise _i2cReadByteData(const CallbackInfo &info) if (info.Length() != 3) { deferred.Reject( - TypeError::New(env, "Invalid argument count").Value()); + TypeError::New(env, "Invalid argument count: _i2cReadByteData").Value()); } else if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber()) { deferred.Reject( - Napi::TypeError::New(env, "Invalid argument types").Value()); + Napi::TypeError::New(env, "Invalid argument types: _i2cReadByteData").Value()); } else { int sbc = info[0].As().Int32Value(); - unsigned int handle = info[1].As().Uint32Value(); - unsigned int i2c_reg = info[2].As().Uint32Value(); + int handle = info[1].As().Uint32Value(); + int i2c_reg = info[2].As().Uint32Value(); deferred.Resolve(Number::New(env, i2c_read_byte_data(sbc, handle, i2c_reg))); } return deferred.Promise(); @@ -418,21 +498,21 @@ Promise _i2cReadI2cBlockData(const CallbackInfo &info) if (info.Length() != 4) { deferred.Reject( - TypeError::New(env, "Invalid argument count").Value()); + TypeError::New(env, "Invalid argument count: _i2cReadI2cBlockData").Value()); } else if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber() || !info[3].IsNumber()) { deferred.Reject( - Napi::TypeError::New(env, "Invalid argument types").Value()); + Napi::TypeError::New(env, "Invalid argument types: _i2cReadI2cBlockData").Value()); } else { int sbc = info[0].As().Int32Value(); - unsigned int handle = info[1].As().Uint32Value(); - unsigned int i2cReg = info[2].As().Uint32Value(); - unsigned int count = info[3].As().Uint32Value(); + int handle = info[1].As().Uint32Value(); + int i2c_reg = info[2].As().Uint32Value(); + int count = info[3].As().Uint32Value(); char buf[count]; - int rxCount = i2c_read_i2c_block_data(sbc, handle, i2cReg, buf, count); + int rxCount = i2c_read_i2c_block_data(sbc, handle, i2c_reg, buf, count); auto outBuf = Buffer::Copy(env, buf, rxCount); deferred.Resolve(outBuf); } @@ -444,24 +524,26 @@ Promise _i2cWriteI2cBlockData(const CallbackInfo &info) { Env env = info.Env(); auto deferred = Napi::Promise::Deferred::New(env); - if (info.Length() != 4) + if (info.Length() != 5) { deferred.Reject( - TypeError::New(env, "Invalid argument count").Value()); + TypeError::New(env, "Invalid argument count: _i2cWriteI2cBlockData").Value()); } - else if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber() || !info[3].IsBuffer()) + else if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber() || !info[3].IsBuffer() || !info[4].IsNumber()) { deferred.Reject( - Napi::TypeError::New(env, "Invalid argument types").Value()); + Napi::TypeError::New(env, "Invalid argument types: _i2cWriteI2cBlockData").Value()); } else { int sbc = info[0].As().Int32Value(); - unsigned int handle = info[1].As().Uint32Value(); - unsigned int i2c_reg = info[2].As().Uint32Value(); + int handle = info[1].As().Uint32Value(); + int i2c_reg = info[2].As().Uint32Value(); auto buf = info[3].As>(); + int count = info[4].As().Uint32Value(); - unsigned int count = buf.Length(); + if (count < 0) + count = buf.Length(); deferred.Resolve(Number::New(env, i2c_write_i2c_block_data(sbc, handle, i2c_reg, buf.Data(), count))); } return deferred.Promise(); @@ -475,18 +557,18 @@ Promise _i2cReadWordData(const CallbackInfo &info) if (info.Length() != 3) { deferred.Reject( - TypeError::New(env, "Invalid argument count").Value()); + TypeError::New(env, "Invalid argument count: _i2cReadWordData").Value()); } else if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber()) { deferred.Reject( - Napi::TypeError::New(env, "Invalid argument types").Value()); + Napi::TypeError::New(env, "Invalid argument types: _i2cReadWordData").Value()); } else { int sbc = info[0].As().Int32Value(); - unsigned int handle = info[1].As().Uint32Value(); - unsigned int i2c_reg = info[2].As().Uint32Value(); + int handle = info[1].As().Uint32Value(); + int i2c_reg = info[2].As().Uint32Value(); deferred.Resolve(Number::New(env, i2c_read_word_data(sbc, handle, i2c_reg))); } return deferred.Promise(); @@ -499,19 +581,19 @@ Promise _i2cWriteWordData(const CallbackInfo &info) if (info.Length() != 4) { deferred.Reject( - TypeError::New(env, "Invalid argument count").Value()); + TypeError::New(env, "Invalid argument count: _i2cWriteWordData").Value()); } else if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber() || !info[3].IsNumber()) { deferred.Reject( - Napi::TypeError::New(env, "Invalid argument types").Value()); + Napi::TypeError::New(env, "Invalid argument types: _i2cWriteWordData").Value()); } else { int sbc = info[0].As().Int32Value(); - unsigned int handle = info[1].As().Uint32Value(); - unsigned int i2c_reg = info[2].As().Uint32Value(); - unsigned int wVal = info[3].As().Uint32Value(); + int handle = info[1].As().Uint32Value(); + int i2c_reg = info[2].As().Uint32Value(); + int wVal = info[3].As().Uint32Value(); deferred.Resolve(Number::New(env, i2c_write_word_data(sbc, handle, i2c_reg, wVal))); } @@ -526,18 +608,18 @@ Promise _i2cReadDevice(const CallbackInfo &info) if (info.Length() != 3) { deferred.Reject( - TypeError::New(env, "Invalid argument count").Value()); + TypeError::New(env, "Invalid argument count: _i2cReadDevice").Value()); } else if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsNumber()) { deferred.Reject( - Napi::TypeError::New(env, "Invalid argument types").Value()); + Napi::TypeError::New(env, "Invalid argument types: _i2cReadDevice").Value()); } else { int sbc = info[0].As().Int32Value(); - unsigned int handle = info[1].As().Uint32Value(); - unsigned int count = info[2].As().Uint32Value(); + int handle = info[1].As().Uint32Value(); + int count = info[2].As().Uint32Value(); char buf[count]; int rxCount = i2c_read_device(sbc, handle, buf, count); @@ -552,23 +634,25 @@ Promise _i2cWriteDevice(const CallbackInfo &info) { Env env = info.Env(); auto deferred = Napi::Promise::Deferred::New(env); - if (info.Length() != 3) + if (info.Length() != 4) { deferred.Reject( - TypeError::New(env, "Invalid argument count").Value()); + TypeError::New(env, "Invalid argument count: _i2cWriteDevice").Value()); } - else if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsBuffer()) + else if (!info[0].IsNumber() || !info[1].IsNumber() || !info[2].IsBuffer() || !info[3].IsNumber()) { deferred.Reject( - Napi::TypeError::New(env, "Invalid argument types").Value()); + Napi::TypeError::New(env, "Invalid argument types: _i2cWriteDevice").Value()); } else { int sbc = info[0].As().Int32Value(); - unsigned int handle = info[1].As().Uint32Value(); + int handle = info[1].As().Uint32Value(); auto buf = info[2].As>(); + int count = info[3].As().Uint32Value(); - unsigned int count = buf.Length(); + if (count < 0) + int count = buf.Length(); deferred.Resolve(Number::New(env, i2c_write_device(sbc, handle, buf.Data(), count))); } return deferred.Promise(); @@ -577,16 +661,19 @@ Promise _i2cWriteDevice(const CallbackInfo &info) Object Init(Env env, Object exports) { - exports.Set(String::New(env, "_gpiod_start"), Function::New(env, _rgpiodStart)); - exports.Set(String::New(env, "_gpiod_stop"), Function::New(env, _rgpiodStop)); + exports.Set(String::New(env, "_rgpiod_start"), Function::New(env, _rgpiodStart)); + exports.Set(String::New(env, "_rgpiod_stop"), Function::New(env, _rgpiodStop)); exports.Set(String::New(env, "_gpiochip_open"), Function::New(env, _gpiochipOpen)); exports.Set(String::New(env, "_gpiochip_close"), Function::New(env, _gpiochipClose)); + exports.Set(String::New(env, "_gpio_claim_input"), Function::New(env, _gpioClaimInput)); exports.Set(String::New(env, "_gpio_claim_output"), Function::New(env, _gpioClaimOutput)); + exports.Set(String::New(env, "_gpio_read"), Function::New(env, _gpioRead)); exports.Set(String::New(env, "_gpio_write"), Function::New(env, _gpioWrite)); exports.Set(String::New(env, "_serial_open"), Function::New(env, _serialOpen)); exports.Set(String::New(env, "_serial_close"), Function::New(env, _serialClose)); exports.Set(String::New(env, "_serial_read"), Function::New(env, _serialRead)); exports.Set(String::New(env, "_serial_write"), Function::New(env, _serialWrite)); + exports.Set(String::New(env, "_serial_data_available"), Function::New(env, _serialDataAvailable)); exports.Set(String::New(env, "_i2c_open"), Function::New(env, _i2cOpen)); exports.Set(String::New(env, "_i2c_close"), Function::New(env, _i2cClose)); exports.Set(String::New(env, "_i2c_write_byte"), Function::New(env, _i2cWriteByte)); diff --git a/main.js b/main.js index 8bdbfd5..41f423b 100644 --- a/main.js +++ b/main.js @@ -172,7 +172,7 @@ let template = [ } }, { - label: "MicroPython (Test phase)", + label: "MicroPython (RP2)", id: "py", type: 'checkbox', click: (item, focusedWindow) => { diff --git a/package-lock.json b/package-lock.json index c78935c..fd788f3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,34 +9,34 @@ "version": "0.1.11", "license": "ISC", "dependencies": { - "@blockly/field-slider": "^4.0.16", + "@blockly/field-slider": "^4.0.18", "@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.5.0", + "@tensorflow/tfjs-node": "^4.8.0", "axios": "^1.4.0", "blockly": "^9.3.3", "dracula-prism": "^2.1.13", - "js-beautify": "^1.14.7", - "node-abi": "^3.40.0", - "nodemailer": "^6.9.2", + "js-beautify": "^1.14.8", + "node-abi": "^3.45.0", + "nodemailer": "^6.9.3", "prismjs": "^1.29.0" }, "devDependencies": { - "@electron-forge/cli": "^6.1.1", - "@electron-forge/maker-deb": "^6.1.1", + "@electron-forge/cli": "^6.2.1", + "@electron-forge/maker-deb": "^6.2.1", "@electron/rebuild": "^3.2.13", - "electron": "^24.3.0" + "electron": "^25.2.0" }, "optionalDependencies": { "rgpio": "file:local_modules/rgpio" } }, "node_modules/@blockly/field-slider": { - "version": "4.0.16", - "resolved": "https://registry.npmjs.org/@blockly/field-slider/-/field-slider-4.0.16.tgz", - "integrity": "sha512-B1n48CsJdnVBHquYwGijbJizSwDqIN6N6LgI4wCeEt0i2gTSkbOb5qdMkE4znf3Fkv0cEhKghURuteJJHcj6Zg==", + "version": "4.0.18", + "resolved": "https://registry.npmjs.org/@blockly/field-slider/-/field-slider-4.0.18.tgz", + "integrity": "sha512-5E2fEczzzBd9Y8H79rRR8bV3vWDyB/cp8Ni3/pMcPerxGych1oCKWEYInZGItsAxAx8fw2Ufi7R/FwOixkrvXw==", "engines": { "node": ">=8.0.0" }, @@ -45,9 +45,9 @@ } }, "node_modules/@electron-forge/cli": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@electron-forge/cli/-/cli-6.1.1.tgz", - "integrity": "sha512-ufD9wKh35Mynj5MEKcWQKLpuIgxPvehwvykHRULi2ev8MWLCqxN4wda1Wy/cj57Uaeokf2rTbcGHGqbBX60bFQ==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@electron-forge/cli/-/cli-6.2.1.tgz", + "integrity": "sha512-AyCJ1m7LBgttgUTS3kDwiBLhPHJ+6mFwoMSqu847EJ4Fe1DJ1Hi6gnMsSga7Mv4KsF7iA23Ss1fo+3TGZnvrWw==", "dev": true, "funding": [ { @@ -60,8 +60,8 @@ } ], "dependencies": { - "@electron-forge/core": "6.1.1", - "@electron-forge/shared-types": "6.1.1", + "@electron-forge/core": "6.2.1", + "@electron-forge/shared-types": "6.2.1", "@electron/get": "^2.0.0", "chalk": "^4.0.0", "commander": "^4.1.1", @@ -80,9 +80,9 @@ } }, "node_modules/@electron-forge/core": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@electron-forge/core/-/core-6.1.1.tgz", - "integrity": "sha512-Fh1rNY1eI2wqbFXJ8eRBsJDS6gxfElgVR4nhMY+I+MZs9ddw1MFHIWwoqYjGFJKUBd9xTXCk5lkf8TwCpb4Igg==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@electron-forge/core/-/core-6.2.1.tgz", + "integrity": "sha512-udjU8r9dzuV/dPMPxONmkWYoqM0uY6ezpdjTLgO9aNdWTbBeBLIOMVT0jdx7GBoTuPu6ul/VhDEFNUaojEOrVA==", "dev": true, "funding": [ { @@ -95,15 +95,15 @@ } ], "dependencies": { - "@electron-forge/core-utils": "6.1.1", - "@electron-forge/maker-base": "6.1.1", - "@electron-forge/plugin-base": "6.1.1", - "@electron-forge/publisher-base": "6.1.1", - "@electron-forge/shared-types": "6.1.1", - "@electron-forge/template-base": "6.1.1", - "@electron-forge/template-vite": "6.1.1", - "@electron-forge/template-webpack": "6.1.1", - "@electron-forge/template-webpack-typescript": "6.1.1", + "@electron-forge/core-utils": "6.2.1", + "@electron-forge/maker-base": "6.2.1", + "@electron-forge/plugin-base": "6.2.1", + "@electron-forge/publisher-base": "6.2.1", + "@electron-forge/shared-types": "6.2.1", + "@electron-forge/template-base": "6.2.1", + "@electron-forge/template-vite": "6.2.1", + "@electron-forge/template-webpack": "6.2.1", + "@electron-forge/template-webpack-typescript": "6.2.1", "@electron/get": "^2.0.0", "@electron/rebuild": "^3.2.10", "@malept/cross-spawn-promise": "^2.0.0", @@ -134,12 +134,12 @@ } }, "node_modules/@electron-forge/core-utils": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@electron-forge/core-utils/-/core-utils-6.1.1.tgz", - "integrity": "sha512-7Kt0o85UEzpYjWU2WQ3pVuSOnRIDfuFimCQ1bh9qym5NLrkDcIQx9sIsCFIFkWYkUY7oIuMIMOhrGA4tyWGl2w==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@electron-forge/core-utils/-/core-utils-6.2.1.tgz", + "integrity": "sha512-mJUpy8mZ7/l1BddReFrNZyM5iNEuYwjpeIqZ2E0E/hQPH26QreAV3rPfTj7WhA3V69ftmn++QRt82pNZFhHVEg==", "dev": true, "dependencies": { - "@electron-forge/shared-types": "6.1.1", + "@electron-forge/shared-types": "6.2.1", "@electron/rebuild": "^3.2.10", "@malept/cross-spawn-promise": "^2.0.0", "chalk": "^4.0.0", @@ -155,12 +155,12 @@ } }, "node_modules/@electron-forge/maker-base": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@electron-forge/maker-base/-/maker-base-6.1.1.tgz", - "integrity": "sha512-qEW8vuSq6/r1rKh7JENK9yGmueymMzbm817GDk5usHia5o7otHYY4JMkdzZaKww56Ed/Ege2ch6LEYqYGTfl/Q==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@electron-forge/maker-base/-/maker-base-6.2.1.tgz", + "integrity": "sha512-LnvGtTJ/RNojKdUKktYEcbLqPggXdMBs1uscQRgXkI3XnVGdEi+/j5+Eg5ka4d6FnsaUkz//U5yhPtNFhDbNSw==", "dev": true, "dependencies": { - "@electron-forge/shared-types": "6.1.1", + "@electron-forge/shared-types": "6.2.1", "fs-extra": "^10.0.0", "which": "^2.0.2" }, @@ -169,13 +169,13 @@ } }, "node_modules/@electron-forge/maker-deb": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@electron-forge/maker-deb/-/maker-deb-6.1.1.tgz", - "integrity": "sha512-Qk/QMBwWP/D6Fx7+VU54xHec47R9CYg0TCaRtQ1KeBNFdJ3DpwCARr966/IJqEUxX7y8vv8Awc8HvKDPxbpIUA==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@electron-forge/maker-deb/-/maker-deb-6.2.1.tgz", + "integrity": "sha512-y4WeBCGOeu1z5yBHPigzYcVPZAwbaJB60wXZ1VQpuKM5n09nONTq2TFhoJDHys3t9aHsBaX7G6Drv0XPUWQExQ==", "dev": true, "dependencies": { - "@electron-forge/maker-base": "6.1.1", - "@electron-forge/shared-types": "6.1.1" + "@electron-forge/maker-base": "6.2.1", + "@electron-forge/shared-types": "6.2.1" }, "engines": { "node": ">= 14.17.5" @@ -185,33 +185,33 @@ } }, "node_modules/@electron-forge/plugin-base": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@electron-forge/plugin-base/-/plugin-base-6.1.1.tgz", - "integrity": "sha512-xZWZxvD2fQYnkFREK+46FS59vMEsPFINwydtD24QGTBoRMOKXkfXv16yN4eexVi+02Hj6mihYY8zhxJi56OmxA==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@electron-forge/plugin-base/-/plugin-base-6.2.1.tgz", + "integrity": "sha512-8mVbFgTlxQKDZ7jzeHyWrzOSiv/DpE29flPLgpyeFuz/zbC7oLNdxBCYo7WptQgI+HArphqehKUBf1UOkXmRPg==", "dev": true, "dependencies": { - "@electron-forge/shared-types": "6.1.1" + "@electron-forge/shared-types": "6.2.1" }, "engines": { "node": ">= 14.17.5" } }, "node_modules/@electron-forge/publisher-base": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@electron-forge/publisher-base/-/publisher-base-6.1.1.tgz", - "integrity": "sha512-vxGzx2G7bWhz2G091MzNh+LHGrOM4gmp8FqW2VNpFJfFEYODr6D9KxitUihKAWc79bwG+YywvISXEMy5IBQu0Q==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@electron-forge/publisher-base/-/publisher-base-6.2.1.tgz", + "integrity": "sha512-clrrEPsamoe4543smfyZUBp2IRSZ4EEhdj/bm0zmODS2qs/V1cCEf7y8P29huxMskT5bXDxSzothG72or3b2WQ==", "dev": true, "dependencies": { - "@electron-forge/shared-types": "6.1.1" + "@electron-forge/shared-types": "6.2.1" }, "engines": { "node": ">= 14.17.5" } }, "node_modules/@electron-forge/shared-types": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@electron-forge/shared-types/-/shared-types-6.1.1.tgz", - "integrity": "sha512-sFQQ2ldMq5mlNv4m7lZOZLf9aOn6MLNc8QVeTzOBQ+psxI3mVTDjb+/Lhs/jU8dm2igVfEqAmlj57Gi+C4u4Vw==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@electron-forge/shared-types/-/shared-types-6.2.1.tgz", + "integrity": "sha512-kLazG5XUAqb3Duyhq7XyGluINRwCQRaIiuvHwlvnZYYu6NZQTz9xUm6tQ9v05EtFblUx2iRjY67DJRZSt3dzTQ==", "dev": true, "dependencies": { "@electron/rebuild": "^3.2.10", @@ -223,12 +223,12 @@ } }, "node_modules/@electron-forge/template-base": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@electron-forge/template-base/-/template-base-6.1.1.tgz", - "integrity": "sha512-i4EZHXIFTo+nJXJHPS1k9PAnWKEKGC4kMUvIsyYKEu+NrOTcGLMT4FIRM9VYe1nGarQLd486/274S3b2SaCUuw==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@electron-forge/template-base/-/template-base-6.2.1.tgz", + "integrity": "sha512-hSMaefJRptpszPsZLvEfHV22KO6/XK0kJ6Lota1x3xQEFQs4IpCwUv446JE5hde+5Fukw5vZawbK2m937Te24Q==", "dev": true, "dependencies": { - "@electron-forge/shared-types": "6.1.1", + "@electron-forge/shared-types": "6.2.1", "@malept/cross-spawn-promise": "^2.0.0", "debug": "^4.3.1", "fs-extra": "^10.0.0", @@ -239,13 +239,13 @@ } }, "node_modules/@electron-forge/template-vite": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@electron-forge/template-vite/-/template-vite-6.1.1.tgz", - "integrity": "sha512-/6Sv7trkfjJR9LI7i83xmddVhi32pDlDE2kwlCkRgcoE2jGoW0fJU1BNfjNWy61Rd1wNzgrpfjMTPQlMnwHb4g==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@electron-forge/template-vite/-/template-vite-6.2.1.tgz", + "integrity": "sha512-t05p8ZWtkixjuUFJpaupq2t+ap8vjPjULO2knKC12TqWTxo53M8lKwx0f7h0zvgyqWdtEGQr8KiVfeFS0Lh3jA==", "dev": true, "dependencies": { - "@electron-forge/shared-types": "6.1.1", - "@electron-forge/template-base": "6.1.1", + "@electron-forge/shared-types": "6.2.1", + "@electron-forge/template-base": "6.2.1", "fs-extra": "^10.0.0" }, "engines": { @@ -253,13 +253,13 @@ } }, "node_modules/@electron-forge/template-webpack": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@electron-forge/template-webpack/-/template-webpack-6.1.1.tgz", - "integrity": "sha512-M3hTEF3iV6VYufassMilautoOYTLbqD06U1u3B6MDZVn74xAzprIZ+5EgrvQR33N+E3PyDpkgyMh+FJtWCo0/A==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@electron-forge/template-webpack/-/template-webpack-6.2.1.tgz", + "integrity": "sha512-u2/Cm6HjCah07larN1npHDG1dhDZMyqdDnPDh0iQNv+BEV6kCMSHX/8R9Uc7uIpkRVj+uCfcYBnkoKHKbUgKcQ==", "dev": true, "dependencies": { - "@electron-forge/shared-types": "6.1.1", - "@electron-forge/template-base": "6.1.1", + "@electron-forge/shared-types": "6.2.1", + "@electron-forge/template-base": "6.2.1", "fs-extra": "^10.0.0" }, "engines": { @@ -267,13 +267,13 @@ } }, "node_modules/@electron-forge/template-webpack-typescript": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@electron-forge/template-webpack-typescript/-/template-webpack-typescript-6.1.1.tgz", - "integrity": "sha512-Ck7EgqoqfUL4r4NCioTsQT1/EFNCUqnsNd71MboU1RUvRbcrqpYvkoKk99+9QvxBrljMQp935gTieY7HADWQ9A==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@electron-forge/template-webpack-typescript/-/template-webpack-typescript-6.2.1.tgz", + "integrity": "sha512-8dXu54OsvfeBVGFyHfzVaBlxH+dPFxgLKu+/gsip82OEmLghXWyfvwhpXBw3rhxqG8V2/nbxDYUghSJackWZYA==", "dev": true, "dependencies": { - "@electron-forge/shared-types": "6.1.1", - "@electron-forge/template-base": "6.1.1", + "@electron-forge/shared-types": "6.2.1", + "@electron-forge/template-base": "6.2.1", "fs-extra": "^10.0.0" }, "engines": { @@ -281,9 +281,9 @@ } }, "node_modules/@electron/asar": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/@electron/asar/-/asar-3.2.3.tgz", - "integrity": "sha512-wmOfE6szYyqZhRIiLH+eyZEp+bGcJI0OD/SCvSUrfBE0jvauyGYO2ZhpWxmNCcDojKu5DYrsVqT5BOCZZ01XIg==", + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@electron/asar/-/asar-3.2.4.tgz", + "integrity": "sha512-lykfY3TJRRWFeTxccEKdf1I6BLl2Plw81H0bbp4Fc5iEc67foDCa5pjJQULVgo0wF+Dli75f3xVcdb/67FFZ/g==", "dev": true, "dependencies": { "chromium-pickle-js": "^0.2.0", @@ -296,9 +296,6 @@ }, "engines": { "node": ">=10.12.0" - }, - "optionalDependencies": { - "@types/glob": "^7.1.1" } }, "node_modules/@electron/asar/node_modules/commander": { @@ -373,9 +370,9 @@ } }, "node_modules/@electron/notarize": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@electron/notarize/-/notarize-1.2.3.tgz", - "integrity": "sha512-9oRzT56rKh5bspk3KpAVF8lPKHYQrBnRwcgiOeR0hdilVEQmszDaAu0IPCPrwwzJN0ugNs0rRboTreHMt/6mBQ==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@electron/notarize/-/notarize-1.2.4.tgz", + "integrity": "sha512-W5GQhJEosFNafewnS28d3bpQ37/s91CDWqxVchHfmv2dQSTWpOzNlUVQwYzC1ay5bChRV/A9BTL68yj0Pa+TSg==", "dev": true, "dependencies": { "debug": "^4.1.1", @@ -726,16 +723,16 @@ } }, "node_modules/@tensorflow/tfjs": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs/-/tfjs-4.5.0.tgz", - "integrity": "sha512-GMpFI9GgotUSQKpce500yyBujYY8sWagG0gCpnjTSVzWrYRS8bsL+6Fq/GCamiCX5jtOrlpZ/kRkz/HIqaYXWg==", + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs/-/tfjs-4.8.0.tgz", + "integrity": "sha512-aKyYPFk5/aABtz+ETzvow8QBQxq0QgBCf3yQ7I33JkNbrIjlmEJmcfwbbbpLs5bg0BiOcNn2gYGbZHZ4AZuMQQ==", "dependencies": { - "@tensorflow/tfjs-backend-cpu": "4.5.0", - "@tensorflow/tfjs-backend-webgl": "4.5.0", - "@tensorflow/tfjs-converter": "4.5.0", - "@tensorflow/tfjs-core": "4.5.0", - "@tensorflow/tfjs-data": "4.5.0", - "@tensorflow/tfjs-layers": "4.5.0", + "@tensorflow/tfjs-backend-cpu": "4.8.0", + "@tensorflow/tfjs-backend-webgl": "4.8.0", + "@tensorflow/tfjs-converter": "4.8.0", + "@tensorflow/tfjs-core": "4.8.0", + "@tensorflow/tfjs-data": "4.8.0", + "@tensorflow/tfjs-layers": "4.8.0", "argparse": "^1.0.10", "chalk": "^4.1.0", "core-js": "3.29.1", @@ -747,9 +744,9 @@ } }, "node_modules/@tensorflow/tfjs-backend-cpu": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-cpu/-/tfjs-backend-cpu-4.5.0.tgz", - "integrity": "sha512-TO6tkGeqR0UhifEx2SBa15kv8UlpubCHPGFHAnAfiPqBe3Z+3D7zqMlw2RvOelrzxzCWpTQByppFkB5u1pfiiA==", + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-cpu/-/tfjs-backend-cpu-4.8.0.tgz", + "integrity": "sha512-kT4WZeM4cuuZ+dSCMatrC9YiqV4dxpFzjxKOKwdS41gdg5QKQGW7caScCe55thO/Xpp7VOJXncDYeaMH7GcxCA==", "dependencies": { "@types/seedrandom": "^2.4.28", "seedrandom": "^3.0.5" @@ -758,15 +755,15 @@ "yarn": ">= 1.3.2" }, "peerDependencies": { - "@tensorflow/tfjs-core": "4.5.0" + "@tensorflow/tfjs-core": "4.8.0" } }, "node_modules/@tensorflow/tfjs-backend-webgl": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-webgl/-/tfjs-backend-webgl-4.5.0.tgz", - "integrity": "sha512-xBgb3GW9wPbKRKeL8k0hxhyZv21uPnZ1eEXgwnpfgu86rXajToA7ATklh7bCpOlrQDY/n7ixBA8PwvsQEt2Jcw==", + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-webgl/-/tfjs-backend-webgl-4.8.0.tgz", + "integrity": "sha512-iAJzQbndBtarV+OWk9Ukur5U0Xk/4t7j7O5WhPQO/q9yuRyWjAT6MPaCEW/+Ew4XC8yJGuvlfL0Oqi1X0drvfA==", "dependencies": { - "@tensorflow/tfjs-backend-cpu": "4.5.0", + "@tensorflow/tfjs-backend-cpu": "4.8.0", "@types/offscreencanvas": "~2019.3.0", "@types/seedrandom": "^2.4.28", "@types/webgl-ext": "0.0.30", @@ -776,21 +773,21 @@ "yarn": ">= 1.3.2" }, "peerDependencies": { - "@tensorflow/tfjs-core": "4.5.0" + "@tensorflow/tfjs-core": "4.8.0" } }, "node_modules/@tensorflow/tfjs-converter": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-converter/-/tfjs-converter-4.5.0.tgz", - "integrity": "sha512-gd2DiLPX1YStXk4mkgqzbQuOoiwcuSv4s7tTyYvFEX5Ty9SKmttYmannCCppzmliL6aTzyxTpIZyWnqTPuTxeg==", + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-converter/-/tfjs-converter-4.8.0.tgz", + "integrity": "sha512-tBYsCdhdFNlFFn4FO49gr1yLX4h8xDxpoFI70lFECxDu9UfwaHNVuBLcocMx4XIFqQx12h6/Y3pD93HFvoum3A==", "peerDependencies": { - "@tensorflow/tfjs-core": "4.5.0" + "@tensorflow/tfjs-core": "4.8.0" } }, "node_modules/@tensorflow/tfjs-core": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-core/-/tfjs-core-4.5.0.tgz", - "integrity": "sha512-FrHUnab/5msyzIg7zcjBmMV8W9vf2lj+f4em0zL+ntAczkEBeMAEIykk9BmV7sqMplRiCu2Cfrks8EqHFutSqw==", + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-core/-/tfjs-core-4.8.0.tgz", + "integrity": "sha512-EkgGOAsPQSlpEdiG938c92pdC5i8GHeBVk6xO1AKKX8NiMSIruKtKqIQvX2aOkarwHy/5nhrJebAAvIL4dJlbw==", "dependencies": { "@types/long": "^4.0.1", "@types/offscreencanvas": "~2019.7.0", @@ -811,35 +808,35 @@ "integrity": "sha512-PGcyveRIpL1XIqK8eBsmRBt76eFgtzuPiSTyKHZxnGemp2yzGzWpjYKAfK3wIMiU7eH+851yEpiuP8JZerTmWg==" }, "node_modules/@tensorflow/tfjs-data": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-data/-/tfjs-data-4.5.0.tgz", - "integrity": "sha512-fqTS5K+TrdisyDOOjcKwYQtoGyk9GzYhxwof1X9kpdm2zxpwl0kzeSqqCuVMPGD5DAOKp+EccTWYfAC4MIafcw==", + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-data/-/tfjs-data-4.8.0.tgz", + "integrity": "sha512-eISTI7Rs51nR9EjyMq/E+mk9JpOIvBqfxT52IEJr2DxqY7TUZ0PlN77Ng/huEL+5I9M+GoVTXe+GFHCmq/5VhQ==", "dependencies": { "@types/node-fetch": "^2.1.2", "node-fetch": "~2.6.1", "string_decoder": "^1.3.0" }, "peerDependencies": { - "@tensorflow/tfjs-core": "4.5.0", + "@tensorflow/tfjs-core": "4.8.0", "seedrandom": "^3.0.5" } }, "node_modules/@tensorflow/tfjs-layers": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-layers/-/tfjs-layers-4.5.0.tgz", - "integrity": "sha512-/Ohzc39SiIszQqOjEb+4DzGyJkdCweGP4uoblUzQQZdolJB/NxsAHJ06YUj0mD5dflTwNVCwYAe3rkdYqNlgvg==", + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-layers/-/tfjs-layers-4.8.0.tgz", + "integrity": "sha512-jJJvyPxwztP4QMyjUXjyrV6ErWmw4zjub4QidijD8SpY6aVE31xVYqBzIqATa4LjF1ozYwqQoSEvKh4BVFexnA==", "peerDependencies": { - "@tensorflow/tfjs-core": "4.5.0" + "@tensorflow/tfjs-core": "4.8.0" } }, "node_modules/@tensorflow/tfjs-node": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-node/-/tfjs-node-4.5.0.tgz", - "integrity": "sha512-KX1Vl9G6kqOvt9WIQhb54S3H9qx8K+rMaOoyy2LMytcUU5hbcOi8ElGju4BGM4xSCrYFtJI3hBsl+Xfgd2hAKg==", + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-node/-/tfjs-node-4.8.0.tgz", + "integrity": "sha512-GNqqCUR15brznpI6Z2JAYxTTJCvuY40/r1oBSWyrpm4wHG4oaEsOpQBhXdLBYi3awhSJr9Bu2alYzPWFe5lV0g==", "hasInstallScript": true, "dependencies": { "@mapbox/node-pre-gyp": "1.0.9", - "@tensorflow/tfjs": "4.5.0", + "@tensorflow/tfjs": "4.8.0", "adm-zip": "^0.5.2", "google-protobuf": "^3.9.2", "https-proxy-agent": "^2.2.1", @@ -1023,9 +1020,9 @@ "integrity": "sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q==" }, "node_modules/@types/node-fetch": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.3.tgz", - "integrity": "sha512-ETTL1mOEdq/sxUtgtOhKjyB2Irra4cjxksvcMUR5Zr4n+PxVhsCD9WS46oPbHL3et9Zde7CNRr+WUNlcHvsX+w==", + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.4.tgz", + "integrity": "sha512-1ZX9fcN4Rvkvgv4E6PAY5WXUFWFcRWxZa3EW83UjycOB9ljJCedb2CupIP4RZMEwF/M3eTcCihbBRgwtGbg5Rg==", "dependencies": { "@types/node": "*", "form-data": "^3.0.0" @@ -2096,9 +2093,9 @@ "integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==" }, "node_modules/electron": { - "version": "24.3.0", - "resolved": "https://registry.npmjs.org/electron/-/electron-24.3.0.tgz", - "integrity": "sha512-M7PpfpOzGdLeZPr2xhxXuvJeoXPEHMH40Rtv8BCGleRPolwna9BepAGc0H0F+Uz5kGKOv3xcm99fTurvXUH0nw==", + "version": "25.2.0", + "resolved": "https://registry.npmjs.org/electron/-/electron-25.2.0.tgz", + "integrity": "sha512-I/rhcW2sV2fyiveVSBr2N7v5ZiCtdGY0UiNCDZgk2fpSC+irQjbeh7JT2b4vWmJ2ogOXBjqesrN9XszTIG6DHg==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -3288,9 +3285,9 @@ } }, "node_modules/http-cache-semantics": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", - "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", + "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==", "dev": true }, "node_modules/http-proxy-agent": { @@ -3455,9 +3452,9 @@ "dev": true }, "node_modules/is-core-module": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", - "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz", + "integrity": "sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==", "dev": true, "dependencies": { "has": "^1.0.3" @@ -3600,13 +3597,13 @@ "dev": true }, "node_modules/js-beautify": { - "version": "1.14.7", - "resolved": "https://registry.npmjs.org/js-beautify/-/js-beautify-1.14.7.tgz", - "integrity": "sha512-5SOX1KXPFKx+5f6ZrPsIPEY7NwKeQz47n3jm2i+XeHx9MoRsfQenlOP13FQhWvg8JRS0+XLO6XYUQ2GX+q+T9A==", + "version": "1.14.8", + "resolved": "https://registry.npmjs.org/js-beautify/-/js-beautify-1.14.8.tgz", + "integrity": "sha512-4S7HFeI9YfRvRgKnEweohs0tgJj28InHVIj4Nl8Htf96Y6pHg3+tJrmo4ucAM9f7l4SHbFI3IvFAZ2a1eQPbyg==", "dependencies": { "config-chain": "^1.1.13", "editorconfig": "^0.15.3", - "glob": "^8.0.3", + "glob": "^8.1.0", "nopt": "^6.0.0" }, "bin": { @@ -3615,7 +3612,7 @@ "js-beautify": "js/bin/js-beautify.js" }, "engines": { - "node": ">=10" + "node": ">=12" } }, "node_modules/js-beautify/node_modules/brace-expansion": { @@ -3627,9 +3624,9 @@ } }, "node_modules/js-beautify/node_modules/glob": { - "version": "8.0.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz", - "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -3645,9 +3642,9 @@ } }, "node_modules/js-beautify/node_modules/minimatch": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.2.tgz", - "integrity": "sha512-bNH9mmM9qsJ2X4r2Nat1B//1dJVcn3+iBLa3IgqJ7EbGaDNepL9QSHOxN4ng33s52VMMhhIfgCYDk3C4ZmlDAg==", + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", "dependencies": { "brace-expansion": "^2.0.1" }, @@ -4272,9 +4269,9 @@ "dev": true }, "node_modules/node-abi": { - "version": "3.40.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.40.0.tgz", - "integrity": "sha512-zNy02qivjjRosswoYmPi8hIKJRr8MpQyeKT6qlcq/OnOgA3Rhoae+IYOqsM9V5+JnHWmxKnWOT2GxvtqdtOCXA==", + "version": "3.45.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.45.0.tgz", + "integrity": "sha512-iwXuFrMAcFVi/ZoZiqq8BzAdsLw9kxDfTC0HMyjXfSL/6CSDAGD5UmR7azrAgWV1zKYq7dUUMj4owusBWKLsiQ==", "dependencies": { "semver": "^7.3.5" }, @@ -4437,9 +4434,9 @@ } }, "node_modules/nodemailer": { - "version": "6.9.2", - "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.2.tgz", - "integrity": "sha512-4+TYaa/e1nIxQfyw/WzNPYTEZ5OvHIDEnmjs4LPmIfccPQN+2CYKmGHjWixn/chzD3bmUTu5FMfpltizMxqzdg==", + "version": "6.9.3", + "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.3.tgz", + "integrity": "sha512-fy9v3NgTzBngrMFkDsKEj0r02U7jm6XfC3b52eoNV+GCrGj+s8pt5OqhiJdWKuw51zCTdiNR/IUD1z33LIIGpg==", "engines": { "node": ">=6.0.0" } @@ -6286,18 +6283,18 @@ }, "dependencies": { "@blockly/field-slider": { - "version": "4.0.16", - "resolved": "https://registry.npmjs.org/@blockly/field-slider/-/field-slider-4.0.16.tgz", - "integrity": "sha512-B1n48CsJdnVBHquYwGijbJizSwDqIN6N6LgI4wCeEt0i2gTSkbOb5qdMkE4znf3Fkv0cEhKghURuteJJHcj6Zg==" + "version": "4.0.18", + "resolved": "https://registry.npmjs.org/@blockly/field-slider/-/field-slider-4.0.18.tgz", + "integrity": "sha512-5E2fEczzzBd9Y8H79rRR8bV3vWDyB/cp8Ni3/pMcPerxGych1oCKWEYInZGItsAxAx8fw2Ufi7R/FwOixkrvXw==" }, "@electron-forge/cli": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@electron-forge/cli/-/cli-6.1.1.tgz", - "integrity": "sha512-ufD9wKh35Mynj5MEKcWQKLpuIgxPvehwvykHRULi2ev8MWLCqxN4wda1Wy/cj57Uaeokf2rTbcGHGqbBX60bFQ==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@electron-forge/cli/-/cli-6.2.1.tgz", + "integrity": "sha512-AyCJ1m7LBgttgUTS3kDwiBLhPHJ+6mFwoMSqu847EJ4Fe1DJ1Hi6gnMsSga7Mv4KsF7iA23Ss1fo+3TGZnvrWw==", "dev": true, "requires": { - "@electron-forge/core": "6.1.1", - "@electron-forge/shared-types": "6.1.1", + "@electron-forge/core": "6.2.1", + "@electron-forge/shared-types": "6.2.1", "@electron/get": "^2.0.0", "chalk": "^4.0.0", "commander": "^4.1.1", @@ -6308,20 +6305,20 @@ } }, "@electron-forge/core": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@electron-forge/core/-/core-6.1.1.tgz", - "integrity": "sha512-Fh1rNY1eI2wqbFXJ8eRBsJDS6gxfElgVR4nhMY+I+MZs9ddw1MFHIWwoqYjGFJKUBd9xTXCk5lkf8TwCpb4Igg==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@electron-forge/core/-/core-6.2.1.tgz", + "integrity": "sha512-udjU8r9dzuV/dPMPxONmkWYoqM0uY6ezpdjTLgO9aNdWTbBeBLIOMVT0jdx7GBoTuPu6ul/VhDEFNUaojEOrVA==", "dev": true, "requires": { - "@electron-forge/core-utils": "6.1.1", - "@electron-forge/maker-base": "6.1.1", - "@electron-forge/plugin-base": "6.1.1", - "@electron-forge/publisher-base": "6.1.1", - "@electron-forge/shared-types": "6.1.1", - "@electron-forge/template-base": "6.1.1", - "@electron-forge/template-vite": "6.1.1", - "@electron-forge/template-webpack": "6.1.1", - "@electron-forge/template-webpack-typescript": "6.1.1", + "@electron-forge/core-utils": "6.2.1", + "@electron-forge/maker-base": "6.2.1", + "@electron-forge/plugin-base": "6.2.1", + "@electron-forge/publisher-base": "6.2.1", + "@electron-forge/shared-types": "6.2.1", + "@electron-forge/template-base": "6.2.1", + "@electron-forge/template-vite": "6.2.1", + "@electron-forge/template-webpack": "6.2.1", + "@electron-forge/template-webpack-typescript": "6.2.1", "@electron/get": "^2.0.0", "@electron/rebuild": "^3.2.10", "@malept/cross-spawn-promise": "^2.0.0", @@ -6349,12 +6346,12 @@ } }, "@electron-forge/core-utils": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@electron-forge/core-utils/-/core-utils-6.1.1.tgz", - "integrity": "sha512-7Kt0o85UEzpYjWU2WQ3pVuSOnRIDfuFimCQ1bh9qym5NLrkDcIQx9sIsCFIFkWYkUY7oIuMIMOhrGA4tyWGl2w==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@electron-forge/core-utils/-/core-utils-6.2.1.tgz", + "integrity": "sha512-mJUpy8mZ7/l1BddReFrNZyM5iNEuYwjpeIqZ2E0E/hQPH26QreAV3rPfTj7WhA3V69ftmn++QRt82pNZFhHVEg==", "dev": true, "requires": { - "@electron-forge/shared-types": "6.1.1", + "@electron-forge/shared-types": "6.2.1", "@electron/rebuild": "^3.2.10", "@malept/cross-spawn-promise": "^2.0.0", "chalk": "^4.0.0", @@ -6367,49 +6364,49 @@ } }, "@electron-forge/maker-base": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@electron-forge/maker-base/-/maker-base-6.1.1.tgz", - "integrity": "sha512-qEW8vuSq6/r1rKh7JENK9yGmueymMzbm817GDk5usHia5o7otHYY4JMkdzZaKww56Ed/Ege2ch6LEYqYGTfl/Q==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@electron-forge/maker-base/-/maker-base-6.2.1.tgz", + "integrity": "sha512-LnvGtTJ/RNojKdUKktYEcbLqPggXdMBs1uscQRgXkI3XnVGdEi+/j5+Eg5ka4d6FnsaUkz//U5yhPtNFhDbNSw==", "dev": true, "requires": { - "@electron-forge/shared-types": "6.1.1", + "@electron-forge/shared-types": "6.2.1", "fs-extra": "^10.0.0", "which": "^2.0.2" } }, "@electron-forge/maker-deb": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@electron-forge/maker-deb/-/maker-deb-6.1.1.tgz", - "integrity": "sha512-Qk/QMBwWP/D6Fx7+VU54xHec47R9CYg0TCaRtQ1KeBNFdJ3DpwCARr966/IJqEUxX7y8vv8Awc8HvKDPxbpIUA==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@electron-forge/maker-deb/-/maker-deb-6.2.1.tgz", + "integrity": "sha512-y4WeBCGOeu1z5yBHPigzYcVPZAwbaJB60wXZ1VQpuKM5n09nONTq2TFhoJDHys3t9aHsBaX7G6Drv0XPUWQExQ==", "dev": true, "requires": { - "@electron-forge/maker-base": "6.1.1", - "@electron-forge/shared-types": "6.1.1", + "@electron-forge/maker-base": "6.2.1", + "@electron-forge/shared-types": "6.2.1", "electron-installer-debian": "^3.0.0" } }, "@electron-forge/plugin-base": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@electron-forge/plugin-base/-/plugin-base-6.1.1.tgz", - "integrity": "sha512-xZWZxvD2fQYnkFREK+46FS59vMEsPFINwydtD24QGTBoRMOKXkfXv16yN4eexVi+02Hj6mihYY8zhxJi56OmxA==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@electron-forge/plugin-base/-/plugin-base-6.2.1.tgz", + "integrity": "sha512-8mVbFgTlxQKDZ7jzeHyWrzOSiv/DpE29flPLgpyeFuz/zbC7oLNdxBCYo7WptQgI+HArphqehKUBf1UOkXmRPg==", "dev": true, "requires": { - "@electron-forge/shared-types": "6.1.1" + "@electron-forge/shared-types": "6.2.1" } }, "@electron-forge/publisher-base": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@electron-forge/publisher-base/-/publisher-base-6.1.1.tgz", - "integrity": "sha512-vxGzx2G7bWhz2G091MzNh+LHGrOM4gmp8FqW2VNpFJfFEYODr6D9KxitUihKAWc79bwG+YywvISXEMy5IBQu0Q==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@electron-forge/publisher-base/-/publisher-base-6.2.1.tgz", + "integrity": "sha512-clrrEPsamoe4543smfyZUBp2IRSZ4EEhdj/bm0zmODS2qs/V1cCEf7y8P29huxMskT5bXDxSzothG72or3b2WQ==", "dev": true, "requires": { - "@electron-forge/shared-types": "6.1.1" + "@electron-forge/shared-types": "6.2.1" } }, "@electron-forge/shared-types": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@electron-forge/shared-types/-/shared-types-6.1.1.tgz", - "integrity": "sha512-sFQQ2ldMq5mlNv4m7lZOZLf9aOn6MLNc8QVeTzOBQ+psxI3mVTDjb+/Lhs/jU8dm2igVfEqAmlj57Gi+C4u4Vw==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@electron-forge/shared-types/-/shared-types-6.2.1.tgz", + "integrity": "sha512-kLazG5XUAqb3Duyhq7XyGluINRwCQRaIiuvHwlvnZYYu6NZQTz9xUm6tQ9v05EtFblUx2iRjY67DJRZSt3dzTQ==", "dev": true, "requires": { "@electron/rebuild": "^3.2.10", @@ -6418,12 +6415,12 @@ } }, "@electron-forge/template-base": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@electron-forge/template-base/-/template-base-6.1.1.tgz", - "integrity": "sha512-i4EZHXIFTo+nJXJHPS1k9PAnWKEKGC4kMUvIsyYKEu+NrOTcGLMT4FIRM9VYe1nGarQLd486/274S3b2SaCUuw==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@electron-forge/template-base/-/template-base-6.2.1.tgz", + "integrity": "sha512-hSMaefJRptpszPsZLvEfHV22KO6/XK0kJ6Lota1x3xQEFQs4IpCwUv446JE5hde+5Fukw5vZawbK2m937Te24Q==", "dev": true, "requires": { - "@electron-forge/shared-types": "6.1.1", + "@electron-forge/shared-types": "6.2.1", "@malept/cross-spawn-promise": "^2.0.0", "debug": "^4.3.1", "fs-extra": "^10.0.0", @@ -6431,45 +6428,44 @@ } }, "@electron-forge/template-vite": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@electron-forge/template-vite/-/template-vite-6.1.1.tgz", - "integrity": "sha512-/6Sv7trkfjJR9LI7i83xmddVhi32pDlDE2kwlCkRgcoE2jGoW0fJU1BNfjNWy61Rd1wNzgrpfjMTPQlMnwHb4g==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@electron-forge/template-vite/-/template-vite-6.2.1.tgz", + "integrity": "sha512-t05p8ZWtkixjuUFJpaupq2t+ap8vjPjULO2knKC12TqWTxo53M8lKwx0f7h0zvgyqWdtEGQr8KiVfeFS0Lh3jA==", "dev": true, "requires": { - "@electron-forge/shared-types": "6.1.1", - "@electron-forge/template-base": "6.1.1", + "@electron-forge/shared-types": "6.2.1", + "@electron-forge/template-base": "6.2.1", "fs-extra": "^10.0.0" } }, "@electron-forge/template-webpack": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@electron-forge/template-webpack/-/template-webpack-6.1.1.tgz", - "integrity": "sha512-M3hTEF3iV6VYufassMilautoOYTLbqD06U1u3B6MDZVn74xAzprIZ+5EgrvQR33N+E3PyDpkgyMh+FJtWCo0/A==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@electron-forge/template-webpack/-/template-webpack-6.2.1.tgz", + "integrity": "sha512-u2/Cm6HjCah07larN1npHDG1dhDZMyqdDnPDh0iQNv+BEV6kCMSHX/8R9Uc7uIpkRVj+uCfcYBnkoKHKbUgKcQ==", "dev": true, "requires": { - "@electron-forge/shared-types": "6.1.1", - "@electron-forge/template-base": "6.1.1", + "@electron-forge/shared-types": "6.2.1", + "@electron-forge/template-base": "6.2.1", "fs-extra": "^10.0.0" } }, "@electron-forge/template-webpack-typescript": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/@electron-forge/template-webpack-typescript/-/template-webpack-typescript-6.1.1.tgz", - "integrity": "sha512-Ck7EgqoqfUL4r4NCioTsQT1/EFNCUqnsNd71MboU1RUvRbcrqpYvkoKk99+9QvxBrljMQp935gTieY7HADWQ9A==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@electron-forge/template-webpack-typescript/-/template-webpack-typescript-6.2.1.tgz", + "integrity": "sha512-8dXu54OsvfeBVGFyHfzVaBlxH+dPFxgLKu+/gsip82OEmLghXWyfvwhpXBw3rhxqG8V2/nbxDYUghSJackWZYA==", "dev": true, "requires": { - "@electron-forge/shared-types": "6.1.1", - "@electron-forge/template-base": "6.1.1", + "@electron-forge/shared-types": "6.2.1", + "@electron-forge/template-base": "6.2.1", "fs-extra": "^10.0.0" } }, "@electron/asar": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/@electron/asar/-/asar-3.2.3.tgz", - "integrity": "sha512-wmOfE6szYyqZhRIiLH+eyZEp+bGcJI0OD/SCvSUrfBE0jvauyGYO2ZhpWxmNCcDojKu5DYrsVqT5BOCZZ01XIg==", + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@electron/asar/-/asar-3.2.4.tgz", + "integrity": "sha512-lykfY3TJRRWFeTxccEKdf1I6BLl2Plw81H0bbp4Fc5iEc67foDCa5pjJQULVgo0wF+Dli75f3xVcdb/67FFZ/g==", "dev": true, "requires": { - "@types/glob": "^7.1.1", "chromium-pickle-js": "^0.2.0", "commander": "^5.0.0", "glob": "^7.1.6", @@ -6535,9 +6531,9 @@ } }, "@electron/notarize": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@electron/notarize/-/notarize-1.2.3.tgz", - "integrity": "sha512-9oRzT56rKh5bspk3KpAVF8lPKHYQrBnRwcgiOeR0hdilVEQmszDaAu0IPCPrwwzJN0ugNs0rRboTreHMt/6mBQ==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@electron/notarize/-/notarize-1.2.4.tgz", + "integrity": "sha512-W5GQhJEosFNafewnS28d3bpQ37/s91CDWqxVchHfmv2dQSTWpOzNlUVQwYzC1ay5bChRV/A9BTL68yj0Pa+TSg==", "dev": true, "requires": { "debug": "^4.1.1", @@ -6782,16 +6778,16 @@ "integrity": "sha512-r0c/MvC15/09xWujx1pKe6mA0nta+4jQWDXGkqfSVkXLo8ARrwcZ4mTGLlfvT43ySfidiveUo0m+P51+UK821Q==" }, "@tensorflow/tfjs": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs/-/tfjs-4.5.0.tgz", - "integrity": "sha512-GMpFI9GgotUSQKpce500yyBujYY8sWagG0gCpnjTSVzWrYRS8bsL+6Fq/GCamiCX5jtOrlpZ/kRkz/HIqaYXWg==", + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs/-/tfjs-4.8.0.tgz", + "integrity": "sha512-aKyYPFk5/aABtz+ETzvow8QBQxq0QgBCf3yQ7I33JkNbrIjlmEJmcfwbbbpLs5bg0BiOcNn2gYGbZHZ4AZuMQQ==", "requires": { - "@tensorflow/tfjs-backend-cpu": "4.5.0", - "@tensorflow/tfjs-backend-webgl": "4.5.0", - "@tensorflow/tfjs-converter": "4.5.0", - "@tensorflow/tfjs-core": "4.5.0", - "@tensorflow/tfjs-data": "4.5.0", - "@tensorflow/tfjs-layers": "4.5.0", + "@tensorflow/tfjs-backend-cpu": "4.8.0", + "@tensorflow/tfjs-backend-webgl": "4.8.0", + "@tensorflow/tfjs-converter": "4.8.0", + "@tensorflow/tfjs-core": "4.8.0", + "@tensorflow/tfjs-data": "4.8.0", + "@tensorflow/tfjs-layers": "4.8.0", "argparse": "^1.0.10", "chalk": "^4.1.0", "core-js": "3.29.1", @@ -6831,20 +6827,20 @@ } }, "@tensorflow/tfjs-backend-cpu": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-cpu/-/tfjs-backend-cpu-4.5.0.tgz", - "integrity": "sha512-TO6tkGeqR0UhifEx2SBa15kv8UlpubCHPGFHAnAfiPqBe3Z+3D7zqMlw2RvOelrzxzCWpTQByppFkB5u1pfiiA==", + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-cpu/-/tfjs-backend-cpu-4.8.0.tgz", + "integrity": "sha512-kT4WZeM4cuuZ+dSCMatrC9YiqV4dxpFzjxKOKwdS41gdg5QKQGW7caScCe55thO/Xpp7VOJXncDYeaMH7GcxCA==", "requires": { "@types/seedrandom": "^2.4.28", "seedrandom": "^3.0.5" } }, "@tensorflow/tfjs-backend-webgl": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-webgl/-/tfjs-backend-webgl-4.5.0.tgz", - "integrity": "sha512-xBgb3GW9wPbKRKeL8k0hxhyZv21uPnZ1eEXgwnpfgu86rXajToA7ATklh7bCpOlrQDY/n7ixBA8PwvsQEt2Jcw==", + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-backend-webgl/-/tfjs-backend-webgl-4.8.0.tgz", + "integrity": "sha512-iAJzQbndBtarV+OWk9Ukur5U0Xk/4t7j7O5WhPQO/q9yuRyWjAT6MPaCEW/+Ew4XC8yJGuvlfL0Oqi1X0drvfA==", "requires": { - "@tensorflow/tfjs-backend-cpu": "4.5.0", + "@tensorflow/tfjs-backend-cpu": "4.8.0", "@types/offscreencanvas": "~2019.3.0", "@types/seedrandom": "^2.4.28", "@types/webgl-ext": "0.0.30", @@ -6852,14 +6848,14 @@ } }, "@tensorflow/tfjs-converter": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-converter/-/tfjs-converter-4.5.0.tgz", - "integrity": "sha512-gd2DiLPX1YStXk4mkgqzbQuOoiwcuSv4s7tTyYvFEX5Ty9SKmttYmannCCppzmliL6aTzyxTpIZyWnqTPuTxeg==" + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-converter/-/tfjs-converter-4.8.0.tgz", + "integrity": "sha512-tBYsCdhdFNlFFn4FO49gr1yLX4h8xDxpoFI70lFECxDu9UfwaHNVuBLcocMx4XIFqQx12h6/Y3pD93HFvoum3A==" }, "@tensorflow/tfjs-core": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-core/-/tfjs-core-4.5.0.tgz", - "integrity": "sha512-FrHUnab/5msyzIg7zcjBmMV8W9vf2lj+f4em0zL+ntAczkEBeMAEIykk9BmV7sqMplRiCu2Cfrks8EqHFutSqw==", + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-core/-/tfjs-core-4.8.0.tgz", + "integrity": "sha512-EkgGOAsPQSlpEdiG938c92pdC5i8GHeBVk6xO1AKKX8NiMSIruKtKqIQvX2aOkarwHy/5nhrJebAAvIL4dJlbw==", "requires": { "@types/long": "^4.0.1", "@types/offscreencanvas": "~2019.7.0", @@ -6879,9 +6875,9 @@ } }, "@tensorflow/tfjs-data": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-data/-/tfjs-data-4.5.0.tgz", - "integrity": "sha512-fqTS5K+TrdisyDOOjcKwYQtoGyk9GzYhxwof1X9kpdm2zxpwl0kzeSqqCuVMPGD5DAOKp+EccTWYfAC4MIafcw==", + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-data/-/tfjs-data-4.8.0.tgz", + "integrity": "sha512-eISTI7Rs51nR9EjyMq/E+mk9JpOIvBqfxT52IEJr2DxqY7TUZ0PlN77Ng/huEL+5I9M+GoVTXe+GFHCmq/5VhQ==", "requires": { "@types/node-fetch": "^2.1.2", "node-fetch": "~2.6.1", @@ -6889,17 +6885,17 @@ } }, "@tensorflow/tfjs-layers": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-layers/-/tfjs-layers-4.5.0.tgz", - "integrity": "sha512-/Ohzc39SiIszQqOjEb+4DzGyJkdCweGP4uoblUzQQZdolJB/NxsAHJ06YUj0mD5dflTwNVCwYAe3rkdYqNlgvg==" + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-layers/-/tfjs-layers-4.8.0.tgz", + "integrity": "sha512-jJJvyPxwztP4QMyjUXjyrV6ErWmw4zjub4QidijD8SpY6aVE31xVYqBzIqATa4LjF1ozYwqQoSEvKh4BVFexnA==" }, "@tensorflow/tfjs-node": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-node/-/tfjs-node-4.5.0.tgz", - "integrity": "sha512-KX1Vl9G6kqOvt9WIQhb54S3H9qx8K+rMaOoyy2LMytcUU5hbcOi8ElGju4BGM4xSCrYFtJI3hBsl+Xfgd2hAKg==", + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/@tensorflow/tfjs-node/-/tfjs-node-4.8.0.tgz", + "integrity": "sha512-GNqqCUR15brznpI6Z2JAYxTTJCvuY40/r1oBSWyrpm4wHG4oaEsOpQBhXdLBYi3awhSJr9Bu2alYzPWFe5lV0g==", "requires": { "@mapbox/node-pre-gyp": "1.0.9", - "@tensorflow/tfjs": "4.5.0", + "@tensorflow/tfjs": "4.8.0", "adm-zip": "^0.5.2", "google-protobuf": "^3.9.2", "https-proxy-agent": "^2.2.1", @@ -7038,9 +7034,9 @@ "integrity": "sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q==" }, "@types/node-fetch": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.3.tgz", - "integrity": "sha512-ETTL1mOEdq/sxUtgtOhKjyB2Irra4cjxksvcMUR5Zr4n+PxVhsCD9WS46oPbHL3et9Zde7CNRr+WUNlcHvsX+w==", + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.4.tgz", + "integrity": "sha512-1ZX9fcN4Rvkvgv4E6PAY5WXUFWFcRWxZa3EW83UjycOB9ljJCedb2CupIP4RZMEwF/M3eTcCihbBRgwtGbg5Rg==", "requires": { "@types/node": "*", "form-data": "^3.0.0" @@ -7842,9 +7838,9 @@ } }, "electron": { - "version": "24.3.0", - "resolved": "https://registry.npmjs.org/electron/-/electron-24.3.0.tgz", - "integrity": "sha512-M7PpfpOzGdLeZPr2xhxXuvJeoXPEHMH40Rtv8BCGleRPolwna9BepAGc0H0F+Uz5kGKOv3xcm99fTurvXUH0nw==", + "version": "25.2.0", + "resolved": "https://registry.npmjs.org/electron/-/electron-25.2.0.tgz", + "integrity": "sha512-I/rhcW2sV2fyiveVSBr2N7v5ZiCtdGY0UiNCDZgk2fpSC+irQjbeh7JT2b4vWmJ2ogOXBjqesrN9XszTIG6DHg==", "dev": true, "requires": { "@electron/get": "^2.0.0", @@ -8752,9 +8748,9 @@ } }, "http-cache-semantics": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", - "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", + "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==", "dev": true }, "http-proxy-agent": { @@ -8885,9 +8881,9 @@ "dev": true }, "is-core-module": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", - "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz", + "integrity": "sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==", "dev": true, "requires": { "has": "^1.0.3" @@ -8982,13 +8978,13 @@ "dev": true }, "js-beautify": { - "version": "1.14.7", - "resolved": "https://registry.npmjs.org/js-beautify/-/js-beautify-1.14.7.tgz", - "integrity": "sha512-5SOX1KXPFKx+5f6ZrPsIPEY7NwKeQz47n3jm2i+XeHx9MoRsfQenlOP13FQhWvg8JRS0+XLO6XYUQ2GX+q+T9A==", + "version": "1.14.8", + "resolved": "https://registry.npmjs.org/js-beautify/-/js-beautify-1.14.8.tgz", + "integrity": "sha512-4S7HFeI9YfRvRgKnEweohs0tgJj28InHVIj4Nl8Htf96Y6pHg3+tJrmo4ucAM9f7l4SHbFI3IvFAZ2a1eQPbyg==", "requires": { "config-chain": "^1.1.13", "editorconfig": "^0.15.3", - "glob": "^8.0.3", + "glob": "^8.1.0", "nopt": "^6.0.0" }, "dependencies": { @@ -9001,9 +8997,9 @@ } }, "glob": { - "version": "8.0.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz", - "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -9013,9 +9009,9 @@ } }, "minimatch": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.2.tgz", - "integrity": "sha512-bNH9mmM9qsJ2X4r2Nat1B//1dJVcn3+iBLa3IgqJ7EbGaDNepL9QSHOxN4ng33s52VMMhhIfgCYDk3C4ZmlDAg==", + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", "requires": { "brace-expansion": "^2.0.1" } @@ -9483,9 +9479,9 @@ "dev": true }, "node-abi": { - "version": "3.40.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.40.0.tgz", - "integrity": "sha512-zNy02qivjjRosswoYmPi8hIKJRr8MpQyeKT6qlcq/OnOgA3Rhoae+IYOqsM9V5+JnHWmxKnWOT2GxvtqdtOCXA==", + "version": "3.45.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.45.0.tgz", + "integrity": "sha512-iwXuFrMAcFVi/ZoZiqq8BzAdsLw9kxDfTC0HMyjXfSL/6CSDAGD5UmR7azrAgWV1zKYq7dUUMj4owusBWKLsiQ==", "requires": { "semver": "^7.3.5" } @@ -9611,9 +9607,9 @@ } }, "nodemailer": { - "version": "6.9.2", - "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.2.tgz", - "integrity": "sha512-4+TYaa/e1nIxQfyw/WzNPYTEZ5OvHIDEnmjs4LPmIfccPQN+2CYKmGHjWixn/chzD3bmUTu5FMfpltizMxqzdg==" + "version": "6.9.3", + "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.3.tgz", + "integrity": "sha512-fy9v3NgTzBngrMFkDsKEj0r02U7jm6XfC3b52eoNV+GCrGj+s8pt5OqhiJdWKuw51zCTdiNR/IUD1z33LIIGpg==" }, "nopt": { "version": "5.0.0", diff --git a/package.json b/package.json index 387a20e..96d61f7 100644 --- a/package.json +++ b/package.json @@ -22,24 +22,24 @@ }, "homepage": "https://git.ocoge.club/ocoge.club/ocoge#readme", "devDependencies": { - "@electron-forge/cli": "^6.1.1", - "@electron-forge/maker-deb": "^6.1.1", + "@electron-forge/cli": "^6.2.1", + "@electron-forge/maker-deb": "^6.2.1", "@electron/rebuild": "^3.2.13", - "electron": "^24.3.0" + "electron": "^25.2.0" }, "dependencies": { - "@blockly/field-slider": "^4.0.16", + "@blockly/field-slider": "^4.0.18", "@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.5.0", + "@tensorflow/tfjs-node": "^4.8.0", "axios": "^1.4.0", "blockly": "^9.3.3", "dracula-prism": "^2.1.13", - "js-beautify": "^1.14.7", - "node-abi": "^3.40.0", - "nodemailer": "^6.9.2", + "js-beautify": "^1.14.8", + "node-abi": "^3.45.0", + "nodemailer": "^6.9.3", "prismjs": "^1.29.0" }, "optionalDependencies": {