mirror of
https://github.com/aljazceru/meshcore-web.git
synced 2025-12-17 08:14:19 +01:00
fix saving settings on rak via ble, we can't send too many packets to radio at once
This commit is contained in:
14
package-lock.json
generated
14
package-lock.json
generated
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user