add ability to reset path

This commit is contained in:
liamcottle 2025-02-11 18:01:22 +13:00
parent 8bf65ea11f
commit fba9eb63c7
3 changed files with 15 additions and 0 deletions

View file

@ -68,6 +68,9 @@
<button @click="sendCommandSetTxPower" class="border border-gray-500 px-2 bg-gray-100 hover:bg-gray-200 rounded">
SetTxPower
</button>
<button @click="sendCommandResetPath" class="border border-gray-500 px-2 bg-gray-100 hover:bg-gray-200 rounded">
ResetPath
</button>
<button @click="sendCommandSendTxtMsg" class="border border-gray-500 px-2 bg-gray-100 hover:bg-gray-200 rounded">
SendTxtMsg
</button>
@ -139,6 +142,10 @@
const txPower = 22;
await this.device.sendCommandSetTxPower(txPower);
},
async sendCommandResetPath() {
const publicKey = new Uint8Array([244, 231, 60, 250, 245, 218, 131, 156, 156, 98, 130, 39, 222, 43, 123, 147, 98, 200, 218, 251, 242, 89, 111, 108, 25, 191, 127, 151, 222, 192, 233, 177]);
await this.device.sendCommandResetPath(publicKey);
},
async sendCommandSetRadioParams() {
const radioFreq = 917375;
const radioBw = 250000;

View file

@ -18,6 +18,7 @@ class Constants {
SyncNextMessage: 10,
SetRadioParams: 11,
SetTxPower: 12,
ResetPath: 13,
SetAdvertLatLon: 14,
RemoveContact: 15,
}

View file

@ -166,6 +166,13 @@ class Device {
await this.sendToRadioFrame(data.toBytes());
}
async sendCommandResetPath(pubKey) {
const data = new BufferWriter();
data.writeByte(Constants.CommandCodes.ResetPath);
data.writeBytes(pubKey); // 32 bytes
await this.sendToRadioFrame(data.toBytes());
}
async sendCommandSetAdvertLatLon(lat, lon) {
const data = new BufferWriter();
data.writeByte(Constants.CommandCodes.SetAdvertLatLon);