From 1f1b9f67d60940b3e6efb0af81617dff4ee207dc Mon Sep 17 00:00:00 2001 From: ocogeclub Date: Mon, 27 May 2024 23:00:31 +0900 Subject: [PATCH] =?UTF-8?q?[update]=20Blockly=20v11=20=E3=81=AE=20FieldCol?= =?UTF-8?q?our=20=E3=81=AB=E5=AF=BE=E5=BF=9C=E3=80=82=E6=8C=87=E7=B4=8B?= =?UTF-8?q?=E3=82=BB=E3=83=B3=E3=82=B5=E3=81=A7=E8=AA=AD=E3=81=BF=E8=BE=BC?= =?UTF-8?q?=E3=82=93=E3=81=A0=E6=8C=87=E7=B4=8B=E3=81=AE=E3=83=93=E3=83=83?= =?UTF-8?q?=E3=83=88=E3=83=9E=E3=83=83=E3=83=97=E7=94=BB=E5=83=8F=E3=82=92?= =?UTF-8?q?=E3=82=AD=E3=83=A3=E3=83=B3=E3=83=90=E3=82=B9=E3=81=AB=E8=A1=A8?= =?UTF-8?q?=E7=A4=BA=E3=81=99=E3=82=8B=E3=83=96=E3=83=AD=E3=83=83=E3=82=AF?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- blocks/blocks.js | 124 +++++++++++++-- blocks/sensors/sfmv17.js | 61 +++++++- finger_test.js | 28 ++++ index.html | 79 +--------- json.js | 7 - local_modules/rgpio/index copy.js | 153 +++++++++++++++++++ local_modules/rgpio/index.js | 154 +++++++++---------- local_modules/sfmv17/sfmv17.js | 72 ++++++--- package-lock.json | 240 ++++++++++++++++-------------- package.json | 9 +- 10 files changed, 610 insertions(+), 317 deletions(-) create mode 100644 finger_test.js delete mode 100644 json.js create mode 100644 local_modules/rgpio/index copy.js diff --git a/blocks/blocks.js b/blocks/blocks.js index b4bc70b..9384127 100644 --- a/blocks/blocks.js +++ b/blocks/blocks.js @@ -1,17 +1,113 @@ -// Custom Color Picker -Blockly.FieldColour.COLOURS = [ - '#ffffff', '#808000', '#ffff00', '#ff00ff', '#ff4500', - '#c0c0c0', '#00ffff', '#00ff00', '#ff0000', '#ff1493', - '#808080', '#0000ff', '#008000', '#800080', '#8a2be2', - '#000000', '#000080', '#008080', '#800000', '#2e8b57' -]; -Blockly.FieldColour.TITLES = [ - 'white', 'olive', 'yellow', 'magenta', 'orangered', - 'silver', 'aqua', 'lime', 'red', 'deeppink', - 'gray', 'blue', 'green', 'purple', 'blueviolet', - 'black', 'navy', 'teal', 'maroon', 'seagreen' -]; -Blockly.FieldColour.COLUMNS = 5; +// Color Picker : ビルトインのブロックがウチの環境でどうもうまく働かないので自作 +registerFieldColour(); +Blockly.defineBlocksWithJsonArray([ + { + type: 'colour_picker', + message0: '%1', + "output": "Colour", + "tooltip": "パレットから色を選んでください", + "helpUrl": "", + "style": "colour_blocks", + args0: [ + { + type: 'field_colour', + name: 'COLOUR', + colour: '#ff0000', + }, + ], + }, +]); +javascript.javascriptGenerator.forBlock['colour_picker'] = function (block, generator) { + const code = generator.quote_(block.getFieldValue('COLOUR')); + return [code, Blockly.JavaScript.ORDER_ATOMIC]; +}; + +Blockly.defineBlocksWithJsonArray([ + { + type: 'coupycolor_picker', + message0: 'クーピー30色: %1', + "output": "Colour", + "tooltip": "サクラクーピーペンシル30色のカラーチャートによる", + "helpUrl": "https://www.craypas.co.jp/products/painting-school/013/0031/182945.html#color-chart", + "style": "colour_blocks", + args0: [ + { + type: 'field_colour', + name: 'COLOUR', + colour: '#E281A0', + colourOptions: [ + '#F5ED68', + '#F6E92B', + '#EEB818', + '#EA9D13', + '#F2C198', + '#FBF5C5', + '#7E422A', + '#B8591F', + '#CD9711', + '#4F371D', + '#D83A2F', + '#D61242', + '#E281A0', + '#A41759', + '#E0BED6', + '#1D2973', + '#1794CE', + '#0FA275', + '#8ABC29', + '#0C834D', + '#0C834D', + '#0A68AE', + '#096CB0', + '#0F3460', + '#9CA5A4', + '#277565', + '#3F3939', + '#FFFFFF', + '#AE901E', + '#A5AEB3', + ], + colourTitles: [ + 'レモンいろ', + 'きいろ', + 'やまぶきいろ', + 'だいだいいろ', + 'うすだいだい', + 'たまごいろ', + 'ちゃいろ', + 'あかちゃいろ', + 'おうどいろ', + 'こげちゃいろ', + 'しゅいろ', + 'あか', + 'ももいろ', + 'あかむらさき', + 'うすむらさき', + 'むらさき', + 'みずいろ', + 'エメラルドいろ', + 'きみどり', + 'みどり', + 'ふかみどり', + 'あお', + 'ぐんじょういろ', + 'あいいろ', + 'ねずみいろ', + 'はいみどり', + 'くろ', + 'しろ', + 'きんいろ', + 'ぎんいろ', + ], + columns: 5, + }, + ], + }, +]); +javascript.javascriptGenerator.forBlock['coupycolor_picker'] = function (block, generator) { + const code = generator.quote_(block.getFieldValue('COLOUR')); + return [code, Blockly.JavaScript.ORDER_ATOMIC]; +}; /** Additional Basic Blocks********************************************************************************* */ Blockly.defineBlocksWithJsonArray([{ diff --git a/blocks/sensors/sfmv17.js b/blocks/sensors/sfmv17.js index 320cd25..3af494f 100644 --- a/blocks/sensors/sfmv17.js +++ b/blocks/sensors/sfmv17.js @@ -188,22 +188,53 @@ javascript.javascriptGenerator.forBlock['oc_sfmv17_registration'] = function (bl return [code, Blockly.JavaScript.ORDER_ATOMIC]; }; -// 全ユーザ一括削除 +// ユーザ削除 / ID 0 で全削除 Blockly.defineBlocksWithJsonArray([{ - "type": "oc_sfmv17_deletealluser", - "message0": "指紋一括削除", + "type": "oc_sfmv17_deleteuser", + "message0": "ID %1 の指紋を削除", + "args0": [ + { + "type": "input_value", + "name": "uid" + } + ], + "inputsInline": true, "previousStatement": null, "nextStatement": null, - "tooltip": "指紋センサに登録されている指紋を全て削除します。", + "tooltip": "登録済みの指紋から ID で指定したものを削除します。ID 0 を指定すると全部の指紋を削除します。", "helpUrl": "", "style": "sensor_blocks" }]); -javascript.javascriptGenerator.forBlock['oc_sfmv17_deletealluser'] = function (block, generator) { - var code = `await _sfm.deleteAllUser();\n`; +javascript.javascriptGenerator.forBlock['oc_sfmv17_deleteuser'] = function (block, generator) { + var value_uid = generator.valueToCode(block, 'uid', javascript.Order.ATOMIC); + var code = `await _sfm.deleteUser(${value_uid});\n`; return code; }; - +// 指紋画像を取得 +Blockly.defineBlocksWithJsonArray([{ + "type": "oc_sfmv17_getimage", + "message0": "指紋画像をキャンバスに表示", + "previousStatement": null, + "nextStatement": null, + "tooltip": "指紋センサで読み取った指紋をキャンバスに表示します。", + "helpUrl": "", + "style": "sensor_blocks" +}]); +javascript.javascriptGenerator.forBlock['oc_sfmv17_getimage'] = function (block, generator) { + var code = ` let r = await _sfm.getImage(); +console.log(r); +console.log(r.length) +let imgdata = _ctx.createImageData(160, 160); +for (let pixel=0; pixel { + const _rg = require('@ocoge/rgpio'); + + const _sfm = require('@ocoge/sfmv17'); + + const fs = require('node:fs') + + const _sleep = sec => + new Promise(r => setTimeout(r, sec * 1000)); + + + await _rg.rgpio_sbc('192.168.0.202'); + await _sfm.init(_rg, '/dev/ttyS0', 115200); + await _sleep(0.1); + let r = await _sfm.getImage(); + console.log(r); + console.log(r.length) + fs.writeFile("fptest.bmp", r, (err) => { + if (err) throw err; + console.log('正常に書き込みが完了しました'); + }); + + await _sleep(0.1); + await _sfm.stop(); + await _rg.sbc_stop(); + +} +main(); \ No newline at end of file diff --git a/index.html b/index.html index c393db6..d107a60 100644 --- a/index.html +++ b/index.html @@ -24,17 +24,9 @@
Source Code:
-
- -
@@ -340,13 +332,6 @@ - @@ -393,7 +378,6 @@ I2Cデバイス - I2Cデバイス @@ -496,32 +480,6 @@ - @@ -614,25 +572,8 @@ - #ff0000 - - - - - 100 - - - - - 50 - - - - - 0 - - + @@ -698,27 +639,16 @@ - - ラベル + ラベル - - スコア + スコア @@ -973,7 +903,6 @@ - @@ -1038,12 +967,12 @@ - + diff --git a/json.js b/json.js deleted file mode 100644 index 9e4125e..0000000 --- a/json.js +++ /dev/null @@ -1,7 +0,0 @@ -const foo = [["CE1", "35"], ["CE0", "52"], ["SCLK", "50"], ["MISO", "48"], ["MOSI", "49"], ["RXD", "132"], ["TXD", "131"], ["SCL", "46"], ["SDA", "47"], ["P0", "138"], ["P1", "29"], ["P2", "139"], ["P3", "28"], ["P4", "59"], ["P5", "58"], ["P6", "92"], ["P7", "54"]]; - -// console.log(foo["CE0"]); - -let bar = JSON.stringify(foo); - -console.log(bar); \ No newline at end of file diff --git a/local_modules/rgpio/index copy.js b/local_modules/rgpio/index copy.js new file mode 100644 index 0000000..d8656a3 --- /dev/null +++ b/local_modules/rgpio/index copy.js @@ -0,0 +1,153 @@ +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; + +// Properties +let sbc = -1; +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); + } + } + return sbc; +} +module.exports.sbc_stop = async () => { + await module.exports._rgpiod_stop(sbc); + chip_hand = []; + sbc = -1; +} +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.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.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.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.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.serial_open = async (tty, baud, ser_flags = 0) => { + return await module.exports._serial_open(sbc, tty, baud, ser_flags); +} +module.exports.serial_close = async handle => { + await module.exports._serial_close(sbc, handle); +} +module.exports.serial_read = async (handle, count = 0, raw = false) => { + if (count === 0) { + count = await module.exports._serial_data_available(sbc, handle); + if (count === 0) return ''; + } + if (raw) + return await module.exports._serial_read(sbc, handle, count); + else + 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 => { + return 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 (handle, byte_val) => { + return await module.exports._i2c_write_byte(sbc, handle, byte_val); +} +module.exports.i2c_read_byte = async handle => { + return await module.exports._i2c_read_byte(sbc, handle); +} +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 (handle, reg) => { + return await module.exports._i2c_read_byte_data(sbc, handle, reg); +} +module.exports.i2c_read_i2c_block_data = async (handle, reg, count = -1) => { + return await module.exports._i2c_read_i2c_block_data(sbc, handle, reg, count); +} +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 (handle, reg) => { + return await module.exports._i2c_read_word_data(sbc, handle, reg); +} +module.exports.i2c_write_word_data = async (handle, reg, word_val) => { + return await module.exports._i2c_write_word_data(sbc, handle, reg, word_val); +} +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 (handle, data) => { + return await module.exports._i2c_write_device(sbc, handle, Buffer.from(data), -1); +} + +/***** 同期関数 *****/ +module.exports.rgpio_sbc_sync = (host = 'localhost', port = 8889, show_errors = true) => { + if (sbc < 0) { + sbc = module.exports._rgpiod_start_sync(host, port.toString()); + if (sbc < 0) { + if (show_errors) console.log(sbc); + } + } + return sbc; +} +module.exports.sbc_stop_sync = () => { + module.exports._rgpiod_stop_sync(sbc); + chip_hand = []; + sbc = -1; +} +module.exports.i2c_open_sync = (i2c_bus, i2c_address, i2c_flags = 0) => { + return module.exports._i2c_open_sync(sbc, i2c_bus, i2c_address, i2c_flags); +} +module.exports.i2c_close_sync = handle => { + module.exports._i2c_close_sync(sbc, handle); +} +module.exports.i2c_read_byte_sync = handle => { + return module.exports._i2c_read_byte_sync(sbc, handle); +} +module.exports.i2c_write_device_sync = (handle, data, count = -1) => { + let buffer = Buffer.from(data); + if (count < 0) count = buffer.length; + return module.exports._i2c_write_device_sync(sbc, handle, buffer, count); +} + + +// 終了処理 +module.exports.close_all_handle = async () => { + await module.exports.sbc_stop(); +} diff --git a/local_modules/rgpio/index.js b/local_modules/rgpio/index.js index d8656a3..00b8592 100644 --- a/local_modules/rgpio/index.js +++ b/local_modules/rgpio/index.js @@ -1,153 +1,155 @@ -module.exports = require('bindings')('rgpio'); +'use strict'; -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; +let rg = require('bindings')('rgpio'); + +exports.SET_ACTIVE_LOW = 4; +exports.SET_OPEN_DRAIN = 8; +exports.SET_OPEN_SOURCE = 16; +exports.SET_PULL_UP = 32; +exports.SET_PULL_DOWN = 64; +exports.SET_PULL_NONE = 128; // Properties let sbc = -1; let chip_hand = []; -module.exports.rgpio_sbc = async (host = 'localhost', port = 8889, show_errors = true) => { +exports.rgpio_sbc = async (host = 'localhost', port = 8889, show_errors = true) => { if (sbc < 0) { - sbc = await module.exports._rgpiod_start(host, port.toString()); + sbc = await rg._rgpiod_start(host, port.toString()); if (sbc < 0) { if (show_errors) console.log(sbc); } } return sbc; } -module.exports.sbc_stop = async () => { - await module.exports._rgpiod_stop(sbc); +exports.sbc_stop = async () => { + await rg._rgpiod_stop(sbc); chip_hand = []; sbc = -1; } -module.exports.gpiochip_open = async gpiochip => { +exports.gpiochip_open = async gpiochip => { if (!chip_hand[gpiochip] || chip_hand[gpiochip] < 0) { - chip_hand[gpiochip] = await module.exports._gpiochip_open(sbc, gpiochip); + chip_hand[gpiochip] = await rg._gpiochip_open(sbc, gpiochip); } return chip_hand[gpiochip]; - // return await module.exports._gpiochip_open(sbc, gpiochip); + // return await rg._gpiochip_open(sbc, gpiochip); } -module.exports.gpio_set_input = async (ugpio, lFlags = 0) => { +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); + let handle = await this.gpiochip_open(chip); + return await rg._gpio_claim_input(sbc, handle, lFlags, gpio); } -module.exports.gpio_set_output = async (ugpio, level = 0, lFlags = 0) => { +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); + let handle = await this.gpiochip_open(chip); + return await rg._gpio_claim_output(sbc, handle, lFlags, gpio, level); } -module.exports.gpio_read = async (ugpio) => { +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); + let handle = await this.gpiochip_open(chip); + return await rg._gpio_read(sbc, handle, gpio); } -module.exports.gpio_write = async (ugpio, level) => { +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); + let handle = await this.gpiochip_open(chip); + return await rg._gpio_write(sbc, handle, gpio, level); } -module.exports.serial_open = async (tty, baud, ser_flags = 0) => { - return await module.exports._serial_open(sbc, tty, baud, ser_flags); +exports.serial_open = async (tty, baud, ser_flags = 0) => { + return await rg._serial_open(sbc, tty, baud, ser_flags); } -module.exports.serial_close = async handle => { - await module.exports._serial_close(sbc, handle); +exports.serial_close = async handle => { + await rg._serial_close(sbc, handle); } -module.exports.serial_read = async (handle, count = 0, raw = false) => { +exports.serial_read = async (handle, count = 0, raw = false) => { if (count === 0) { - count = await module.exports._serial_data_available(sbc, handle); + count = await rg._serial_data_available(sbc, handle); if (count === 0) return ''; } if (raw) - return await module.exports._serial_read(sbc, handle, count); + return await rg._serial_read(sbc, handle, count); else - return new TextDecoder().decode(await module.exports._serial_read(sbc, handle, count)); + return new TextDecoder().decode(await rg._serial_read(sbc, handle, count)); } -module.exports.serial_write = async (handle, data) => { - return await module.exports._serial_write(sbc, handle, Buffer.from(data), -1); +exports.serial_write = async (handle, data) => { + return await rg._serial_write(sbc, handle, Buffer.from(data), -1); } -module.exports.serial_data_available = async handle => { - return await module.exports._serial_data_available(sbc, handle); +exports.serial_data_available = async handle => { + return await rg._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); +exports.i2c_open = async (i2c_bus, i2c_address, i2c_flags = 0) => { + return await rg._i2c_open(sbc, i2c_bus, i2c_address, i2c_flags); } -module.exports.i2c_close = async handle => { - await module.exports._i2c_close(sbc, handle); +exports.i2c_close = async handle => { + await rg._i2c_close(sbc, handle); } -module.exports.i2c_write_byte = async (handle, byte_val) => { - return await module.exports._i2c_write_byte(sbc, handle, byte_val); +exports.i2c_write_byte = async (handle, byte_val) => { + return await rg._i2c_write_byte(sbc, handle, byte_val); } -module.exports.i2c_read_byte = async handle => { - return await module.exports._i2c_read_byte(sbc, handle); +exports.i2c_read_byte = async handle => { + return await rg._i2c_read_byte(sbc, handle); } -module.exports.i2c_write_byte_data = async (handle, reg, byte_val) => { - return await module.exports._i2c_write_byte_data(sbc, handle, reg, byte_val); +exports.i2c_write_byte_data = async (handle, reg, byte_val) => { + return await rg._i2c_write_byte_data(sbc, handle, reg, byte_val); } -module.exports.i2c_read_byte_data = async (handle, reg) => { - return await module.exports._i2c_read_byte_data(sbc, handle, reg); +exports.i2c_read_byte_data = async (handle, reg) => { + return await rg._i2c_read_byte_data(sbc, handle, reg); } -module.exports.i2c_read_i2c_block_data = async (handle, reg, count = -1) => { - return await module.exports._i2c_read_i2c_block_data(sbc, handle, reg, count); +exports.i2c_read_i2c_block_data = async (handle, reg, count = -1) => { + return await rg._i2c_read_i2c_block_data(sbc, handle, reg, count); } -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); +exports.i2c_write_i2c_block_data = async (handle, reg, data) => { + return await rg._i2c_write_i2c_block_data(sbc, handle, reg, Buffer.from(data), -1); } -module.exports.i2c_read_word_data = async (handle, reg) => { - return await module.exports._i2c_read_word_data(sbc, handle, reg); +exports.i2c_read_word_data = async (handle, reg) => { + return await rg._i2c_read_word_data(sbc, handle, reg); } -module.exports.i2c_write_word_data = async (handle, reg, word_val) => { - return await module.exports._i2c_write_word_data(sbc, handle, reg, word_val); +exports.i2c_write_word_data = async (handle, reg, word_val) => { + return await rg._i2c_write_word_data(sbc, handle, reg, word_val); } -module.exports.i2c_read_device = async (handle, count) => { - return new TextDecoder().decode(await module.exports._i2c_read_device(sbc, handle, count)); +exports.i2c_read_device = async (handle, count) => { + return new TextDecoder().decode(await rg._i2c_read_device(sbc, handle, count)); } -module.exports.i2c_write_device = async (handle, data) => { - return await module.exports._i2c_write_device(sbc, handle, Buffer.from(data), -1); +exports.i2c_write_device = async (handle, data) => { + return await rg._i2c_write_device(sbc, handle, Buffer.from(data), -1); } /***** 同期関数 *****/ -module.exports.rgpio_sbc_sync = (host = 'localhost', port = 8889, show_errors = true) => { +exports.rgpio_sbc_sync = (host = 'localhost', port = 8889, show_errors = true) => { if (sbc < 0) { - sbc = module.exports._rgpiod_start_sync(host, port.toString()); + sbc = rg._rgpiod_start_sync(host, port.toString()); if (sbc < 0) { if (show_errors) console.log(sbc); } } return sbc; } -module.exports.sbc_stop_sync = () => { - module.exports._rgpiod_stop_sync(sbc); +exports.sbc_stop_sync = () => { + rg._rgpiod_stop_sync(sbc); chip_hand = []; sbc = -1; } -module.exports.i2c_open_sync = (i2c_bus, i2c_address, i2c_flags = 0) => { - return module.exports._i2c_open_sync(sbc, i2c_bus, i2c_address, i2c_flags); +exports.i2c_open_sync = (i2c_bus, i2c_address, i2c_flags = 0) => { + return rg._i2c_open_sync(sbc, i2c_bus, i2c_address, i2c_flags); } -module.exports.i2c_close_sync = handle => { - module.exports._i2c_close_sync(sbc, handle); +exports.i2c_close_sync = handle => { + rg._i2c_close_sync(sbc, handle); } -module.exports.i2c_read_byte_sync = handle => { - return module.exports._i2c_read_byte_sync(sbc, handle); +exports.i2c_read_byte_sync = handle => { + return rg._i2c_read_byte_sync(sbc, handle); } -module.exports.i2c_write_device_sync = (handle, data, count = -1) => { +exports.i2c_write_device_sync = (handle, data, count = -1) => { let buffer = Buffer.from(data); if (count < 0) count = buffer.length; - return module.exports._i2c_write_device_sync(sbc, handle, buffer, count); + return rg._i2c_write_device_sync(sbc, handle, buffer, count); } // 終了処理 -module.exports.close_all_handle = async () => { - await module.exports.sbc_stop(); +exports.close_all_handle = async () => { + await this.sbc_stop(); } diff --git a/local_modules/sfmv17/sfmv17.js b/local_modules/sfmv17/sfmv17.js index 673c4ac..6b80c4b 100644 --- a/local_modules/sfmv17/sfmv17.js +++ b/local_modules/sfmv17/sfmv17.js @@ -46,7 +46,7 @@ let ser_hand = -1; const delay = microsec => new Promise(r => setTimeout(r, microsec)); -// Calculate checksum +// Calculate XOR checksum const getCheckSum = buffer => { let result = 0; for (let i = 1; i <= 5; i++) { @@ -61,30 +61,43 @@ const sendCmd = async (cmdType, p1, p2, p3) => { let cmdBuffer = [0xF5, cmdType, p1, p2, p3, 0, 0, 0xF5]; cmdBuffer[6] = getCheckSum(cmdBuffer); await rg.serial_write(ser_hand, cmdBuffer); - +} +const getAck = async () => { let ackBuffer = Buffer.from([]); let timer = SFM_SERIAL_TIMEOUT; while (timer--) { - if (await rg.serial_data_available(ser_hand)) { + if (await rg.serial_data_available(ser_hand) > 0) { ackBuffer = Buffer.concat([ackBuffer, await rg.serial_read(ser_hand, 0, true)]); } else if (ackBuffer.length >= 8) { - // console.log(ackBuffer); + // 1/100秒待ってデバイス側にデータが残っていないか再チェック + await delay(10); + timer -= 10; + if (await rg.serial_data_available(ser_hand) > 0) continue; + // もうデータは残っていないらしい if (ackBuffer[6] == getCheckSum(ackBuffer)) - return [ackBuffer[4], ackBuffer[1], ackBuffer[2], ackBuffer[3]]; + if (ackBuffer.length > 8) { // Has data field + if (ackBuffer[ackBuffer.length - 1] == 0xF5) { + let dataBuffer = Buffer.alloc(ackBuffer.length - 8); + ackBuffer.copy(dataBuffer, 0, 8); + return [ackBuffer[1], ackBuffer[2], ackBuffer[3], ackBuffer[4], dataBuffer]; + } + } else + return [ackBuffer[1], ackBuffer[2], ackBuffer[3], ackBuffer[4]]; else - return [SFM_ACK_FAIL]; + return [null, null, null, SFM_ACK_FAIL]; } await delay(1); } - return [SFM_ACK_SERIALTIMEOUT]; + return [null, null, null, SFM_ACK_SERIALTIMEOUT]; } // Rapping sendCmd... Returns tuple -const getCmdReturn = async (cmdType, p1 = 0, p2 = 0, p3 = 0) => { - let [q3, ackType, q1, q2] = await sendCmd(cmdType, p1, p2, p3); +const sendAndGet = async (cmdType, p1 = 0, p2 = 0, p3 = 0) => { + await sendCmd(cmdType, p1, p2, p3); + let [ackType, q1, q2, q3, dataBuffer] = await getAck(); this.last_status = q3; // コマンド実行結果ステータスを保存 - if (ackType == cmdType) return [q3, ackType, q1, q2]; + if (ackType == cmdType) return [ackType, q1, q2, q3, dataBuffer]; else return [SFM_ACK_FAIL, 0, 0, 0]; } @@ -102,13 +115,13 @@ exports.setRingColor = async (start_color, end_color = -1, period = 500) => { if (period < 30) period = 30; else if (period > 200) period = 200; if (end_color == -1) end_color = start_color; - let [q3, ackType, q1, q2] = await getCmdReturn(0xC3, start_color, end_color, period); + let [ackType, q1, q2, q3] = await sendAndGet(0xC3, start_color, end_color, period); return q3; } // Count users exports.getUserCount = async () => { - let [q3, ackType, q1, q2] = await getCmdReturn(0x09, 0x00, 0x00, 0x00); + let [ackType, q1, q2, q3] = await sendAndGet(0x09, 0x00, 0x00, 0x00); let userCount = -1; if (q3 != SFM_ACK_FAIL) userCount = (q1 << 8) | q2; // else userCount = -1; @@ -117,7 +130,7 @@ exports.getUserCount = async () => { // Recognize fingerprint... returns userID / 0: not found / -1: error exports.recognition_1vN = async () => { - let [q3, ackType, q1, q2] = await getCmdReturn(0x0C, 0x00, 0x00, 0x00); + let [ackType, q1, q2, q3] = await sendAndGet(0x0C, 0x00, 0x00, 0x00); let uid = (q1 << 8) | q2; if (uid == 0 && q3 != SFM_ACK_SUCCESS) return -1; else return uid; @@ -130,24 +143,45 @@ exports.recognition_1vN = async () => { exports.register_3c3r = async (step, uid = 0) => { let q3, ackType, q1, q2; if (step == 1) { - [q3, ackType, q1, q2] = await getCmdReturn(0x01, (uid >> 8) & 0xFF, uid & 0xFF, SFM_DEFAULT_USERROLE); + [ackType, q1, q2, q3] = await sendAndGet(0x01, (uid >> 8) & 0xFF, uid & 0xFF, SFM_DEFAULT_USERROLE); if (q3 == SFM_ACK_SUCCESS) return 0; else return -1; } else if (step == 2) { - [q3, ackType, q1, q2] = await getCmdReturn(0x02); + [ackType, q1, q2, q3] = await sendAndGet(0x02); if (q3 == SFM_ACK_SUCCESS) return 0; else return -1; } else if (step == 3) { - [q3, ackType, q1, q2] = await getCmdReturn(0x03, 0x00, 0x00, 0x00); + [ackType, q1, q2, q3] = await sendAndGet(0x03, 0x00, 0x00, 0x00); let uid = -1; if (q3 == SFM_ACK_SUCCESS) uid = (q1 << 8) | q2; return uid; } } -// Delete all users -exports.deleteAllUser = async () => { - let [q3, ackType, q1, q2] = await getCmdReturn(0x05); +// Get fingerprint image +exports.getImage = async () => { + let [ackType, q1, q2, q3, dataBuffer] = await sendAndGet(0x24); + if (q3 == SFM_ACK_SUCCESS) { + // console.log(dataBuffer) + let width = q1 << 2; + let height = q2 << 2; + let len = width * height; + let imgBuffer = Buffer.alloc(len);//dataBuffer.slice(1, 1 + len); + dataBuffer.copy(imgBuffer, 0, 1, 1 + len); + // const imgblob = new Blob([imgBuffer], { type: "image/bmp" }); + return imgBuffer; + } + // return [, ]; + else return -1; +} + +// Delete user(s) +exports.deleteUser = async (uid) => { + let ackType, q1, q2, q3; + if (uid == 0) // Delete All users + [ackType, q1, q2, q3] = await sendAndGet(0x05); + else // Delete specific user + [ackType, q1, q2, q3] = await sendAndGet(0x04, (uid >> 8) & 0xFF, uid & 0xFF, SFM_DEFAULT_USERROLE); if (q3 == SFM_ACK_SUCCESS) return 0; else return -1; } diff --git a/package-lock.json b/package-lock.json index e9220fc..94a6865 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,8 @@ "version": "0.1.12", "license": "ISC", "dependencies": { - "@blockly/field-slider": "^6.1.10", + "@blockly/field-colour": "^5.0.0", + "@blockly/field-slider": "^7.0.0", "@ocoge/amg8833": "file:local_modules/amg8833", "@ocoge/bme280": "file:local_modules/bme280", "@ocoge/paj7620": "file:local_modules/paj7620", @@ -20,8 +21,8 @@ "@tensorflow-models/mobilenet": "^2.1.1", "@tensorflow-models/speech-commands": "^0.5.4", "@tensorflow/tfjs-node": "^4.19.0", - "axios": "^1.7.0", - "blockly": "^10.4.3", + "axios": "^1.7.2", + "blockly": "^11.0.0", "canvas": "github:Automattic/node-canvas", "dracula-prism": "^2.1.16", "js-beautify": "^1.15.1", @@ -34,7 +35,7 @@ "@electron-forge/cli": "^7.4.0", "@electron-forge/maker-deb": "^7.4.0", "@electron/rebuild": "^3.6.0", - "electron": "^30.0.6" + "electron": "^30.0.8" }, "optionalDependencies": { "@ocoge/rgpio": "file:local_modules/rgpio" @@ -81,15 +82,26 @@ "version": "1.0.0", "license": "MIT" }, - "node_modules/@blockly/field-slider": { - "version": "6.1.10", - "resolved": "https://registry.npmjs.org/@blockly/field-slider/-/field-slider-6.1.10.tgz", - "integrity": "sha512-l0Vzm2CTynjyfs4ATiFdb1zqS7V4T5oJB0lUeEIjlIZl08jMkyZR3AkUg4P+C4e/kI5tTHKAqhlnldv+ij4fyA==", + "node_modules/@blockly/field-colour": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@blockly/field-colour/-/field-colour-5.0.0.tgz", + "integrity": "sha512-UyelwXh9xjaodIM1OxA4pjsA0vlk+wVvNEGgGIUdWOrBGeZsRYDprB/IjK7Pzr9iC7Y54bzj8c09ysC2dsX3bQ==", "engines": { "node": ">=8.0.0" }, "peerDependencies": { - "blockly": "^10.0.0" + "blockly": "^11.0.0" + } + }, + "node_modules/@blockly/field-slider": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@blockly/field-slider/-/field-slider-7.0.0.tgz", + "integrity": "sha512-3PJXPi70LRlFYD/O/cfmF6etgizNGnatBm4hU2tguKqLeich/u1QgWF2Lm4cyA1NxSqomV14sw7jJ4Ou1rFhkQ==", + "engines": { + "node": ">=8.0.0" + }, + "peerDependencies": { + "blockly": "^11.0.0" } }, "node_modules/@electron-forge/cli": { @@ -1301,6 +1313,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==", + "dev": true, "engines": { "node": ">= 10" } @@ -1425,12 +1438,6 @@ "node": ">=10.0.0" } }, - "node_modules/abab": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", - "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==", - "deprecated": "Use your platform's native atob() and btoa() methods instead" - }, "node_modules/abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", @@ -1529,6 +1536,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz", "integrity": "sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==", + "deprecated": "This package is no longer supported.", "dependencies": { "delegates": "^1.0.0", "readable-stream": "^3.6.0" @@ -1602,9 +1610,9 @@ } }, "node_modules/axios": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.0.tgz", - "integrity": "sha512-IiB0wQeKyPRdsFVhBgIo31FbzOyf2M6wYl7/NVutFwFBRMiAbjNiydJIHKeLmPugF4kJLfA1uWZ82Is2QzqqFA==", + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.2.tgz", + "integrity": "sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==", "dependencies": { "follow-redirects": "^1.15.6", "form-data": "^4.0.0", @@ -1655,11 +1663,14 @@ } }, "node_modules/blockly": { - "version": "10.4.3", - "resolved": "https://registry.npmjs.org/blockly/-/blockly-10.4.3.tgz", - "integrity": "sha512-+opfBmQnSiv7vTiY/TkDEBOslxUyfj8luS3S+qs1NnQKjInC+Waf2l9cNsMh9J8BMkmiCIT+Ed/3mmjIaL9wug==", + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/blockly/-/blockly-11.0.0.tgz", + "integrity": "sha512-6Ie7HuZWZLaETIVKFEP4FPDz267Pubn6+weQNZvXzqnkOYp9sKPSsPue8QIMCV9Qb5F4wYhqivgiDcZJcE1UlQ==", "dependencies": { - "jsdom": "22.1.0" + "jsdom": "23.0.0" + }, + "engines": { + "node": ">=18" } }, "node_modules/bluebird": { @@ -2213,16 +2224,15 @@ } }, "node_modules/data-urls": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-4.0.0.tgz", - "integrity": "sha512-/mMTei/JXPqvFqQtfyTowxmJVwr2PVAeCcDxyFf6LhoOu/09TX2OX3kb2wzi4DMXcfj4OItwDOnhl5oziPnT6g==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-5.0.0.tgz", + "integrity": "sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg==", "dependencies": { - "abab": "^2.0.6", - "whatwg-mimetype": "^3.0.0", - "whatwg-url": "^12.0.0" + "whatwg-mimetype": "^4.0.0", + "whatwg-url": "^14.0.0" }, "engines": { - "node": ">=14" + "node": ">=18" } }, "node_modules/debug": { @@ -2374,18 +2384,6 @@ "p-limit": "^3.1.0 " } }, - "node_modules/domexception": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/domexception/-/domexception-4.0.0.tgz", - "integrity": "sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw==", - "deprecated": "Use your platform's native DOMException instead", - "dependencies": { - "webidl-conversions": "^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/dracula-prism": { "version": "2.1.16", "resolved": "https://registry.npmjs.org/dracula-prism/-/dracula-prism-2.1.16.tgz", @@ -2444,9 +2442,9 @@ } }, "node_modules/electron": { - "version": "30.0.6", - "resolved": "https://registry.npmjs.org/electron/-/electron-30.0.6.tgz", - "integrity": "sha512-PkhEPFdpYcTzjAO3gMHZ+map7g2+xCrMDedo/L1i0ir2BRXvAB93IkTJX497U6Srb/09r2cFt+k20VPNVCdw3Q==", + "version": "30.0.8", + "resolved": "https://registry.npmjs.org/electron/-/electron-30.0.8.tgz", + "integrity": "sha512-ivzXJJ/9gdb4oOw+5SDuaZpSInz8C+Z021dKZfFLMltKbDa4sSqt5cRBiUg7J36Z2kdus+Jai0bdHWutYE9wAA==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -3275,6 +3273,7 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/gauge/-/gauge-3.0.2.tgz", "integrity": "sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==", + "deprecated": "This package is no longer supported.", "dependencies": { "aproba": "^1.0.3 || ^2.0.0", "color-support": "^1.1.2", @@ -3675,14 +3674,14 @@ "dev": true }, "node_modules/html-encoding-sniffer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz", - "integrity": "sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-4.0.0.tgz", + "integrity": "sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==", "dependencies": { - "whatwg-encoding": "^2.0.0" + "whatwg-encoding": "^3.1.1" }, "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/http-cache-semantics": { @@ -3695,6 +3694,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", + "dev": true, "dependencies": { "@tootallnate/once": "2", "agent-base": "6", @@ -3708,6 +3708,7 @@ "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dev": true, "dependencies": { "debug": "4" }, @@ -4110,39 +4111,37 @@ "dev": true }, "node_modules/jsdom": { - "version": "22.1.0", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-22.1.0.tgz", - "integrity": "sha512-/9AVW7xNbsBv6GfWho4TTNjEo9fe6Zhf9O7s0Fhhr3u+awPwAJMKwAMXnkk5vBxflqLW9hTHX/0cs+P3gW+cQw==", + "version": "23.0.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-23.0.0.tgz", + "integrity": "sha512-cbL/UCtohJguhFC7c2/hgW6BeZCNvP7URQGnx9tSJRYKCdnfbfWOrtuLTMfiB2VxKsx5wPHVsh/J0aBy9lIIhQ==", "dependencies": { - "abab": "^2.0.6", "cssstyle": "^3.0.0", - "data-urls": "^4.0.0", + "data-urls": "^5.0.0", "decimal.js": "^10.4.3", - "domexception": "^4.0.0", "form-data": "^4.0.0", - "html-encoding-sniffer": "^3.0.0", - "http-proxy-agent": "^5.0.0", - "https-proxy-agent": "^5.0.1", + "html-encoding-sniffer": "^4.0.0", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.2", "is-potential-custom-element-name": "^1.0.1", - "nwsapi": "^2.2.4", + "nwsapi": "^2.2.7", "parse5": "^7.1.2", "rrweb-cssom": "^0.6.0", "saxes": "^6.0.0", "symbol-tree": "^3.2.4", - "tough-cookie": "^4.1.2", - "w3c-xmlserializer": "^4.0.0", + "tough-cookie": "^4.1.3", + "w3c-xmlserializer": "^5.0.0", "webidl-conversions": "^7.0.0", - "whatwg-encoding": "^2.0.0", - "whatwg-mimetype": "^3.0.0", - "whatwg-url": "^12.0.1", - "ws": "^8.13.0", - "xml-name-validator": "^4.0.0" + "whatwg-encoding": "^3.1.1", + "whatwg-mimetype": "^4.0.0", + "whatwg-url": "^14.0.0", + "ws": "^8.14.2", + "xml-name-validator": "^5.0.0" }, "engines": { - "node": ">=16" + "node": ">=18" }, "peerDependencies": { - "canvas": "^2.5.0" + "canvas": "^3.0.0" }, "peerDependenciesMeta": { "canvas": { @@ -4151,26 +4150,38 @@ } }, "node_modules/jsdom/node_modules/agent-base": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz", + "integrity": "sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==", "dependencies": { - "debug": "4" + "debug": "^4.3.4" }, "engines": { - "node": ">= 6.0.0" + "node": ">= 14" + } + }, + "node_modules/jsdom/node_modules/http-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" } }, "node_modules/jsdom/node_modules/https-proxy-agent": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", - "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.4.tgz", + "integrity": "sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==", "dependencies": { - "agent-base": "6", + "agent-base": "^7.0.2", "debug": "4" }, "engines": { - "node": ">= 6" + "node": ">= 14" } }, "node_modules/json-buffer": { @@ -4951,6 +4962,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-5.0.1.tgz", "integrity": "sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==", + "deprecated": "This package is no longer supported.", "dependencies": { "are-we-there-yet": "^2.0.0", "console-control-strings": "^1.1.0", @@ -4959,9 +4971,9 @@ } }, "node_modules/nwsapi": { - "version": "2.2.9", - "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.9.tgz", - "integrity": "sha512-2f3F0SEEer8bBu0dsNCFF50N0cTThV1nWFYcEYFZttdW0lDAoybv9cQoK7X7/68Z89S7FoRrVjP1LPX4XRf9vg==" + "version": "2.2.10", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.10.tgz", + "integrity": "sha512-QK0sRs7MKv0tKe1+5uZIQk/C8XGza4DAnztJG8iD+TpJIORARrCxczA738awHrZoHeTjSSoHqao2teO0dC/gFQ==" }, "node_modules/object-assign": { "version": "4.1.1", @@ -6555,9 +6567,9 @@ } }, "node_modules/tough-cookie": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", - "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.4.tgz", + "integrity": "sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag==", "dependencies": { "psl": "^1.1.33", "punycode": "^2.1.1", @@ -6577,14 +6589,14 @@ } }, "node_modules/tr46": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz", - "integrity": "sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-5.0.0.tgz", + "integrity": "sha512-tk2G5R2KRwBd+ZN0zaEXpmzdKyOYksXwywulIX95MBODjSzMIuQnQ3m8JxgbhnL1LeVo7lqQKsYa1O3Htl7K5g==", "dependencies": { - "punycode": "^2.3.0" + "punycode": "^2.3.1" }, "engines": { - "node": ">=14" + "node": ">=18" } }, "node_modules/trim-repeated": { @@ -6707,14 +6719,14 @@ } }, "node_modules/w3c-xmlserializer": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz", - "integrity": "sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz", + "integrity": "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==", "dependencies": { - "xml-name-validator": "^4.0.0" + "xml-name-validator": "^5.0.0" }, "engines": { - "node": ">=14" + "node": ">=18" } }, "node_modules/wcwidth": { @@ -6735,34 +6747,34 @@ } }, "node_modules/whatwg-encoding": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz", - "integrity": "sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz", + "integrity": "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==", "dependencies": { "iconv-lite": "0.6.3" }, "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/whatwg-mimetype": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz", - "integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz", + "integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==", "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/whatwg-url": { - "version": "12.0.1", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-12.0.1.tgz", - "integrity": "sha512-Ed/LrqB8EPlGxjS+TrsXcpUond1mhccS3pchLhzSgPCnTimUCKj3IZE75pAs5m6heB2U2TMerKFUXheyHY+VDQ==", + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.0.0.tgz", + "integrity": "sha512-1lfMEm2IEr7RIV+f4lUNPOqfFL+pO+Xw3fJSqmjX9AbXcXcYOkCe1P6+9VBZB6n94af16NfZf+sSk0JCBZC9aw==", "dependencies": { - "tr46": "^4.1.1", + "tr46": "^5.0.0", "webidl-conversions": "^7.0.0" }, "engines": { - "node": ">=14" + "node": ">=18" } }, "node_modules/which": { @@ -6937,9 +6949,9 @@ "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" }, "node_modules/ws": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", - "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.0.tgz", + "integrity": "sha512-uJq6108EgZMAl20KagGkzCKfMEjxmKvZHG7Tlq0Z6nOky7YF7aq4mOx6xK8TJ/i1LeK4Qus7INktacctDgY8Ow==", "engines": { "node": ">=10.0.0" }, @@ -6957,11 +6969,11 @@ } }, "node_modules/xml-name-validator": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz", - "integrity": "sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", + "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==", "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/xmlbuilder": { diff --git a/package.json b/package.json index 2534e89..c87f5a3 100644 --- a/package.json +++ b/package.json @@ -25,10 +25,11 @@ "@electron-forge/cli": "^7.4.0", "@electron-forge/maker-deb": "^7.4.0", "@electron/rebuild": "^3.6.0", - "electron": "^30.0.6" + "electron": "^30.0.8" }, "dependencies": { - "@blockly/field-slider": "^6.1.10", + "@blockly/field-colour": "^5.0.0", + "@blockly/field-slider": "^7.0.0", "@ocoge/amg8833": "file:local_modules/amg8833", "@ocoge/bme280": "file:local_modules/bme280", "@ocoge/paj7620": "file:local_modules/paj7620", @@ -39,8 +40,8 @@ "@tensorflow-models/mobilenet": "^2.1.1", "@tensorflow-models/speech-commands": "^0.5.4", "@tensorflow/tfjs-node": "^4.19.0", - "axios": "^1.7.0", - "blockly": "^10.4.3", + "axios": "^1.7.2", + "blockly": "^11.0.0", "canvas": "github:Automattic/node-canvas", "dracula-prism": "^2.1.16", "js-beautify": "^1.15.1",