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

View File

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

View File

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

View File

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