k5web/assets/index.077a571d.js

6 lines
7.2 KiB
JavaScript
Raw Normal View History

2024-05-12 04:01:49 +00:00
import{e as V,s as z,_ as L}from"./index.8ffc240e.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{d as K,r as N,bP as j,bQ as G,bD as J,C as Q,D as $,aI as e,aH as o,G as D,aM as F,bo as q,bp as W,n as f,a_ as X,b9 as Y,bR as Z,b6 as tt,bS as et,bB as ut,bE as ot,bJ as at}from"./arco.02de294f.js";import{i as y,b as g,g as w,e as A,a as nt}from"./serial.c741fbda.js";import{_ as rt}from"./dialog.b592eae7.js";import{w as it}from"./tnode.17829577.js";import"./chart.61cd37ef.js";import"./vue.4e4c1473.js";import"./dep-281dbb92.a51c1523.js";import"./index.37837b88.js";import"./index.ac0c285d.js";import"./useDisabled.ae969762.js";/**
2024-05-11 08:52:12 +00:00
* tdesign v1.9.4
* (c) 2024 tdesign
* @license MIT
2024-05-12 03:43:06 +00:00
*/var st=it(rt);const ct={class:"container"},lt=["innerHTML"],Ft={name:"Backup"},pt=K({...Ft,setup(dt){const a=V(),t=N({status:"\u70B9\u51FB\u5907\u4EFD\u6309\u94AE\u5C06\u751F\u6210 EEPROM \u5907\u4EFD\u6587\u4EF6<br/><br/>",eepromType:"",showHide:0,startInfo:"0x00",showDialog:!1,dialogTitle:1}),C=()=>{if(t.dialogTitle>=3){t.showDialog=!1,T();return}t.dialogTitle+=1},k=()=>{t.dialogTitle=1,t.showDialog=!0},h=async()=>{var u;if(a.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}switch(await y(a.connectPort,(u=a.configuration)==null?void 0:u.uart)){case 8192:t.eepromType="1";break;case 131072:t.eepromType="2";break;case 262144:t.eepromType="3";break;case 524288:t.eepromType="4";break}},T=async()=>{var p,i;if(a.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}const n=await y(a.connectPort,(p=a.configuration)==null?void 0:p.uart);let u=new Uint8Array(128);for(let s=0;s<n;s+=128)await g(a.connectPort,s,u,128,(i=a.configuration)==null?void 0:i.uart),t.status=t.status+"\u6E05\u7A7A\u8FDB\u5EA6\uFF1A"+((s-0)/n*100).toFixed(1)+"%<br/>",f(()=>{const r=document==null?void 0:document.getElementById("statusArea");r&&(r.scrollTop=r==null?void 0:r.scrollHeight)});await w(a.connectPort)},E=async(n,u,p=new Date+"_backup.bin")=>{var d;await A(a.connectPort);let i=new Uint8Array(u-n);for(let l=n;l<u;l+=128){const B=await nt(a.connectPort,l,128,(d=a.configuration)==null?void 0:d.uart);i.set(B,l-n),t.status=t.status+"\u5907\u4EFD\u8FDB\u5EA6\uFF1A"+((l-n)/i.length*100).toFixed(1)+"%<br/>",f(()=>{const _=document==null?void 0:document.getElementById("statusArea");_&&(_.scrollTop=_==null?void 0:_.scrollHeight)})}t.status=t.status+"\u5907\u4EFD\u8FDB\u5EA6\uFF1A100.0%<br/>",f(()=>{const l=document==null?void 0:document.getElementById("statusArea");l&&(l.scrollTop=l==null?void 0:l.scrollHeight)}),console.log(i);const s=new Blob([i],{type:"application/octet-stream"}),r=URL.createObjectURL(s),c=document.createElement("a");c.href=r,c.download=p,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(r)},b=async(n=0)=>{await A(a.connectPort);const u=document.createElement("input");u.type="file",u.onchange=async()=>{var s;const p=new Blob([u.files[0]],{type:"application/octet-stream"}),i=new Uint8Array(await p.arrayBuffer());for(let r=n;r<u.files[0].size+n;r+=128)await g(a.connectPort,r,i.slice(r-n,r-n+128),128,(s=a.configuration)==null?void 0:s.uart),t.status=t.status+"\u6062\u590D\u8FDB\u5EA6\uFF1A"+((r-n)/u.files[0].size*100).toFixed(1)+"%<br/>",f(()=>{const c=document==null?void 0:document.getElementById("statusArea");c&&(c.scrollTop=c==null?void 0:c.scrollHeight)});t.status=t.status+"\u6062\u590D\u8FDB\u5EA6\uFF1A100.0%<br/>",await w(a.connectPort)},u.click()},v=async()=>{if(a.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}await E(0,7680,"config.bin")},P=async()=>{if(a.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}await E(7680,8192,"calibration.bin")},S=async()=>{if(a.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}await b()},R=async()=>{if(a.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}await b(7680)},x=async()=>{var u;if(a.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}let n=8192;switch(t.eepromType){case"1":n=8192;break;case"2":n=131072;break;case"3":n=262144;break;case"4":n=524288;break;default:n=8192}if(((u=a.configuration)==null?void 0:u.uart)=="official"&&n>=131072){alert("\u8BE5\u56FA\u4EF6\u4E0D\u652F\u6301\u5907\u4EFD\u6269\u5BB9\u7A7A\u95F4");return}await E(0,n)},I=async()=>{if(a.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}await b(parseInt(t.startInfo))};return(n,u)=>{const p=z,i=X,s=Y,r=Z,c=tt,d=et,l=j,B=G,_=ut,M=J,H=ot,O=at,U=st;return Q(),$("div",ct,[e(p,{items:["\u5C0F\u5DE5\u5177","\u5907\u4EFD/\u8FD8\u539F"]}),e(O,{gutter:20,align:"stretch"},{default:o(()=>[e(H,{span:24},{default:o(()=>[e(M,{class:"general-card"},{title:o(()=>[D("span",{onClick:u[0]||(u[0]=()