added Serial Change and BirdyWP-r3 support

master
cheetah 2 years ago
parent fbf868b2f0
commit 208e26929c

@ -19,7 +19,7 @@
<v-img src="birdytiger.png" max-width="48px" max-height="48px"></v-img> <v-img src="birdytiger.png" max-width="48px" max-height="48px"></v-img>
<v-toolbar-title> <v-toolbar-title>
<b>Birdy Flash Tools 2.0</b> <b>Birdy Flash Tools 2.0</b>
<sub>by <a target="_blank" style="color: white;" href="https://t.me/spottychee">cheetah.cat</a> (<a style="color: white;" target="_blank" href="https://www.patreon.com/cheetahcat">patreon</a>)</sub> <sub>by <a target="_blank" style="color: white;" href="https://t.me/spottychee">cheetah.cat</a> (<a style="color: white;" target="_blank" href="https://t.me/spottychee">telegram</a>)</sub>
</v-toolbar-title> </v-toolbar-title>
<v-spacer></v-spacer> <v-spacer></v-spacer>
</v-app-bar> </v-app-bar>
@ -40,7 +40,22 @@ Serial: {{ global.selectedDevice.deviceSerial }}
<v-col> <v-col>
<v-btn @click="writeE2P()">Write E2P</v-btn> <v-btn @click="writeE2P()">Write E2P</v-btn>
<v-btn @click="dumpE2P()">Dump E2P</v-btn> <v-btn @click="dumpE2P()">Dump E2P</v-btn>
<v-btn color="warning" @click="changeSerialDialog()">Change Serial</v-btn>
<v-dialog v-model="changeSerial.dialog" width="auto">
<template v-slot:activator="{ on, attrs }">
<v-btn color="primary" v-bind="attrs" v-on="on">Change Serial</v-btn>
</template>
<v-card>
<v-card-text>
<v-text-field readonly v-model="changeSerial.oldSerial"></v-text-field>
<v-text-field v-model="changeSerial.newSerial"></v-text-field>
</v-card-text>
<v-card-actions>
<v-btn color="primary" block @click="applyChangeSerial(); changeSerial.dialog = false">Close Dialog</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-col> </v-col>
</v-row> </v-row>
<v-col v-if="global.selectedDevice.model == 'BirdyIOT'"> <v-col v-if="global.selectedDevice.model == 'BirdyIOT'">
@ -286,6 +301,16 @@ class TPLBirdy {
devInfo.idk = parts[4] devInfo.idk = parts[4]
devInfo.deviceSerial = parts[5] devInfo.deviceSerial = parts[5]
break; break;
case "BirdyWP-r3":
devInfo.type = 'BirdyWP-r3'
devInfo.firstIDK = parts[0]
devInfo.model = parts[0]
devInfo.firmwareVersion = parts[1]
devInfo.hardwareVersion = parts[2]
devInfo.e2pVersion = parts[3]
devInfo.idk = parts[4]
devInfo.deviceSerial = parts[5]
break;
case "BirdyE": case "BirdyE":
devInfo.type = 'BirdyE' devInfo.type = 'BirdyE'
devInfo.firstIDK = 0x00 devInfo.firstIDK = 0x00
@ -307,6 +332,11 @@ class TPLBirdy {
await this.sendCMD([ 0x13, ].concat(newSerial.split('').map(x => x.charCodeAt()))) await this.sendCMD([ 0x13, ].concat(newSerial.split('').map(x => x.charCodeAt())))
console.log(this.responseToString(await this.wait4Response())) console.log(this.responseToString(await this.wait4Response()))
break break
case 'BirdyWP-r3': //note to myself, needs a 0 in front of the serial 1234 -> 01234
//if (newSerial.length != 13) throw 'insufficient serial length'
await this.sendCMD([ 0x13, ].concat(`0${ newSerial }`.split('').map(x => x.charCodeAt())))
console.log(this.responseToString(await this.wait4Response()))
break
} }
} }
} }
@ -337,6 +367,11 @@ new Vue({
NwkSKey: '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00', NwkSKey: '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00',
DevAddr: '00 00 00 00', DevAddr: '00 00 00 00',
}, },
changeSerial: {
dialog: false,
oldSerial: '',
newSerial: ''
},
} }
}, },
created() { created() {
@ -363,6 +398,8 @@ new Vue({
} else { } else {
this.global.step = 1 this.global.step = 1
this.global.selectedDevice = deviceInfo this.global.selectedDevice = deviceInfo
this.changeSerial.oldSerial = deviceInfo.deviceSerial
} }
}) })
.catch(error => { .catch(error => {
@ -390,6 +427,23 @@ new Vue({
await this.bPager.sendCMD(loraProvCMD) await this.bPager.sendCMD(loraProvCMD)
let resp = this.bPager.wait4Response() let resp = this.bPager.wait4Response()
console.log(resp) console.log(resp)
},
async applyChangeSerial() {
await this.bPager.writeSerial(this.changeSerial.newSerial)
let resp = this.bPager.wait4Response()
console.log(resp)
let deviceInfo = await this.bPager.getDeviceInfo()
console.log('deviceInfo', deviceInfo)
if (deviceInfo.type === false) {
this.global.step = -1
alert('unknown pager detected')
} else {
this.global.step = 1
this.global.selectedDevice = deviceInfo
this.changeSerial.oldSerial = deviceInfo.deviceSerial
}
} }
} }

Loading…
Cancel
Save