2024-02-13 16:17:54 +00:00
|
|
|
import{S as ft}from"./index.c93dfeeb.js";import{e as _t,q as gt,_ as wt}from"./index.0a4db677.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{d as bt,r as Ft,o as yt,bp as ht,bY as xt,bU as St,aU as Ct,bB as Dt,bN as At,bC as Et,C as g,D as x,aI as u,aH as l,u as Bt,aM as m,aN as S,bw as et,G as ot,bx as nt,aK as D,aJ as A,aE as E,n as st,ba as Vt,bX as vt,aZ as Tt,b8 as Pt,bZ as kt,bD as It,bM as Ut}from"./arco.beabb834.js";import{e as I,g as ut,h as i,f as c,s as Ot}from"./serial.b70f48dc.js";import{u as Nt}from"./loading.04079284.js";import"./chart.83b8c11b.js";import"./vue.30c84055.js";const Mt={class:"container"},Ht=["innerHTML"],Yt={name:"Sat"},Lt=bt({...Yt,setup(qt){const{loading:rt,setLoading:_}=Nt(!0),e=_t(),t=Ft({showh:0,status:"\u70B9\u51FB\u5199\u5165\u6309\u94AE\u5199\u5165\u536B\u661F\u6570\u636E\u5230\u8BBE\u5907<br/><br/>",sat:"",satData:[],lng:0,lat:0,alt:0,tx:0,rx:0,txTone:0,rxTone:0,CTCSSOption:[67,69.3,71.9,74.4,77,79.7,82.5,85.4,88.5,91.5,94.8,97.4,100,103.5,107.2,110.9,114.8,118.8,123,127.3,131.8,136.5,141.3,146.2,151.4,156.7,159.8,162.2,165.5,167.9,171.3,173.8,177.3,179.9,183.5,186.2,189.9,192.8,196.6,199.5,203.5,206.5,210.7,218.1,225.7,229.1,233.6,241.8,250.3,254.1],pass:void 0,passOption:[],dt:"",timer:void 0,passCustom:void 0,dtCustom:void 0,freqDb:[]});yt(async()=>{const r=await(await fetch("https://mirror.ghproxy.com/https://raw.githubusercontent.com/palewire/ham-satellite-database/main/data/amsat-active-frequencies.json")).text();t.freqDb=JSON.parse(r),t.timer=setInterval(()=>{t.dt=new Date().toLocaleString("zh-CN",{timeZone:"Asia/Shanghai"})},1e3)}),ht(()=>{try{clearInterval(t.timer)}catch{}});const lt=()=>{t.showh+=1},it=async()=>{if(e.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}_(!0),await I(e.connectPort),await U(),await ut(e.connectPort),_(!1)},U=async()=>{var n;const r=t.dtCustom?new Date(t.dtCustom):new Date,o=[...i(parseInt(r.getFullYear().toString().substring(2,4)).toString(16)),...i((r.getMonth()+1).toString(16)),...i(r.getDate().toString(16)),...i(r.getHours().toString(16)),...i(r.getMinutes().toString(16)),...i(r.getSeconds().toString(16))];await c(e.connectPort,11200,new Uint8Array(o),6,(n=e.configuration)==null?void 0:n.uart)},pt=async r=>{const o=t.satData.find(n=>n.name==r);if(o&&o.path){t.status+="<br/>\u536B\u661F\u53C2\u6570\uFF1A<br/>",o.path.map(a=>{t.status+=a+"<br/>"});let n=!1;t.freqDb.map(a=>{o.path[1].split(" ")[1]==a.norad_id&&a.mode.indexOf("FM")!=-1&&(console.log(a),n=!0,t.tx=a.uplink?parseFloat(a.uplink.split("/")[0]):0,t.rx=a.downlink?parseFloat(a.downlink.split("/")[0]):0,t.txTone=parseFloat([0,...t.CTCSSOption].reduce((d,y)=>a.mode.indexOf(y)!=-1?y:d)))}),n||(t.tx=0,t.rx=0,t.txTone=0,t.rxTone=0)}st(()=>{const n=document==null?void 0:document.getElementById("statusArea");n&&(n.scrollTop=n==null?void 0:n.scrollHeight)})};(async()=>{_(!0);const o=(await(await fetch("https://celestrak.org/NORAD/elements/amateur.txt")).text()).split(/\r?\n/),n=[];let a={};for(let d=0;d<o.length;d++)Number.isNaN(parseInt(o[d].substring(0,1)))?(a.name&&a.name!=""&&(n.push(a),a={}),a.name=o[d]):(a.path||(a.path=[]),a.path.push(o[d]));t.satData=n,_(!1)})();const O=async()=>{_(!0),navigator.geolocation.getCurrentPosition(r=>{r.coords&&(t.lat=r.coords.latitude,t.lng=r.coords.longitude,r.coords.altitude&&(t.alt=r.coords.altitude))}),_(!1)};O();const ct=async(r=0,o)=>{var n;await I(e.connectPort);for(let a=r;a<o.length+r;a+=128)await c(e.connectPort,a,o.slice(a-r,a-r+128),128,(n=e.configuration)==null?void 0:n.uart),t.status=t.status+"\u5199\u5165\u8FDB\u5EA6\uFF1A"+((a-r)/o.length*100).toFixed(1)+"%<br/>",st(()=>{const d=document==null?void 0:document.getElementById("statusArea");d&&(d.scrollTop=d==null?void 0:d.scrollHeight)});t.status=t.status+"\u5199\u5165\u8FDB\u5EA6\uFF1A100.0%<br/>"},dt=async()=>{if(!t.s
|