This commit is contained in:
Silent YANG 2024-02-15 22:48:52 +08:00
parent e25caab2a6
commit 96e2eccf5d
2 changed files with 19 additions and 2 deletions

BIN
public/pinyin_plus.bin Normal file

Binary file not shown.

View file

@ -3,12 +3,13 @@
<Breadcrumb :items="['小工具', '字库写入']" />
<a-row :gutter="20" align="stretch">
<a-col :span="24">
<a-card class="general-card" title="字库写入">
<a-card class="general-card" title="字库写入" @click="()=>{state.showHide += 1}">
<a-space>
<a-button @click="restore(1)">写入 117 字库</a-button>
<a-button @click="restore(2)">写入 118+ 字库</a-button>
<!-- <a-button @click="restore(3)">写入 118+ 字库H</a-button> -->
<a-button @click="restore(4)">写入拼音检索表2Mbit EEPROM可用</a-button>
<a-button v-show="state.showHide >= 5" @click="restore(5)">写入拼音检索表测试</a-button>
</a-space>
<a-divider />
<div id="statusArea" style="height: 20em; background-color: azure; color: silver; overflow: auto; padding: 20px" v-html="state.status"></div>
@ -27,7 +28,8 @@ const appStore = useAppStore();
const state = reactive({
status: "点击写入按钮写入字库到设备<br/><br/>",
eepromType: ""
eepromType: "",
showHide: 0
})
const restoreRange = async (start: any = 0, uint8Array: any) => {
@ -120,6 +122,21 @@ const restore = async(type: any = 1) => {
await restoreRange(0x20000, binary)
return;
}
if(type == 5){
fontPacket = await fetch('/pinyin_plus.bin')
const reader = fontPacket.body.getReader();
const chunks = [];
while(true) {
const {done, value} = await reader.read();
if (done) {
break;
}
chunks.push(...value)
}
const binary = new Uint8Array(chunks)
await restoreRange(0x20000, binary)
return;
}
}
</script>