2024-06-04 08:40:39 +00:00
|
|
|
import{e as O,as as z,_ as L}from"./index.be7548bc.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{d as N,r as j,bS as q,bT as G,bH as J,C as Q,D as W,aI as o,aH as n,G as C,aN as p,aM as d,bn as X,bo as Y,n as _,a$ as Z,ba as x,bU as tt,b7 as et,bV as ot,bF as at,bI as nt,bL as rt}from"./arco.f43727df.js";import{i as E,b as F,g as h,e as S,a as st}from"./serial.c741fbda.js";import{D as it}from"./index.ba2d40cd.js";import"./chart.3c227ebb.js";import"./vue.cbdb927d.js";import"./dialog.0bb731aa.js";import"./index.cb9ab5ba.js";import"./index.fae7550d.js";const lt={class:"container"},ct=["innerHTML"],ut={name:"Backup"},pt=N({...ut,setup(dt){const r=O(),e=j({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}),T=()=>{if(e.dialogTitle>=3){e.showDialog=!1,A();return}e.dialogTitle+=1},$=()=>{e.dialogTitle=1,e.showDialog=!0},D=async()=>{var a;if(r.connectState!=!0){alert(sessionStorage.getItem("noticeConnectK5"));return}switch(await E(r.connectPort,(a=r.configuration)==null?void 0:a.uart)){case 8192:e.eepromType="1";break;case 131072:e.eepromType="2";break;case 262144:e.eepromType="3";break;case 524288:e.eepromType="4";break}},A=async()=>{var m,i;if(r.connectState!=!0){alert(sessionStorage.getItem("noticeConnectK5"));return}const t=await E(r.connectPort,(m=r.configuration)==null?void 0:m.uart);let a=new Uint8Array(128);for(let l=0;l<t;l+=128)await F(r.connectPort,l,a,128,(i=r.configuration)==null?void 0:i.uart),e.status=e.status+"\u6E05\u7A7A\u8FDB\u5EA6\uFF1A"+((l-0)/t*100).toFixed(1)+"%<br/>",_(()=>{const s=document==null?void 0:document.getElementById("statusArea");s&&(s.scrollTop=s==null?void 0:s.scrollHeight)});await h(r.connectPort)},y=async(t,a,m=new Date+"_backup.bin")=>{var f;await S(r.connectPort);let i=new Uint8Array(a-t);for(let u=t;u<a;u+=128){const w=await st(r.connectPort,u,128,(f=r.configuration)==null?void 0:f.uart);i.set(w,u-t),e.status=e.status+"\u5907\u4EFD\u8FDB\u5EA6\uFF1A"+((u-t)/i.length*100).toFixed(1)+"%<br/>",_(()=>{const b=document==null?void 0:document.getElementById("statusArea");b&&(b.scrollTop=b==null?void 0:b.scrollHeight)})}e.status=e.status+"\u5907\u4EFD\u8FDB\u5EA6\uFF1A100.0%<br/>",_(()=>{const u=document==null?void 0:document.getElementById("statusArea");u&&(u.scrollTop=u==null?void 0:u.scrollHeight)}),console.log(i);const l=new Blob([i],{type:"application/octet-stream"}),s=URL.createObjectURL(l),c=document.createElement("a");c.href=s,c.download=m,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(s)},k=async(t=0)=>{await S(r.connectPort);const a=document.createElement("input");a.type="file",a.onchange=async()=>{var l;const m=new Blob([a.files[0]],{type:"application/octet-stream"}),i=new Uint8Array(await m.arrayBuffer());for(let s=t;s<a.files[0].size+t;s+=128)await F(r.connectPort,s,i.slice(s-t,s-t+128),128,(l=r.configuration)==null?void 0:l.uart),e.status=e.status+"\u6062\u590D\u8FDB\u5EA6\uFF1A"+((s-t)/a.files[0].size*100).toFixed(1)+"%<br/>",_(()=>{const c=document==null?void 0:document.getElementById("statusArea");c&&(c.scrollTop=c==null?void 0:c.scrollHeight)});e.status=e.status+"\u6062\u590D\u8FDB\u5EA6\uFF1A100.0%<br/>",await h(r.connectPort)},a.click()},B=async()=>{if(r.connectState!=!0){alert(sessionStorage.getItem("noticeConnectK5"));return}await y(0,7680,"config.bin")},v=async()=>{if(r.connectState!=!0){alert(sessionStorage.getItem("noticeConnectK5"));return}await y(7680,8192,"calibration.bin")},I=async()=>{if(r.connectState!=!0){alert(sessionStorage.getItem("noticeConnectK5"));return}await k()},P=async()=>{if(r.connectState!=!0){alert(sessionStorage.getItem("noticeConnectK5"));return}await k(7680)},R=async()=>{var a;if(r.connectState!=!0){alert(sessionStorage.getItem("noticeConnectK5"));return}let t=8192;switch(e.eepromType){case"1"
|