k5web/assets/index.b26fa0f8.js

2 lines
7.2 KiB
JavaScript
Raw Normal View History

2024-06-30 16:02:08 +00:00
import{m as K,ak as j,_ as G}from"./index.c495c8f7.js";/* empty css *//* empty css *//* empty css */import{d as W,r as Z,o as q,bI as Q,C as f,D as E,aI as c,aH as i,aM as m,aN as h,G as d,aK as x,aJ as S,F as D,aE as X,u as Y,a6 as ee,a$ as te,ba as oe,bJ as ae,bL as ne,be as re,bf as le,n as se}from"./arco.7f845a67.js";import{u as ie}from"./loading.1a4e75f4.js";import{i as ce,e as ue,s as M,h as N,g as de,l as pe,b as me}from"./serial.c741fbda.js";import{B as _e}from"./index.8fc67858.js";import{I as ge}from"./index.3ce56434.js";import{C as fe}from"./index.ce3daa1c.js";import{S as he}from"./index.4487c2e9.js";import"./chart.3e6cb2f1.js";import"./vue.0bef8fc5.js";import"./useConfig.82d85255.js";import"./index.fa7d6f5c.js";import"./helper.7839fdda.js";import"./useDisabled.f522e3a3.js";import"./useGlobalIcon.5d09fd23.js";import"./slot.0af0ea26.js";const B=F=>(re("data-v-46560f86"),F=F(),le(),F),Fe={class:"container"},be=B(()=>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=B(()=>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=B(()=>d("br",null,null,-1)),Be=["innerHTML"],ke={name:"BL"},xe=W({...ke,setup(F){const p=K(),{loading:U,setLoading:b}=ie(!0),t=Z({calendar:[],rom:[],bl:void 0,nowDrag:-1,showAdd:"",status:""}),_=async(e=0,o,n="")=>{var s;for(let r=e;r<o.length+e;r+=192)await me(p.connectPort,r,o.slice(r-e,r-e+192),o.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)/o.length*100).toFixed(1)+"%<br/>",se(()=>{const a=document==null?void 0:document.getElementById("statusArea");a&&(a.scrollTop=a==null?void 0:a.scrollHeight)})},$=async e=>{t.showAdd=(e*64+262144).toString(16).toUpperCase(),setTimeout(()=>{t.showAdd=""},5e3)};q(()=>{L();const e=[];for(let o=0;o<262144/64;o++)o<278528/64/16-16?e.push(-2):e.push(-1);t.calendar=e});const L=async()=>{const e=await fetch("/L_BL001.bin");if(e.body){const o=e.body.getReader(),n=[];for(;;){const{done:r,value:a}=await o.read();if(r)break;n.push(...a)}let s=new Uint8Array(12288);s.set(n,0),t.bl=s,b(!1)}},I=async()=>{var r;if(p.connectState!=!0){alert(sessionStorage.getItem("noticeConnectK5"));return}const e=await ce(p.connectPort,(r=p.configuration)==null?void 0:r.uart);if(b(!0),e<524288){alert("\u53EA\u652F\u6301 4Mbit \u4EE5\u4E0A EEPROM \u5199\u5165"),b(!1);return}await ue(p.connectPort),await _(266240,t.bl,"\u5F15\u5BFC\u7A0B\u5E8F");const o=[];for(let a=256;a<4096;a++)t.calendar[a]>=0&&(console.log(a),o.push({...t.rom[t.calendar[a]],start:262144+a*64,end:262144+(a+Math.ceil(t.rom[t.calendar[a]].binaryFile.length/64))*64-1}),a+=Math.ceil(t.rom[t.calendar[a]].binaryFile.length/64)-1);await _(262144,new Uint8Array([o.length]),"\u56FA\u4EF6\u6570\u91CF");const n=new Uint8Array(8);n.set(M("L_BL001")),await _(262152,n,"\u5F15\u5BFC\u7A0B\u5E8F\u7248\u672C");const s=[];o.map(a=>{const w=new Uint8Array(16),y=new Uint8Array(4),A=new Uint8Array(4);w.set(M(a.binaryName)),y.set(N(a.start.toString(16))),A.set(N(a.end.toString(16))),s.push(...w,...y,...A,...new Uint8Array(8))}),await _(262176,s,"\u56FA\u4EF6\u5143\u6570\u636E");for(let a=0;a<o.length;a++)await _(o[a].start,o[a].binaryFile,o[a].binaryName+" \u56FA\u4EF6\u6587\u4EF6");await de(p.connectPort),b(!1)},P=()=>{const e=document.createElement("input");e.type="file",e.onchange=async()=>{if(e.files){const o=new Blob([e.files[0]],{type:"application/octet-stream"}),n=new Uint8Array(await o.arrayBuffer()),s={binaryFile:pe(n),binaryName:e.files[0].name,color:T()};t.rom.push(s)}},e.click()},R=(e,o)=>{if(!(o<256)&&!(o+Math.ceil(t.rom[t.nowDrag].binaryFile.length/64