2024-08-04 06:03:13 +00:00
|
|
|
import{s as j,ac as J,N as G,_ as W}from"./index.413febc1.js";/* empty css *//* empty css *//* empty css */import{d as q,r as Q,o as X,bI as Y,C as h,D as E,aI as c,aH as i,aM as m,aN as b,G as d,aK as B,aJ as S,F as N,aE as Z,u as ee,a6 as te,b8 as ae,bi as oe,bK as ne,bO as re,bm as le,bn as se,n as ie}from"./arco.76adc92f.js";import{u as ce}from"./loading.e4b365a7.js";import{i as ue,e as de,s as D,h as M,g as pe,l as me,b as fe}from"./serial.c6b76da8.js";import{I as _e}from"./index.d49b744e.js";import{C as ge}from"./index.270b65f5.js";import{S as he}from"./index.43e2a6eb.js";import"./chart.d41e8c5b.js";import"./vue.107cc2d0.js";import"./slot.c1690aae.js";const x=F=>(le("data-v-d023f8fd"),F=F(),se(),F),be={class:"container"},Fe=x(()=>d("div",{style:{color:"red","font-weight":"bold"}},"\u26A0\uFF1A\u5B9E\u9A8C\u6027\u529F\u80FD \u4F7F\u7528\u53EF\u80FD\u4F1A\u635F\u574F\u624B\u53F0",-1)),we={style:{display:"flex","justify-content":"space-between","margin-left":"10px","margin-right":"10px","align-items":"flex-end","margin-bottom":"3px"}},ye=x(()=>d("div",null,"EEPROM\uFF1A",-1)),Ae={style:{width:"100%",overflow:"scroll","user-select":"none"}},Ee={style:{height:"328px",display:"flex","flex-direction":"column",margin:"0",padding:"0","flex-wrap":"wrap"}},ve=["onClick","ondragover","ondrop","title"],Ce=x(()=>d("br",null,null,-1)),xe=["innerHTML"],ke={name:"BL"},Be=q({...ke,setup(F){const p=j(),{loading:U,setLoading:w}=ce(!0),t=Q({calendar:[],rom:[],bl:void 0,blName:"",nowDrag:-1,showAdd:"",status:""}),_=async(e=0,a,n="")=>{var s;for(let r=e;r<a.length+e;r+=192)await fe(p.connectPort,r,a.slice(r-e,r-e+192),a.slice(r-e,r-e+192).length,(s=p.configuration)==null?void 0:s.uart),t.status=t.status+n+"\u5199\u5165\u8FDB\u5EA6\uFF1A"+((r-e)/a.length*100).toFixed(1)+"%<br/>",ie(()=>{const o=document==null?void 0:document.getElementById("statusArea");o&&(o.scrollTop=o==null?void 0:o.scrollHeight)})},$=async e=>{t.showAdd=(e*64+262144).toString(16).toUpperCase(),setTimeout(()=>{t.showAdd=""},5e3)};X(()=>{I();const e=[];for(let a=0;a<262144/64;a++)a<278528/64/16-16?e.push(-2):e.push(-1);t.calendar=e});const I=async()=>{const e=JSON.parse(await(await fetch("https://k6.vicicode.cn/diyapi/bl.json")).text()).latest;t.blName=e;const a=await fetch("https://k6.vicicode.cn/diyapi/"+e);if(a.body){const n=a.body.getReader(),s=[];for(;;){const{done:o,value:f}=await n.read();if(o)break;s.push(...f)}let r=new Uint8Array(12288);r.set(s,0),t.bl=r,w(!1)}},P=async()=>{var r;if(p.connectState!=!0){alert(sessionStorage.getItem("noticeConnectK5"));return}const e=await ue(p.connectPort,(r=p.configuration)==null?void 0:r.uart);if(w(!0),e<524288){alert("\u53EA\u652F\u6301 4Mbit \u4EE5\u4E0A EEPROM \u5199\u5165"),w(!1);return}await de(p.connectPort),await _(266240,t.bl,"\u5F15\u5BFC\u7A0B\u5E8F");const a=[];for(let o=256;o<4096;o++)t.calendar[o]>=0&&(console.log(o),a.push({...t.rom[t.calendar[o]],start:262144+o*64,end:262144+(o+Math.ceil(t.rom[t.calendar[o]].binaryFile.length/64))*64-1}),o+=Math.ceil(t.rom[t.calendar[o]].binaryFile.length/64)-1);await _(262144,new Uint8Array([a.length]),"\u56FA\u4EF6\u6570\u91CF");const n=new Uint8Array(8);n.set(D(t.blName.split(".")[0])),await _(262152,n,"\u5F15\u5BFC\u7A0B\u5E8F\u7248\u672C");const s=[];a.map(o=>{const f=new Uint8Array(16),y=new Uint8Array(4),A=new Uint8Array(4);f.set(D(o.binaryName.replace(/[^\x00-\xff]/g,""))),y.set(M(o.start.toString(16))),A.set(M(o.end.toString(16))),s.push(...f,...y,...A,...new Uint8Array(8))}),await _(262176,s,"\u56FA\u4EF6\u5143\u6570\u636E");for(let o=0;o<a.length;o++)await _(a[o].start,a[o].binaryFile,a[o].binaryName+" \u56FA\u4EF6\u6587\u4EF6");await pe(p.connectPort),t.status=t.status+"\u5199\u5165\u5B8C\u6210<br/>",w(!1)},R=()=>{const e=document.createElement("input");e.type="file",e.multiple=!0,e.onchange=async()=>{if(e.files)for(let a=0;a<e.files.length;a++){const n=new Blob([e.files[a]],{type:"application/octet-stream"}),s=new Uint8Array(await n.arrayBuffer()),r={binaryFile:me(s),binaryName:e.files[a].name.replace(/[^\x00-\xff]/g,""),col
|