k5web/assets/index.4a80b428.js

2 lines
5.4 KiB
JavaScript
Raw Normal View History

2024-02-25 08:33:34 +00:00
import{e as S,q as I,_ as M}from"./index.fc1ffc8e.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{d as R,r as P,bU as V,bV as H,bC as U,C as O,D as L,aI as t,aH as e,aM as l,bw as K,bx as z,G as N,aZ as j,b8 as q,bW as G,b5 as W,bX as X,bA as Z,bD as J,bM as Q,n as B}from"./arco.4738edf2.js";import{m as Y,e as D,a as $,b as tt,g as et}from"./serial.a589823e.js";import"./chart.a6be8b1c.js";import"./vue.202e581b.js";const ut={class:"container"},at=["innerHTML"],ot={name:"Backup"},nt=R({...ot,setup(ct){const n=S(),o=P({status:"\u70B9\u51FB\u5907\u4EFD\u6309\u94AE\u5C06\u751F\u6210 EEPROM \u5907\u4EFD\u6587\u4EF6<br/><br/>",eepromType:"",showHide:0,startInfo:"0x00"}),y=async()=>{if(n.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}await Y()},m=async(u,a,d=new Date+"_backup.bin")=>{var F;await D(n.connectPort);let c=new Uint8Array(a-u);for(let r=u;r<a;r+=128){const b=await $(n.connectPort,r,128,(F=n.configuration)==null?void 0:F.uart);c.set(b,r-u),o.status=o.status+"\u5907\u4EFD\u8FDB\u5EA6\uFF1A"+((r-u)/c.length*100).toFixed(1)+"%<br/>",B(()=>{const _=document==null?void 0:document.getElementById("statusArea");_&&(_.scrollTop=_==null?void 0:_.scrollHeight)})}o.status=o.status+"\u5907\u4EFD\u8FDB\u5EA6\uFF1A100.0%<br/>",B(()=>{const r=document==null?void 0:document.getElementById("statusArea");r&&(r.scrollTop=r==null?void 0:r.scrollHeight)}),console.log(c);const p=new Blob([c],{type:"application/octet-stream"}),i=URL.createObjectURL(p),s=document.createElement("a");s.href=i,s.download=d,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(i)},f=async(u=0)=>{await D(n.connectPort);const a=document.createElement("input");a.type="file",a.onchange=async()=>{var p;const d=new Blob([a.files[0]],{type:"application/octet-stream"}),c=new Uint8Array(await d.arrayBuffer());for(let i=u;i<a.files[0].size+u;i+=128)await tt(n.connectPort,i,c.slice(i-u,i-u+128),128,(p=n.configuration)==null?void 0:p.uart),o.status=o.status+"\u6062\u590D\u8FDB\u5EA6\uFF1A"+((i-u)/a.files[0].size*100).toFixed(1)+"%<br/>",B(()=>{const s=document==null?void 0:document.getElementById("statusArea");s&&(s.scrollTop=s==null?void 0:s.scrollHeight)});o.status=o.status+"\u6062\u590D\u8FDB\u5EA6\uFF1A100.0%<br/>",await et(n.connectPort)},a.click()},w=async()=>{if(n.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}await m(0,7680,"config.bin")},k=async()=>{if(n.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}await m(7680,8192,"calibration.bin")},A=async()=>{if(n.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}await f()},C=async()=>{if(n.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}await f(7680)},g=async()=>{var a;if(n.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}let u=8192;switch(o.eepromType){case"1":u=8192;break;case"2":u=131072;break;case"3":u=262144;break;case"4":u=524288;break;default:u=8192}if(((a=n.configuration)==null?void 0:a.uart)=="official"&&u>=131072){alert("\u8BE5\u56FA\u4EF6\u4E0D\u652F\u6301\u5907\u4EFD\u6269\u5BB9\u7A7A\u95F4");return}await m(0,u)},h=async()=>{if(n.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}await f(parseInt(o.startInfo))};return(u,a)=>{const d=I,c=j,p=q,i=G,s=W,F=X,r=V,b=H,_=Z,v=U,x=J,T=Q;return O(),L("div",ut,[t(d,{items:["\u5C0F\u5DE5\u5177","\u5907\u4EFD/\u8FD8\u539F"]}),t(T,{gutter:20,align:"stretch"},{default:e(()=>[t(x,{span:24},{default:e(()=>[t(v,{class:"general-card",title:"\u5907\u4EFD/\u8FD8\u539F",onClick:a[2]||(a[2]=()=>{o.showHide+=1})},{default:e(()=>[t(b,{"default-active-key":"1"},{default:e(()=>[t(i,{key:"1",title:"\u5FEB\u6377\u5907\u4EFD"},{default:e(()=>[t(p,null,{default:e(()=>[t(c,{type:"primary",onClick:w},{default:e(()=>[l("\u5907\u4EFD\u914D\u7F6E")]),