From 5aa4f35f17c974993bbcca18ec3b7820d7ced743 Mon Sep 17 00:00:00 2001 From: Silent YANG Date: Wed, 6 Nov 2024 02:55:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8F=A1=E6=89=8B=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/navbar/index.vue | 12 ++++++++++-- src/locale/en-US.ts | 3 ++- src/locale/zh-CN.ts | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/components/navbar/index.vue b/src/components/navbar/index.vue index 465f52a..38b7a24 100644 --- a/src/components/navbar/index.vue +++ b/src/components/navbar/index.vue @@ -272,6 +272,7 @@ alert(t('global.connectFail')); return; } + appStore.updateSettings({ connectPort: _connect }); const driversList : any = {}; @@ -280,8 +281,15 @@ }) let _configuration = null; - - const version = await eeprom_init(_connect); + let version = ""; + try{ + version = await eeprom_init(_connect); + }catch{ + await disconnect(_connect); + appStore.updateSettings({ connectState: false, connectPort: null, firmwareVersion: "" }); + alert(t('global.handshakeFail')); + throw new Error(t('global.handshakeFail')); + } const config = { "name": "TODO", "uart": "official", diff --git a/src/locale/en-US.ts b/src/locale/en-US.ts index 67198a0..aab60df 100644 --- a/src/locale/en-US.ts +++ b/src/locale/en-US.ts @@ -140,7 +140,8 @@ export default { 'tool.scannotice': 'Uploaded location information will be cached by the server for 10 minutes', 'tool.scaned': 'Scanned and uploaded', 'global.nosupport': 'Current browser does not support WebSerial function, please use Chrome, Edge, Opera browser.', - 'global.connectFail': 'Connect Fail', + 'global.connectFail': 'Connect Failure', + 'global.handshakeFail': 'Handshake Failure', 'menu.workshop': 'Workshop', 'menu.firmware': 'Firmware Store', 'menu.channel': 'Channel Share', diff --git a/src/locale/zh-CN.ts b/src/locale/zh-CN.ts index d3a9ea1..8575574 100644 --- a/src/locale/zh-CN.ts +++ b/src/locale/zh-CN.ts @@ -141,6 +141,7 @@ export default { 'tool.scaned': '已扫码上传', 'global.nosupport': '当前浏览器不支持网页串口功能,请使用 Chrome, Edge, Opera 浏览器。', 'global.connectFail': '连接失败', + 'global.handshakeFail': '握手失败', 'menu.workshop': '创意工坊', 'menu.firmware': '固件市场', 'menu.channel': '信道分享',