fix saving settings on rak via ble, we can't send too many packets to radio at once

This commit is contained in:
liamcottle
2025-02-14 12:39:17 +13:00
parent e782611022
commit 05e7a9c659
4 changed files with 30 additions and 11 deletions

14
package-lock.json generated
View File

@@ -9,7 +9,7 @@
"version": "0.0.1",
"license": "MIT",
"dependencies": {
"@liamcottle/meshcore.js": "^1.0.3",
"@liamcottle/meshcore.js": "^1.0.4",
"@tailwindcss/forms": "^0.5.10",
"@vitejs/plugin-vue": "^5.2.1",
"autoprefixer": "^10.4.20",
@@ -25,6 +25,12 @@
"vue-router": "^4.5.0"
}
},
"../meshcore.js": {
"name": "@liamcottle/meshcore.js",
"version": "1.0.4",
"extraneous": true,
"license": "MIT"
},
"node_modules/@alloc/quick-lru": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz",
@@ -1116,9 +1122,9 @@
}
},
"node_modules/@liamcottle/meshcore.js": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@liamcottle/meshcore.js/-/meshcore.js-1.0.3.tgz",
"integrity": "sha512-i3AZt2xjSi7kTu86ou+t93K2IPyr7r56ZUZa2A3FRGWzumQ/OxXt30sCox5W6UUcMSLKGzEkMviiTRj7JaDWKw=="
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@liamcottle/meshcore.js/-/meshcore.js-1.0.4.tgz",
"integrity": "sha512-AWVeQASX/3vJANX6acUJwyHELZByHiSLI6J8hD1IfqS9UOACbFRGCWJYxq1x4/SJbJwjFgkxJyc6Nze3miV1SA=="
},
"node_modules/@mongodb-js/saslprep": {
"version": "1.2.0",

View File

@@ -11,7 +11,7 @@
"author": "Liam Cottle <liam@liamcottle.com>",
"license": "MIT",
"dependencies": {
"@liamcottle/meshcore.js": "^1.0.3",
"@liamcottle/meshcore.js": "^1.0.4",
"@tailwindcss/forms": "^0.5.10",
"@vitejs/plugin-vue": "^5.2.1",
"autoprefixer": "^10.4.20",

View File

@@ -4,7 +4,7 @@
<!-- app bar -->
<AppBar title="Radio Settings" :subtitle="GlobalState.selfInfo?.name">
<template v-slot:trailing>
<SaveButton @click="save"/>
<SaveButton @click="save" :is-saving="isSaving"/>
</template>
</AppBar>
@@ -66,6 +66,7 @@ export default {
components: {Page, SaveButton, AppBar},
data() {
return {
isSaving: false,
name: null,
radioFreq: null,
radioBw: null,
@@ -88,6 +89,10 @@ export default {
this.txPower = GlobalState.selfInfo?.txPower;
},
async save() {
// show loading
this.isSaving = true;
try {
// ensure name provided
@@ -128,7 +133,8 @@ export default {
// save settings
await Connection.setAdvertName(this.name);
await Connection.setRadioParams(this.radioFreq, this.radioBw, this.radioSf, this.radioCr, this.txPower);
await Connection.setTxPower(this.txPower);
await Connection.setRadioParams(this.radioFreq, this.radioBw, this.radioSf, this.radioCr);
// reload self info
await Connection.loadSelfInfo();
@@ -145,6 +151,10 @@ export default {
console.log(e);
alert("Failed to save settings!");
}
// show loading
this.isSaving = false;
},
},
computed: {

View File

@@ -150,12 +150,15 @@ class Connection {
}
static async setAdvertName(name) {
await GlobalState.connection.sendCommandSetAdvertName(name);
await GlobalState.connection.setAdvertName(name);
}
static async setRadioParams(radioFreq, radioBw, radioSf, radioCr, txPower) {
await GlobalState.connection.sendCommandSetTxPower(txPower);
await GlobalState.connection.sendCommandSetRadioParams(radioFreq, radioBw, radioSf, radioCr);
static async setTxPower(txPower) {
await GlobalState.connection.setTxPower(txPower);
}
static async setRadioParams(radioFreq, radioBw, radioSf, radioCr) {
await GlobalState.connection.setRadioParams(radioFreq, radioBw, radioSf, radioCr);
}
static async syncDeviceTime() {